(FR #2178) Add indexes on the cn_assignments table

Change-Id: I68fbf91af7d0d51d7eb2c6c1eac16fda1bc02cf7
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
Merge master into wmf_deploy

Change-Id: Iffac5bf4067f559f5788b3be213af117108f509e