From: Brad Jorsch Date: Thu, 23 May 2019 16:58:19 +0000 (-0400) Subject: API: Add IGNORE INDEX to avoid bad plan in ApiQueryRevisions X-Git-Tag: 1.34.0-rc.0~1593^2 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=a3f0784b18c27f84399cafe501b71015c87076be;p=lhc%2Fweb%2Fwiklou.git API: Add IGNORE INDEX to avoid bad plan in ApiQueryRevisions None of the queries generated by ApiQueryRevisions should be using the `rev_timestamp` index, but MariaDB is insisting on doing so for one particular query anyway. Bug: T224017 Change-Id: I9476532d5896d9ba901c4c7398890bfecb1a318d --- diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index e60835bb02..ee6a264281 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -389,6 +389,10 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { $this->addOption( 'LIMIT', $this->limit + 1 ); + // T224017: `rev_timestamp` is never the correct index to use for this module, but + // MariaDB (10.1.37-39) sometimes insists on trying to use it anyway. Tell it not to. + $this->addOption( 'IGNORE INDEX', [ 'revision' => 'rev_timestamp' ] ); + $count = 0; $generated = []; $hookData = [];