Page MenuHomePhabricator

Slow query in API list=tags
Closed, ResolvedPublic

Description

Listing tags is slow, and listing many tags is slower:

Expectation (readQueryTime <= 5) by ApiMain::setRequestExpectations not met (actual: 18.325773954391):
query: SELECT ct_tag,COUNT(*) AS `hitcount` FROM `change_tag` GROUP BY ct_tag ORDER BY ct_tag LIMIT N

We don't need to run this query at all, because ChangeTags::tagUsageStatistics() already does it and caches it.

Event Timeline

Catrope created this task.May 5 2017, 1:04 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 5 2017, 1:04 AM

Change 352069 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/core@master] ApiQueryTags: Use cached statistics instead of querying hit counts ourselves

https://gerrit.wikimedia.org/r/352069

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.May 5 2017, 1:17 PM

Change 352069 merged by jenkins-bot:
[mediawiki/core@master] ApiQueryTags: Use cached statistics instead of querying hit counts ourselves

https://gerrit.wikimedia.org/r/352069

Anomie closed this task as Resolved.May 5 2017, 2:12 PM
Anomie added a subscriber: Anomie.

The slow query isn't in ApiQueryTags anymore, now it's in ChangeTags and hidden behind a 5-minute cache.