From 686a1c70aa12560af5e6674f8fb56f4ff4bc7fb2 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 20 Nov 2011 14:49:07 +0000 Subject: [PATCH] * (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 --- includes/specials/SpecialMostlinkedcategories.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialMostlinkedcategories.php b/includes/specials/SpecialMostlinkedcategories.php index 6b36d5a496..672462a1de 100644 --- a/includes/specials/SpecialMostlinkedcategories.php +++ b/includes/specials/SpecialMostlinkedcategories.php @@ -25,7 +25,7 @@ */ /** - * A querypage to show categories ordered in descending order by the pages in them + * A querypage to show categories ordered in descending order by the pages in them * * @ingroup SpecialPage */ @@ -35,16 +35,15 @@ class MostlinkedCategoriesPage extends QueryPage { parent::__construct( $name ); } - function isExpensive() { return true; } function isSyndicated() { return false; } function getQueryInfo() { return array ( - 'tables' => array ( 'categorylinks' ), - 'fields' => array ( 'cl_to AS title', + 'tables' => array ( 'category' ), + 'fields' => array ( 'cat_title AS title', NS_CATEGORY . ' AS namespace', - 'COUNT(*) AS value' ), - 'options' => array ( 'GROUP BY' => 'cl_to' ) + 'cat_pages AS value' ), + 'options' => array ( 'ORDER BY' => 'cat_pages' ) ); } -- 2.20.1