| 1 |
SET @global_slow_query_log = @@global.slow_query_log; |
| 2 |
SET @global_log_output = @@global.log_output; |
| 3 |
SET @@session.long_query_time=1; |
| 4 |
SET @@global.log_output = 'TABLE'; |
| 5 |
'----When slow_query_log = OFF----' |
| 6 |
SET @@global.slow_query_log = OFF; |
| 7 |
TRUNCATE mysql.slow_log; |
| 8 |
SELECT sleep(2); |
| 9 |
sleep(2) |
| 10 |
0 |
| 11 |
SELECT count(*) FROM mysql.slow_log; |
| 12 |
count(*) |
| 13 |
0 |
| 14 |
'----When slow_query_log = ON-----' |
| 15 |
SET @@global.slow_query_log = ON; |
| 16 |
TRUNCATE mysql.slow_log; |
| 17 |
SELECT sleep(2) AS bug53630; |
| 18 |
bug53630 |
| 19 |
0 |
| 20 |
SELECT count(*) > 0 FROM mysql.slow_log WHERE sql_text LIKE '% bug53630'; |
| 21 |
count(*) > 0 |
| 22 |
1 |
| 23 |
SELECT thread_id - connection_id() FROM mysql.slow_log |
| 24 |
WHERE sql_text LIKE '% bug53630' |
| 25 |
ORDER BY start_time DESC LIMIT 1; |
| 26 |
thread_id - connection_id() |
| 27 |
0 |
| 28 |
'Bug#47905 stored procedures not logged correctly to slow query log' |
| 29 |
TRUNCATE mysql.slow_log; |
| 30 |
CREATE PROCEDURE p_test() |
| 31 |
BEGIN |
| 32 |
select sleep(2); |
| 33 |
select 1; |
| 34 |
END// |
| 35 |
CALL p_test(); |
| 36 |
sleep(2) |
| 37 |
0 |
| 38 |
1 |
| 39 |
1 |
| 40 |
SELECT count(*) > 0 FROM mysql.slow_log; |
| 41 |
count(*) > 0 |
| 42 |
1 |
| 43 |
DROP PROCEDURE p_test; |
| 44 |
SET sql_mode = default; |
| 45 |
SET @@global.log_output = @global_log_output; |
| 46 |
SET @global.slow_query_log = @global_slow_query_log; |
| 47 |
TRUNCATE TABLE mysql.general_log; |
| 48 |
TRUNCATE TABLE mysql.slow_log; |