|
@@ -21,6 +21,13 @@ BEGIN |
|
@@ -21,6 +21,13 @@ BEGIN |
21
|
END$$
|
21
|
END$$
|
22
|
DELIMITER ;
|
22
|
DELIMITER ;
|
23
|
|
23
|
|
|
|
24
|
+DELIMITER $$
|
|
|
25
|
+CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
|
|
|
26
|
+BEGIN
|
|
|
27
|
+ DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
|
|
|
28
|
+END$$
|
|
|
29
|
+DELIMITER ;
|
|
|
30
|
+
|
24
|
-- test
|
31
|
-- test
|
25
|
DELIMITER $$
|
32
|
DELIMITER $$
|
26
|
CREATE PROCEDURE `i_sert`(IN `date_inter` INT)
|
33
|
CREATE PROCEDURE `i_sert`(IN `date_inter` INT)
|
|
@@ -32,6 +39,7 @@ DELIMITER ; |
|
@@ -32,6 +39,7 @@ DELIMITER ; |
32
|
-- 删除存储过程
|
39
|
-- 删除存储过程
|
33
|
drop procedure if exists p_del_slow;
|
40
|
drop procedure if exists p_del_slow;
|
34
|
drop procedure if exists p_del_error;
|
41
|
drop procedure if exists p_del_error;
|
|
|
42
|
+drop procedure if exists p_del_perf;
|
35
|
|
43
|
|
36
|
-- 列出所有存储过程
|
44
|
-- 列出所有存储过程
|
37
|
select specific_name from mysql.proc;
|
45
|
select specific_name from mysql.proc;
|
|
@@ -57,6 +65,11 @@ ON SCHEDULE EVERY 1 DAY STARTS '2018-2-1 0:0:0' |
|
@@ -57,6 +65,11 @@ ON SCHEDULE EVERY 1 DAY STARTS '2018-2-1 0:0:0' |
57
|
ON COMPLETION PRESERVE DISABLE
|
65
|
ON COMPLETION PRESERVE DISABLE
|
58
|
DO CALL p_del_error (7);
|
66
|
DO CALL p_del_error (7);
|
59
|
|
67
|
|
|
|
68
|
+CREATE EVENT `e_del_perf_report`
|
|
|
69
|
+ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
|
|
|
70
|
+ON COMPLETION PRESERVE DISABLE
|
|
|
71
|
+DO CALL p_del_perf (7);
|
|
|
72
|
+
|
60
|
-- test
|
73
|
-- test
|
61
|
CREATE EVENT `i_second`
|
74
|
CREATE EVENT `i_second`
|
62
|
ON SCHEDULE EVERY 1 SECOND
|
75
|
ON SCHEDULE EVERY 1 SECOND
|
|
@@ -72,14 +85,17 @@ SELECT event_name,event_definition,interval_value,interval_field,status FROM inf |
|
@@ -72,14 +85,17 @@ SELECT event_name,event_definition,interval_value,interval_field,status FROM inf |
72
|
--开启定时任务
|
85
|
--开启定时任务
|
73
|
alter event e_del_slow_route on completion preserve enable;
|
86
|
alter event e_del_slow_route on completion preserve enable;
|
74
|
alter event e_del_error_report on completion preserve enable;
|
87
|
alter event e_del_error_report on completion preserve enable;
|
|
|
88
|
+alter event e_del_perf_report on completion preserve enable;
|
75
|
|
89
|
|
76
|
--关闭定时任务
|
90
|
--关闭定时任务
|
77
|
alter event e_del_slow_route on completion preserve disable;
|
91
|
alter event e_del_slow_route on completion preserve disable;
|
78
|
alter event e_del_error_report on completion preserve disable;
|
92
|
alter event e_del_error_report on completion preserve disable;
|
|
|
93
|
+alter event e_del_perf_report on completion preserve disable;
|
79
|
|
94
|
|
80
|
--删除定时任务
|
95
|
--删除定时任务
|
81
|
drop event if exists e_del_slow_route;
|
96
|
drop event if exists e_del_slow_route;
|
82
|
drop event if exists e_del_error_report;
|
97
|
drop event if exists e_del_error_report;
|
|
|
98
|
+drop event if exists e_del_perf_report;
|
83
|
|
99
|
|
84
|
ALTER TABLE slow_duration ADD useragent varchar(200);
|
100
|
ALTER TABLE slow_duration ADD useragent varchar(200);
|
85
|
|
101
|
|