Just a reminder for y’all. In this case a speedup factor of 3.82 times!
The query:
SELECT path_id, count(path_id) as cnt, path FROM `raw`, path where raw.path_id IN ( SELECT id FROM `path` where lastseen >= DATE_FORMAT( CURRENT_DATE - INTERVAL 1 MONTH, '%Y-%m-01' ) AND path != '' ) AND raw.path_id = path.id group by path_id ORDER BY cnt DESC;
The querytime: 71.94 seconds
Added index to an integer field
ALTER TABLE `raw` ADD INDEX(`path_id`);
The querytime: 18.83 seconds
Leave a Reply