From: Sean Pringle Date: Tue, 19 Nov 2013 09:53:05 +0000 (+1000) Subject: remove specific FORCE INDEX clauses causing trouble X-Git-Tag: 1.31.0-rc.0~18036^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=a416d3491992cf2baaac0059b458f80eda12c8fa;p=lhc%2Fweb%2Fwiklou.git remove specific FORCE INDEX clauses causing trouble bug: 45619 Change-Id: I6b8f35bd8d709ccc8e4811836e7731bcedb5520c --- diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 3c734c4e69..fd94bea31a 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -201,9 +201,6 @@ class ChangeTags { // Somebody wants to filter on a tag. // Add an INNER JOIN on change_tag - // FORCE INDEX -- change_tags will almost ALWAYS be the correct query plan. - $options['USE INDEX'] = array( 'change_tag' => 'change_tag_tag_id' ); - unset( $options['FORCE INDEX'] ); $tables[] = 'change_tag'; $join_conds['change_tag'] = array( 'INNER JOIN', "ct_$join_cond=$join_cond" ); $conds['ct_tag'] = $filter_tag; diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 1fe98190f0..f4c6f51991 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -735,6 +735,11 @@ class ContribsPager extends ReverseChronologicalPager { # Get the current user name for accounts $join_cond['user'] = Revision::userJoinCond(); + $options = array(); + if ( $index ) { + $options['USE INDEX'] = array( 'revision' => $index ); + } + $queryInfo = array( 'tables' => $tables, 'fields' => array_merge( @@ -744,7 +749,7 @@ class ContribsPager extends ReverseChronologicalPager { 'page_latest', 'page_is_redirect', 'page_len' ) ), 'conds' => $conds, - 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ), + 'options' => $options, 'join_conds' => $join_cond ); @@ -766,10 +771,10 @@ class ContribsPager extends ReverseChronologicalPager { $condition = array(); $join_conds = array(); $tables = array( 'revision', 'page', 'user' ); + $index = false; if ( $this->contribs == 'newbie' ) { $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); $condition[] = 'rev_user >' . (int)( $max - $max / 100 ); - $index = 'user_timestamp'; # ignore local groups with the bot right # @todo FIXME: Global groups may have 'bot' rights $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );