r98569 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98568‎ | r98569 | r98570 >
Date:21:31, 30 September 2011
Author:aaron
Status:ok
Tags:
Comment:
Fixed totally broken query plan for anon edit stats.
* The PK of flaggedrevs changed in r86179...removed bogus FORCE.
* Use a STRAIGHT JOIN hint. The user_timestamp index is ideal here, but the GROUP BY needs to account for that to avoid a filesort.
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php
@@ -308,13 +308,14 @@
309309 array( 'rev_user' => 0, $timeCondition, "(rev_id % $mod) = 0" ),
310310 __METHOD__,
311311 array(
312 - 'GROUP BY' => 'rev_id',
313 - 'USE INDEX' => array( 'p' => 'PRIMARY', 'n' => 'PRIMARY' )
 312+ 'GROUP BY' => array( 'rev_timestamp', 'rev_id' ), // user_timestamp INDEX used
 313+ 'USE INDEX' => array( 'revision' => 'user_timestamp' ), // sanity; mysql picks this
 314+ 'STRAIGHT_JOIN'
314315 ),
315316 array(
316317 'p' => array( 'INNER JOIN', array( // last review
317318 'p.fr_page_id = rev_page',
318 - 'p.fr_rev_id < rev_id',
 319+ 'p.fr_rev_id < rev_id', // not imported later
319320 'p.fr_timestamp < rev_timestamp' ) ),
320321 'n' => array( 'INNER JOIN', array( // next review
321322 'n.fr_page_id = rev_page',

Follow-up revisions

RevisionCommit summaryAuthorDate
r98572MFT r98569aaron21:40, 30 September 2011
r98577Applied similar fix as r98569aaron22:25, 30 September 2011
r110921Backported stats query index usage fixes (r98569) from /trunkaaron08:20, 8 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86179Overdue changes to `flaggedrevs` table:...aaron03:39, 16 April 2011

Status & tagging log