From: Tim Starling Date: Mon, 15 Jun 2009 14:44:28 +0000 (+0000) Subject: Fix incorrect index usage. Without a condition on the namespace, the use of new_name_... X-Git-Tag: 1.31.0-rc.0~41361 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=aaa6461083de556710a13e2b86fa423a2c10565a;p=lhc%2Fweb%2Fwiklou.git Fix incorrect index usage. Without a condition on the namespace, the use of new_name_timestamp causes a full table scan. This was the primary cause of the recent post-scap downtime. --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 79aba690bf..ab3830b70c 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -318,14 +318,14 @@ class SpecialRecentChanges extends SpecialPage { array( 'rc_new' => 1 ) + $conds, __METHOD__, array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array('recentchanges' => 'new_name_timestamp') ), + 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ), $join_conds ); // Old pages $sqlOld = $dbr->selectSQLText( $tables, '*', array( 'rc_new' => 0 ) + $conds, __METHOD__, array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array('recentchanges' => 'new_name_timestamp') ), + 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ), $join_conds ); # Join the two fast queries, and sort the result set $sql = $dbr->unionQueries(array($sqlNew, $sqlOld), false).' ORDER BY rc_timestamp DESC';