Index: trunk/phase3/includes/job/JobQueue.php |
— | — | @@ -117,8 +117,12 @@ |
118 | 118 | } |
119 | 119 | } |
120 | 120 | $offset = intval( $offset ); |
121 | | - $row = $dbr->selectRow( 'job', '*', array_merge( $conditions, array( "job_id >= $offset" ) ) , __METHOD__, |
122 | | - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) |
| 121 | + $options = array( 'ORDER BY' => 'job_id', 'USE INDEX' => 'PRIMARY' ); |
| 122 | + |
| 123 | + $row = $dbr->selectRow( 'job', '*', |
| 124 | + array_merge( $conditions, array( "job_id >= $offset" ) ), |
| 125 | + __METHOD__, |
| 126 | + $options |
123 | 127 | ); |
124 | 128 | |
125 | 129 | // Refetching without offset is needed as some of job IDs could have had delayed commits |
— | — | @@ -126,8 +130,7 @@ |
127 | 131 | // |
128 | 132 | if ( $row === false ) { |
129 | 133 | if ( $offset != 0 ) { |
130 | | - $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, |
131 | | - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); |
| 134 | + $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, $options ); |
132 | 135 | } |
133 | 136 | |
134 | 137 | if ( $row === false ) { |