Page MenuHomePhabricator

Change default recentchanges query time on large wikis
Closed, ResolvedPublicFeature

Description

The default query on the recentchanges page has the condition rc_timestamp >= '<now - rcdays>' where rcdays is 7 by default.

For large wikis (see list here) we want to change rcdays to 1. This will make no material difference for the user - on a large wiki the default view is of the last few minutes rather than days

If a user picks complex filters that mean that the db can't use indexes and scans the table, then this will reduce the number of rows scanned and reduce the number of slow queries

It's just a matter of setting $wgDefaultUserOptions[ 'rcdays' ] = 1 for large wikis

User impact is expected to be zero, but we still ought to inform users via tech news

Event Timeline

jsn.sherman subscribed.

I think changing $wgDefaultUserOptions[ 'rcdays' ] would impact the default for all queries by users who haven't set their own default in preferences. I also think it would be ignored for users who set their preference. The idea here is to only change the query when the users haven't touched the form since there is no way that the default view will return that many results on a busy wiki

I'd suggest adding a new config for doing something like

rc_days =  min(options[ 'rcdays' ], defaultfiltersRCdays])'
rc_timestamp >= '<now() - rcdays>'

just for the default, unfiltered view

I think changing $wgDefaultUserOptions[ 'rcdays' ] would impact the default for all queries by users who haven't set their own default in preferences. I also think it would be ignored for users who set their preference. The idea here is to only change the query when the users haven't touched the form since there is no way that the default view will return that many results on a busy wiki

I'd suggest adding a new config for doing something like

rc_days =  min(options[ 'rcdays' ], defaultfiltersRCdays])'
rc_timestamp >= '<now() - rcdays>'

just for the default, unfiltered view

Is the idea here to only restrict the query to 1 day as long as the user does not select a different time interval or do we want to disallow trying to fetch data from more than one day ago for any query?

Change #1178990 had a related patch set uploaded (by Zabe; author: Zabe):

[operations/mediawiki-config@master] Reduce default recentchanges query time on large wikis to 1 day

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

Change #1178990 merged by jenkins-bot:

[operations/mediawiki-config@master] Reduce default recentchanges query time on large wikis to 1 day

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

Mentioned in SAL (#wikimedia-operations) [2025-08-18T12:37:23Z] <ladsgroup@deploy1003> Started scap sync-world: Backport for [[gerrit:1178990|Reduce default recentchanges query time on large wikis to 1 day (T399455)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-18T12:41:09Z] <ladsgroup@deploy1003> zabe, ladsgroup: Backport for [[gerrit:1178990|Reduce default recentchanges query time on large wikis to 1 day (T399455)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-18T12:49:59Z] <ladsgroup@deploy1003> Finished scap sync-world: Backport for [[gerrit:1178990|Reduce default recentchanges query time on large wikis to 1 day (T399455)]] (duration: 12m 36s)

Ladsgroup assigned this task to Zabe.

User impact is expected to be zero, but we still ought to inform users via tech news

Suggested wording for Tech News @Quiddity:

On large wikis, the default time period to display edits from in Special:RecentChanges has been changed from 7 days to 1 day, as part of a performance improvement project. Due to the volume of edits on these wikis, this should have no user-facing impact.

Has with this something been changed to API or Mediawiki database? Since August 18th some of my bots are working not properly any more using rc_timestamp than before.

Has with this something been changed to API or Mediawiki database? Since August 18th some of my bots are working not properly any more using rc_timestamp than before.

Not this task. Possibly this is because the WMF User Agent Policy is now being enforced (T400119: Block traffic from user-agents not honoring our policy?

Alternatively it could be related to T36320: Remove obsolete recentchanges.rc_new database field.

Possibly this is because the WMF User Agent Policy is now being enforced

No, this is not the problem - but now I know that I have to debug this other ways. Thank you ...

Zabe moved this task from Triage to Done on the DBA board.

Would’ve been good to find a way to do this change without affecting Special:RecentChangesLinked (since usually 1 day isn’t enough on that special page) but it’s a really small nitpick.