Tracing statistics: bring node count API more in line with rest

Instead of using /stats one now can get the node count with
/stats-nodecount. The basic query itself is now done with raw SQL as
well. This, of course, doesn't bring any performance benefits, because
it is the very same as what the Django ORM created.

This is related to issue #625.