r80634 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80633‎ | r80634 | r80635 >
Date:18:55, 20 January 2011
Author:catrope
Status:ok
Tags:
Comment:
CategoryTree: Force cl_sortkey index. This is a backport of the live hack committed in r67176
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -427,6 +427,7 @@
428428 'cl_from' );
429429 $where = array();
430430 $joins = array();
 431+ $options = array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren );
431432
432433 if ( $inverse ) {
433434 $joins['categorylinks'] = array( 'RIGHT JOIN', 'cl_to = page_title AND page_namespace = ' . NS_CATEGORY );
@@ -434,6 +435,7 @@
435436 } else {
436437 $joins['categorylinks'] = array( 'JOIN', 'cl_from = page_id' );
437438 $where['cl_to'] = $title->getDBkey();
 439+ $options['USE INDEX']['categorylinks'] = 'cl_sortkey';
438440
439441 # namespace filter.
440442 if ( $namespaces ) {
@@ -457,9 +459,7 @@
458460 $joins['category'] = array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY );
459461 }
460462
461 - $res = $dbr->select( $tables, $fields, $where, __METHOD__,
462 - array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ),
463 - $joins );
 463+ $res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins );
464464
465465 # collect categories separately from other pages
466466 $categories = '';

Follow-up revisions

RevisionCommit summaryAuthorDate
r810791.17: MFT r80507, r80634, r80770, r80961, r80978, r80985, r81042, r81060, r81...catrope01:15, 27 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67176Avoid hitting cl_timestamp index (and huge filesorts), added by DPL...midom05:52, 1 June 2010

Status & tagging log