Improve performance of ActiveUsersPager query

Authored by Anomie on Jul 9 2018, 7:22 PM.


Improve performance of ActiveUsersPager query

The query can be very slow, as it has to scan all the recentchanges rows
for all the users in querycachetwo (for activeusers). We can speed that
up at the cost of not filtering out users who were active when
querycachetwo was last updated but aren't anymore.

Also in testing this I found that the query is extremely slow when the
actor table migration stage is in one of the transitional states. This
too can be sped up with some custom logic.

Bug: T199044
Change-Id: Ia9d2ff00cfcdcc6191d854eb4365ecbf67f60b1c