Page MenuHomePhabricator

Optimize query in Special Unusedcategories & Special Mostlinkedcategories by using category table
Closed, ResolvedPublic


Author: nicdumz

proposed patch

Special:UnusedCategories && Special:MostLinkedCategories could benefit from the new "cat_pages" field from the new category table.

A patch modifying the SQL queries to use it is included : local testing, after a proper populateCategory.php, seemed successful.

I assumed that with that new indexed field, MostLinkedCategories was no more an expensive query : Please double-check me on this.


Version: unspecified
Severity: enhancement

attachment category.diff ignored as obsolete



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:02 PM
bzimport set Reference to bz13577.
bzimport added a subscriber: Unknown Object (MLST).
brion added a comment.Apr 7 2008, 10:55 PM

Per IRC discussion; as written this may not work correctly for UnusedCategories, as there may not be a category table entry.

For MostLinkedCategories this should work perfectly, though!

Reedy added a comment.Nov 20 2011, 2:51 PM

Special:MostLinkedCategories patch updated and applied in r103759

Reedy added a comment.Nov 20 2011, 2:53 PM

Comment on attachment 4781
proposed patch

Marking obsolete as patch half applied, and other half is wrong

Not sure how much brions statement is still true...

On enwiki:

mysql> explain select cat_title from category where cat_pages = 0;




1 row in set (0.00 sec)

matmarex closed this task as Resolved.Nov 30 2016, 4:47 PM
matmarex added a subscriber: matmarex.

Mostlinkedcategories has been updated; Unusedcategories doesn't really need any fixes (it's not any worse to use the categorylinks table in that query if we're just checking for existence).