Page MenuHomePhabricator

"View history" performs many page_touched queries from GlobalUserPage via unbatched onTitleIsAlwaysKnown hook
Open, Needs TriagePublic

Description

Some MediaWiki page views, such as histories (XHGui) or Special:ListUsers (XHGui), can result in many calls to GlobalUserPage\Hooks::shouldDisplayGlobalPage() / getCentralTouched(). Each of these calls can correspond to one database query (see the calls to SelectQueryBuilder::fetchRow() in those XHGui links – 199 and 498 calls respectively), which is inefficient. GlobalUserPage should try to batch these lookups. I’m not sure if that’s possible for Special:ListUsers, but for action=history it should be possible using the PageHistoryPager::doBatchLookups hook (PageHistoryPager__doBatchLookupsHook interface, onPageHistoryPager__doBatchLookups() method); compare e.g. T292545 for related batching in Wikibase.