From: Roan Kattouw Date: Wed, 3 May 2017 15:00:08 +0000 (-0700) Subject: Use IGNORE INDEX(ls_log_id) instead of FORCE INDEX(ls_field_val) X-Git-Tag: 1.31.0-rc.0~3352^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=a70ef33e005080c2e41fa18bd5d3b99e8313bebd;p=lhc%2Fweb%2Fwiklou.git Use IGNORE INDEX(ls_log_id) instead of FORCE INDEX(ls_field_val) ls_field_val was renamed to PRIMARY, but this is only partially complete in WMF production. There is only one other index on the log_search table, so ignoring that one is equivalent to forcing the other one. Bug: T17441 Change-Id: I63182a9f94eabb4cc47414d86b02c82bde1e58b0 --- diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index ea28ff202e..e02b8a6618 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -305,14 +305,13 @@ class LogPager extends ReverseChronologicalPager { $options = $basic['options']; $joins = $basic['join_conds']; - $index = []; # Add log_search table if there are conditions on it. # This filters the results to only include log rows that have # log_search records with the specified ls_field and ls_value values. if ( array_key_exists( 'ls_field', $this->mConds ) ) { $tables[] = 'log_search'; - $index['log_search'] = 'ls_field_val'; - $index['logging'] = 'PRIMARY'; + $options['IGNORE INDEX'] = [ 'log_search' => 'ls_log_id' ]; + $options['USE INDEX'] = [ 'logging' => 'PRIMARY' ]; if ( !$this->hasEqualsClause( 'ls_field' ) || !$this->hasEqualsClause( 'ls_value' ) ) { @@ -322,9 +321,6 @@ class LogPager extends ReverseChronologicalPager { $options[] = 'DISTINCT'; } } - if ( count( $index ) ) { - $options['USE INDEX'] = $index; - } # Don't show duplicate rows when using log_search $joins['log_search'] = [ 'INNER JOIN', 'ls_log_id=log_id' ];