1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Test that SHOW EXPLAIN will print 'Distinct'.

This commit is contained in:
Sergey Petrunya
2012-06-21 22:15:13 +04:00
parent 6eb2ce5863
commit 45503698c1
2 changed files with 65 additions and 2 deletions

View File

@ -695,4 +695,37 @@ WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
a b
set debug_dbug='';
DROP TABLE t1, t2;
#
# Test that SHOW EXPLAIN will print 'Distinct'.
#
CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
INSERT INTO t3 VALUES (1,'1'),(2,'2');
create temporary table t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
select distinct t1.a from t1,t3 where t1.a=t3.a;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
Warnings:
Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a
a
1
2
set debug_dbug='';
drop table t1,t3,t4;
drop table t0;

View File

@ -692,11 +692,41 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug='';
DROP TABLE t1, t2;
--echo #
--echo # Test that SHOW EXPLAIN will print 'Distinct'.
--echo #
CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
INSERT INTO t3 VALUES (1,'1'),(2,'2');
create temporary table t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
--send
select distinct t1.a from t1,t3 where t1.a=t3.a;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug='';
drop table t1,t3,t4;
## TODO: Test this: have several SHOW EXPLAIN requests be queued up for a
## thread and served together.