From aaa6461083de556710a13e2b86fa423a2c10565a Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 15 Jun 2009 14:44:28 +0000 Subject: [PATCH] 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. --- includes/specials/SpecialRecentchanges.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'; -- 2.20.1