20180524.sql
407 Bytes
use webapm;
DELIMITER $$
CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
BEGIN
DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
END$$
DELIMITER ;
CREATE EVENT `e_del_perf_report`
ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
ON COMPLETION PRESERVE DISABLE
DO CALL p_del_perf (3);
alter event e_del_perf_report on completion preserve enable;