Revert "Move subselects into the main pager query"

This reverts commit 87a5f77199e5b1101a8b5f9de6ad615ef4eaafc2.

Unfortunately, this only worked on some of our db servers.

Change-Id: I412d10db9d6c72b16c118d2b671c4c339280ab6c