Page MenuHomePhabricator

s52421__commonsdelinquent_p.event needs index on done column?
Open, Needs TriagePublic

Description

Tendril is showing some slow queries for s52421__commonsdelinquent_p that look like they might be improved by adding an index on the done column:

update `event` set done=0, note='' where note like '%edit conflict%' and done=2 /* b92dccaab3a2c4b99fc8ccbbcd9f7635 labsdb1005 s52421__commonsdelinquent_p 2s */

select file, wiki, count(*) as cnt, namespace from event where done=0 group by file, wiki, namespace having cnt>500 /* 29a475f6b51e98855cbefde2a8530591 labsdb1005 s52421__commonsdelinquent_p 3s */

SELECT * FROM `event` WHERE done=0 ORDER BY timestamp ASC, log_timestamp ASC /* db05dd54979511c7e4e2d44aca62a078 labsdb1005 s52421__commonsdelinquent_p 2s */

SELECT max(log_timestamp) AS max_ts FROM event WHERE done=1 /* 5fb53237cb97de0c395ae009d6c78220 labsdb1005 s52421__commonsdelinquent_p 3s */

This table has 5.5M rows and most of these look like they would resort to a tablescan.