Page MenuHomePhabricator

Slow queries on finding articles created by a given user in GrowthExperiments
Closed, ResolvedPublic

Description

Caused by rEGRE96cd0dd1c8b9: UserImpact: Add created articles count

Currently this is one of the slowest queries in production that is happening quite frequently: https://logstash.wikimedia.org/goto/6ba380f339057c3cc485f8357295cc65

In some cases 30s long queries:
https://logstash.wikimedia.org/app/discover#/doc/logstash-*/logstash-mediawiki-1-7.0.0-1-2025.05.20?id=bXb67ZYB-jfKnJis4S16

They are stuff like:

SELECT  COUNT(*) AS `rowcount`  FROM (SELECT  1  FROM `page` JOIN `revision` ON ((page.page_id = rev_page))   WHERE page.page_namespace = 0 AND rev_actor = 1596 AND rev_parent_id = 0  LIMIT 1000  ) `tmp_count`

Please don't run this query if the user has more than x edits (1000? 10,000?) by checking user_editcount.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

To document the discussion in slack: You can use logging table for now. That should be good enoughTM

Change #1148936 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] (WIP) ComputedUserImpactLookup: Use logging table for counting created articles

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

Change #1148936 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] ComputedUserImpactLookup: Use logging table for approximate created articles count

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

Change #1149394 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@wmf/1.45.0-wmf.2] ComputedUserImpactLookup: Use logging table for approximate created articles count

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

Change #1149394 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.45.0-wmf.2] ComputedUserImpactLookup: Use logging table for approximate created articles count

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

Mentioned in SAL (#wikimedia-operations) [2025-05-22T13:25:28Z] <mszabo@deploy1003> Started scap sync-world: Backport for [[gerrit:1149394|ComputedUserImpactLookup: Use logging table for approximate created articles count (T394785)]]

Mentioned in SAL (#wikimedia-operations) [2025-05-22T13:27:38Z] <mszabo@deploy1003> mszabo, kharlan: Backport for [[gerrit:1149394|ComputedUserImpactLookup: Use logging table for approximate created articles count (T394785)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-05-22T13:36:00Z] <mszabo@deploy1003> Finished scap sync-world: Backport for [[gerrit:1149394|ComputedUserImpactLookup: Use logging table for approximate created articles count (T394785)]] (duration: 10m 32s)