ApiQueryLogEvents: when user is specified, omit STRAIGHT_JOIN

Otherwise it tries to scan the whole logging table, joining every row on
actor.

Bug: T282122
Change-Id: Ia34897a496656e0d0d26f9e038b1edb0377c461e
This commit is contained in:
Tim Starling 2021-05-07 13:56:53 +10:00
parent 35c0a9b783
commit cd6c7786a4

View file

@ -245,7 +245,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
// `logging` and filesorting is somehow better than querying $limit+1 rows from `logging`.
// Tell it not to reorder the query. But not when `letag` was used, as it seems as likely
// to be harmed as helped in that case.
if ( $params['tag'] === null ) {
// If "user" was specified, it's obviously correct to query actor first (T282122)
if ( $params['tag'] === null && $user === null ) {
$this->addOption( 'STRAIGHT_JOIN' );
}