Page MenuHomePhabricator

Do not use count(*) for reading list size limits
Closed, ResolvedPublic

Description

Reading list size limits are enforced by doing a count(*) before every insert, which is problematic performance-wise. Per discussion with @jcrespo the best alternative would be to keep track of list sizes in a separate field, ie. add reading_lists.rl_size, make sure it's incremented on insert and decremented on delete, backfill in production, and replace count(*) checks with reading that field.

We don't do the same for list number limit checks as the limit there is 100 lists per user, and the suggested upper limit for number of rows a query should touch is something like 1000.

Event Timeline

Given that all wikis share the same DB and after the patch rl_size needs to be updated to work correctly, it will have to be deployed to all wikis at the same time via SWAT. (Or I guess we could just ignore the buggy behavior given that RL is still in test mode...)

Change 410653 merged by jenkins-bot:
[mediawiki/extensions/ReadingLists@master] Track reading list size

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

Deployment plan:

Change 416610 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/ReadingLists@wmf/1.31.0-wmf.23] Track reading list size

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

Change 416610 merged by jenkins-bot:
[mediawiki/extensions/ReadingLists@wmf/1.31.0-wmf.23] Track reading list size

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

Mentioned in SAL (#wikimedia-operations) [2018-03-06T02:07:14Z] <tgr@tin> Finished scap: T187226#4025352 update ReadingLists (duration: 18m 49s)