improve relations count #426 and ubiquity #409

* remove count of relations from main query
* ubiquity use now a count on trees table