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
This commit is contained in:
Roan Kattouw 2017-05-03 08:00:08 -07:00
parent cf35ff756c
commit a70ef33e00

View file

@ -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' ];