r55624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55623‎ | r55624 | r55625 >
Date:14:58, 27 August 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: Do a STRAIGHT_JOIN in ApiQueryBacklinks's first query to counter a MySQL 4 bug where the optmizer chooses to do a table scan on page instead.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -103,7 +103,7 @@
104104 * LIMIT 11 ORDER BY pl_from
105105 */
106106 $db = $this->getDB();
107 - $this->addTables(array('page', $this->bl_table));
 107+ $this->addTables(array($this->bl_table, 'page'));
108108 $this->addWhere("{$this->bl_from}=page_id");
109109 if(is_null($resultPageSet))
110110 $this->addFields(array('page_id', 'page_title', 'page_namespace'));
@@ -122,6 +122,7 @@
123123 $this->addWhereFld('page_is_redirect', 0);
124124 $this->addOption('LIMIT', $this->params['limit'] + 1);
125125 $this->addOption('ORDER BY', $this->bl_from);
 126+ $this->addOption('STRAIGHT_JOIN');
126127 }
127128
128129 private function prepareSecondQuery($resultPageSet = null) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r55625wmf-deployment: Merge r55624 (fix long-running queries in ApiQueryBacklinks)catrope15:01, 27 August 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   16:56, 27 August 2009

I'm told this change is Domas-approved.

Status & tagging log