API: Add STRAIGHT_JOIN to ApiQueryUserContribs to avoid planner oddness
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 23 Apr 2019 18:02:34 +0000 (14:02 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 26 Apr 2019 20:15:24 +0000 (16:15 -0400)
commit7aadd1f2a155f584be3c8b3d95b081afbe74e4d3
tree7e1bb13c85728fcbbddccc8d76b4afa0a6205f89
parent44a2f3e5ee6d4f1d484f9878de4c22c0e7d8d76d
API: Add STRAIGHT_JOIN to ApiQueryUserContribs to avoid planner oddness

For some unknown reason, when the `actor` table has few enough rows (or
few enough compared to `revision_actor_temp`) MariaDB 10.1.37 decides it
makes more sense to fetch everything from `actor` + `revision_actor_temp`
and filesort rather than fetching the limited number of rows from
`revision_actor_temp`.

We can work around it by telling it to not reorder the query, but then
(unlike in I9da981c0) we also have to reorder it ourselves to put
`revision_actor_temp` first instead of `revision`.

Bug: T221511
Change-Id: Ic63875b26a051a2da58374d5d76c95a6fa8ecc8e
includes/api/ApiQueryUserContribs.php