Improve performance of statistics queries

To refer to all reviews of a certain project, requires to JOIN either the
skeletons or the treenodes (class_instance table or treenode table). Before, the
treenode table was used, but it turns out that using the class_instance table is
usually faster.