mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-406: ANALYZE $stmt: more testcases, fix memory leak
This commit is contained in:
parent
424d5de89d
commit
3da81ab97f
3 changed files with 43 additions and 0 deletions
|
@ -147,3 +147,25 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where
|
||||||
1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0 100.00 40.00 Using where
|
1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0 100.00 40.00 Using where
|
||||||
drop table t0,t1,t2;
|
drop table t0,t1,t2;
|
||||||
|
#
|
||||||
|
# Check non-merged derived tables
|
||||||
|
#
|
||||||
|
create table t0 (a int, b int);
|
||||||
|
insert into t0 values
|
||||||
|
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||||
|
update t0 set b=b/3;
|
||||||
|
analyze select * from (select count(*),max(a),b from t0 group by b) T;
|
||||||
|
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||||
|
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 4 100.00 100.00
|
||||||
|
2 DERIVED t0 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using temporary; Using filesort
|
||||||
|
drop table t0;
|
||||||
|
#
|
||||||
|
# Check ORDER/GROUP BY
|
||||||
|
#
|
||||||
|
create table t0 (a int, b int);
|
||||||
|
insert into t0 values
|
||||||
|
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||||
|
analyze select count(*),max(a),b from t0 where a<7 group by b;
|
||||||
|
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||||
|
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10 100.00 70.00 Using where; Using temporary; Using filesort
|
||||||
|
drop table t0;
|
||||||
|
|
|
@ -107,3 +107,23 @@ analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0;
|
||||||
|
|
||||||
drop table t0,t1,t2;
|
drop table t0,t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Check non-merged derived tables
|
||||||
|
--echo #
|
||||||
|
create table t0 (a int, b int);
|
||||||
|
insert into t0 values
|
||||||
|
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||||
|
|
||||||
|
update t0 set b=b/3;
|
||||||
|
analyze select * from (select count(*),max(a),b from t0 group by b) T;
|
||||||
|
drop table t0;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Check ORDER/GROUP BY
|
||||||
|
--echo #
|
||||||
|
create table t0 (a int, b int);
|
||||||
|
insert into t0 values
|
||||||
|
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||||
|
|
||||||
|
analyze select count(*),max(a),b from t0 where a<7 group by b;
|
||||||
|
drop table t0;
|
||||||
|
|
|
@ -5283,6 +5283,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
|
||||||
result= save_result;
|
result= save_result;
|
||||||
if (!result && !(result= new select_send()))
|
if (!result && !(result= new select_send()))
|
||||||
return 1;
|
return 1;
|
||||||
|
delete thd->protocol;
|
||||||
thd->protocol= save_protocol;
|
thd->protocol= save_protocol;
|
||||||
thd->lex->explain->send_explain(thd);
|
thd->lex->explain->send_explain(thd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue