38 lines
2.7 KiB
Plaintext
38 lines
2.7 KiB
Plaintext
SET @my_slow_logname = @@global.slow_query_log_file;
|
|
SET @my_lqt = @@global.long_query_time;
|
|
SET GLOBAL slow_query_log_file= '.../my_extra_big.log';
|
|
SET SESSION long_query_time = 20;
|
|
SET GLOBAL long_query_time = 0;
|
|
SELECT COUNT(*) FROM big_table_slow;
|
|
COUNT(*)
|
|
200
|
|
SELECT COUNT(*) FROM big_table_slow;
|
|
COUNT(*)
|
|
200
|
|
SELECT COUNT(*) FROM big_table_slow WHERE id>100 AND id<200;
|
|
COUNT(*)
|
|
49
|
|
SELECT * FROM big_table_slow WHERE id=2;
|
|
id v t
|
|
2 v bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba
|
|
SELECT COUNT(*) FROM big_table_slow WHERE id>100;
|
|
COUNT(*)
|
|
150
|
|
SELECT COUNT(*) FROM big_table_slow WHERE id<100;
|
|
COUNT(*)
|
|
49
|
|
# Cleanup
|
|
SET GLOBAL long_query_time=@my_lqt;
|
|
SET GLOBAL slow_query_log_file = @my_slow_logname;
|
|
DROP TABLE big_table_slow;
|
|
#
|
|
# This is a hack to check the log result.
|
|
# We strip off time related fields (non-deterministic) and verify the rest are correct.
|
|
#
|
|
Rows_sent: 1 Rows_examined: 0 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 58 Read_first: 0 Read_last: 0 Read_key: 0 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|
|
Rows_sent: 1 Rows_examined: 0 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 58 Read_first: 0 Read_last: 0 Read_key: 0 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|
|
Rows_sent: 1 Rows_examined: 49 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 57 Read_first: 0 Read_last: 0 Read_key: 1 Read_next: 49 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|
|
Rows_sent: 1 Rows_examined: 1 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 307 Read_first: 0 Read_last: 0 Read_key: 1 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|
|
Rows_sent: 1 Rows_examined: 150 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 58 Read_first: 0 Read_last: 0 Read_key: 1 Read_next: 150 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|
|
Rows_sent: 1 Rows_examined: 49 Errno: 0 Killed: 0 Bytes_received: 0 Bytes_sent: 57 Read_first: 1 Read_last: 0 Read_key: 1 Read_next: 49 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0
|