Actions
Bug #23663
closedReports expiry task does a full table scan
Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Description
Running foreman-rake reports:expire days=1
does a full table scan:
mysql> explain DELETE FROM `reports` WHERE `reports`.`type` IN ('ConfigReport') AND (reports.created_at < '2018-05-17 10:25:58'); +----+-------------+---------+------------+------+---------------------------------------------------------+------+---------+------+--------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+---------+------------+------+---------------------------------------------------------+------+---------+------+--------+----------+-------------+ | 1 | DELETE | reports | NULL | ALL | index_reports_on_type,index_reports_on_type_and_host_id | NULL | NULL | NULL | 573019 | 100.00 | Using where | +----+-------------+---------+------------+------+---------------------------------------------------------+------+---------+------+--------+----------+-------------+
Actions