https://bugzilla.wikimedia.org/show_bug.cgi?id=65246

--- Comment #5 from Sean Pringle <[email protected]> ---
We already have a couple of COUNT(*) queries around for watchlists, like
countItems(), so I think this would be OK to consider as long as it stays a
simple select without joins. The extra covering index would be necessary.

Using countItems() as the example; it accepts a db connection arg, so I suggest
stick with that approach and use the api group connection for api-generated
traffic.

Both watchlist and api groups are on specific slaves now, so if needs be we can
do further tuning for them relatively easily, such as partitioning by wl_user.

To be safe we could also:

a) Limit by date as Jared said. Presumably wouldn't help with run-away bots
generating large lists, though.

b) Cap the number of rows hit using a subquery, like:

SELECT COUNT(*) FROM (SELECT wl_user FROM watchlist WHERE wl_user = ? AND
wl_notificationtimestamp IS NOT NULL LIMIT 1001);

If < 1000, count is accurate.

If > 1000, be vague: "more than..", "thousands", a magic constant, etc.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to