Bunch of work optimizing queries.  There is now work to be done in the world of refactoring.

The stuff that keeps queries optimal needs to be a per viewport thing.