r103759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103758‎ | r103759 | r103760 >
Date:14:49, 20 November 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 13577) Optimize query in Special Unusedcategories & Special Mostlinkedcategories by using category table

Patch by Nicolas Dumazet, updated in line with changed code

If unbounded it does a filesort. With a limit, it's a fine query

Marking as not expensive
Modified paths:
  • /trunk/phase3/includes/specials/SpecialMostlinkedcategories.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialMostlinkedcategories.php
@@ -25,7 +25,7 @@
2626 */
2727
2828 /**
29 - * A querypage to show categories ordered in descending order by the pages in them
 29+ * A querypage to show categories ordered in descending order by the pages in them
3030 *
3131 * @ingroup SpecialPage
3232 */
@@ -35,16 +35,15 @@
3636 parent::__construct( $name );
3737 }
3838
39 - function isExpensive() { return true; }
4039 function isSyndicated() { return false; }
4140
4241 function getQueryInfo() {
4342 return array (
44 - 'tables' => array ( 'categorylinks' ),
45 - 'fields' => array ( 'cl_to AS title',
 43+ 'tables' => array ( 'category' ),
 44+ 'fields' => array ( 'cat_title AS title',
4645 NS_CATEGORY . ' AS namespace',
47 - 'COUNT(*) AS value' ),
48 - 'options' => array ( 'GROUP BY' => 'cl_to' )
 46+ 'cat_pages AS value' ),
 47+ 'options' => array ( 'ORDER BY' => 'cat_pages' )
4948 );
5049 }
5150

Follow-up revisions

RevisionCommit summaryAuthorDate
r103760Query already does ORDER BY value, so remove manual order by from r103759reedy15:01, 20 November 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   00:53, 23 November 2011

I knew that table would come in handy. :)

#Comment by Reedy (talk | contribs)   00:54, 23 November 2011

Just a shame it took 3 years to get the useful part of the patch applied ;)

Oh well, it's done now! :D

Status & tagging log