mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-6388: ANALYZE $stmt output in the slow query log
Add testcase.
This commit is contained in:
parent
47ced65566
commit
aa0fd5ca53
3 changed files with 42 additions and 0 deletions
17
mysql-test/r/analyze_stmt_slow_query_log.result
Normal file
17
mysql-test/r/analyze_stmt_slow_query_log.result
Normal file
|
@ -0,0 +1,17 @@
|
|||
drop table if exists t1;
|
||||
create table t1 (a int);
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
select * from t1 where a<3;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
# explain: 1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL
|
||||
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
# explain: 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 30.00 Using where
|
||||
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1
mysql-test/t/analyze_stmt_slow_query_log-master.opt
Normal file
1
mysql-test/t/analyze_stmt_slow_query_log-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--slow-query-log --long-query-time=0.00001 --log-slow-verbosity=query_plan,explain
|
24
mysql-test/t/analyze_stmt_slow_query_log.test
Normal file
24
mysql-test/t/analyze_stmt_slow_query_log.test
Normal file
|
@ -0,0 +1,24 @@
|
|||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int);
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
select * from t1 where a<3;
|
||||
drop table t1;
|
||||
let SLOW_LOG_FILE= `select @@slow_query_log_file`;
|
||||
|
||||
# select @@slow_query_log_file;
|
||||
|
||||
perl;
|
||||
|
||||
my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set";
|
||||
open(FILE, $slow_log_file) or die "Failed to open $slow_log_file";
|
||||
while(<FILE>) {
|
||||
if (/explain:/) {
|
||||
print $_;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
EOF
|
Loading…
Reference in a new issue