X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=962d9561300c0ff60f8c62e08cc9263e1a02516b;hb=5ca0cf6e273721684c89d2aceaf314366e9142bc;hp=cc11c486c3e771c6ea3e9042b41582789eb19ef9;hpb=39a72e0804285f596c63f32a02a0a84861f8a277;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index cc11c486c3..962d956130 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -183,6 +183,10 @@ class ApiQueryLogEvents extends ApiQueryBase { $db, 'log_user', User::newFromName( $params['user'], false ) ); $this->addWhere( $q['conds'] ); + + // T71222: MariaDB's optimizer, at least 10.1.37 and .38, likes to choose a wildly bad plan for + // some reason for this code path. Tell it not to use the wrong index it wants to pick. + $this->addOption( 'IGNORE INDEX', [ 'logging' => [ 'times' ] ] ); } $title = $params['title']; @@ -234,6 +238,14 @@ class ApiQueryLogEvents extends ApiQueryBase { } } + // T220999: MySQL/MariaDB (10.1.37) can sometimes irrationally decide that querying `actor` before + // `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 ) { + $this->addOption( 'STRAIGHT_JOIN' ); + } + $count = 0; $res = $this->select( __METHOD__ ); $result = $this->getResult();