| 1 |
SET @old_log_output= @@global.log_output; |
| 2 |
SET @old_log_disable_statements= @@global.log_disabled_statements; |
| 3 |
|
| 4 |
|
| 5 |
CREATE TABLE t1 (i INT PRIMARY KEY AUTO_INCREMENT, j VARCHAR(255) ) ENGINE=MyISAM; |
| 6 |
insert into t1 (j) values ('a'),('b'),('c'),('d'); |
| 7 |
|
| 8 |
# enable slow logging to table |
| 9 |
SET GLOBAL log_output = 'file,table'; |
| 10 |
|
| 11 |
DELIMITER $; |
| 12 |
CREATE PROCEDURE slow() |
| 13 |
BEGIN |
| 14 |
SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b'; |
| 15 |
SELECT count(*) from t1 where j>'a'; |
| 16 |
END |
| 17 |
$ |
| 18 |
|
| 19 |
DELIMITER ;$ |
| 20 |
|
| 21 |
select @@log_disabled_statements; |
| 22 |
TRUNCATE TABLE mysql.general_log; |
| 23 |
check table t1; |
| 24 |
CALL slow(); |
| 25 |
--disable_ps2_protocol |
| 26 |
SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2'; |
| 27 |
--enable_ps2_protocol |
| 28 |
|
| 29 |
--echo --> |
| 30 |
SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%"; |
| 31 |
--echo <-- |
| 32 |
|
| 33 |
TRUNCATE TABLE mysql.general_log; |
| 34 |
SET SESSION log_disabled_statements=""; |
| 35 |
check table t1; |
| 36 |
CALL slow(); |
| 37 |
--disable_ps2_protocol |
| 38 |
SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3'; |
| 39 |
--enable_ps2_protocol |
| 40 |
|
| 41 |
--echo --> |
| 42 |
SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%"; |
| 43 |
--echo <-- |
| 44 |
|
| 45 |
TRUNCATE TABLE mysql.general_log; |
| 46 |
SET SESSION log_disabled_statements="sp,slave"; |
| 47 |
check table t1; |
| 48 |
CALL slow(); |
| 49 |
--disable_ps2_protocol |
| 50 |
SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4'; |
| 51 |
--enable_ps2_protocol |
| 52 |
|
| 53 |
--echo --> |
| 54 |
SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%"; |
| 55 |
--echo <-- |
| 56 |
|
| 57 |
DROP TABLE t1; |
| 58 |
DROP PROCEDURE slow; |
| 59 |
|
| 60 |
# |
| 61 |
# Restore setup |
| 62 |
# |
| 63 |
TRUNCATE TABLE mysql.general_log; |
| 64 |
SET @@global.log_output= @old_log_output; |
| 65 |
SET @@global.log_disabled_statements= @old_log_disable_statements; |
| 66 |
|
| 67 |
|