From: Aaron Schulz Date: Thu, 30 Jun 2011 20:32:41 +0000 (+0000) Subject: * Follow-up r84397: make sure that mysql uses the job_id index even with the job_cmd... X-Git-Tag: 1.31.0-rc.0~29141 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=fc3a285e66943a6f37cd7c9e6c4d3cc024825d41;p=lhc%2Fweb%2Fwiklou.git * Follow-up r84397: make sure that mysql uses the job_id index even with the job_cmd clause * Removed redundant 'LIMIT' option, already added by using selectRow() --- diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php index 0cf0e5b70a..953d5869a4 100644 --- a/includes/job/JobQueue.php +++ b/includes/job/JobQueue.php @@ -117,8 +117,12 @@ abstract class Job { } } $offset = intval( $offset ); - $row = $dbr->selectRow( 'job', '*', array_merge( $conditions, array( "job_id >= $offset" ) ) , __METHOD__, - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) + $options = array( 'ORDER BY' => 'job_id', 'USE INDEX' => 'PRIMARY' ); + + $row = $dbr->selectRow( 'job', '*', + array_merge( $conditions, array( "job_id >= $offset" ) ), + __METHOD__, + $options ); // Refetching without offset is needed as some of job IDs could have had delayed commits @@ -126,8 +130,7 @@ abstract class Job { // if ( $row === false ) { if ( $offset != 0 ) { - $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); + $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, $options ); } if ( $row === false ) {