mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge of WL#1469 with latest bk version.
BitKeeper/etc/logging_ok: auto-union
This commit is contained in:
@ -388,8 +388,8 @@ SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
|
||||
email shipcode
|
||||
test1@testdomain.com Z001
|
||||
test2@testdomain.com Z001
|
||||
test3@testdomain.com Z001
|
||||
test2@testdomain.com R002
|
||||
test3@testdomain.com Z001
|
||||
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
|
||||
email
|
||||
test1@testdomain.com
|
||||
|
@ -183,12 +183,12 @@ insert into t2 values('BBB', 20, 1.0);
|
||||
select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
|
||||
a1 a2 a1 a2
|
||||
10 aaa AAA 10
|
||||
10 NULL AAA 10
|
||||
10 bbb AAA 10
|
||||
20 zzz AAA 10
|
||||
10 aaa BBB 20
|
||||
10 NULL AAA 10
|
||||
10 NULL BBB 20
|
||||
10 bbb AAA 10
|
||||
10 bbb BBB 20
|
||||
20 zzz AAA 10
|
||||
20 zzz BBB 20
|
||||
select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
|
||||
max(t1.a1) max(t2.a1)
|
||||
@ -551,7 +551,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
explain
|
||||
select min(a1) from t1 where a1 between a3 and 'KKK';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 14 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where
|
||||
explain
|
||||
select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
657
mysql-test/r/greedy_optimizer.result
Normal file
657
mysql-test/r/greedy_optimizer.result
Normal file
@ -0,0 +1,657 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7;
|
||||
create table t1 (
|
||||
c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
|
||||
primary key (c11)
|
||||
);
|
||||
create table t2 (
|
||||
c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer,
|
||||
);
|
||||
create table t3 (
|
||||
c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
|
||||
primary key (c31)
|
||||
);
|
||||
create table t4 (
|
||||
c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
|
||||
);
|
||||
create table t5 (
|
||||
c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
|
||||
primary key (c51)
|
||||
);
|
||||
create table t6 (
|
||||
c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
|
||||
);
|
||||
create table t7 (
|
||||
c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
|
||||
primary key (c71)
|
||||
);
|
||||
insert into t1 values (1,2,3,4,5,6);
|
||||
insert into t1 values (2,2,3,4,5,6);
|
||||
insert into t1 values (3,2,3,4,5,6);
|
||||
insert into t2 values (1,2,3,4,5,6);
|
||||
insert into t2 values (2,2,3,4,5,6);
|
||||
insert into t2 values (3,2,3,4,5,6);
|
||||
insert into t2 values (4,2,3,4,5,6);
|
||||
insert into t2 values (5,2,3,4,5,6);
|
||||
insert into t2 values (6,2,3,4,5,6);
|
||||
insert into t3 values (1,2,3,4,5,6);
|
||||
insert into t3 values (2,2,3,4,5,6);
|
||||
insert into t3 values (3,2,3,4,5,6);
|
||||
insert into t3 values (4,2,3,4,5,6);
|
||||
insert into t3 values (5,2,3,4,5,6);
|
||||
insert into t3 values (6,2,3,4,5,6);
|
||||
insert into t3 values (7,2,3,4,5,6);
|
||||
insert into t3 values (8,2,3,4,5,6);
|
||||
insert into t3 values (9,2,3,4,5,6);
|
||||
insert into t4 values (1,2,3,4,5,6);
|
||||
insert into t4 values (2,2,3,4,5,6);
|
||||
insert into t4 values (3,2,3,4,5,6);
|
||||
insert into t4 values (4,2,3,4,5,6);
|
||||
insert into t4 values (5,2,3,4,5,6);
|
||||
insert into t4 values (6,2,3,4,5,6);
|
||||
insert into t4 values (7,2,3,4,5,6);
|
||||
insert into t4 values (8,2,3,4,5,6);
|
||||
insert into t4 values (9,2,3,4,5,6);
|
||||
insert into t4 values (10,2,3,4,5,6);
|
||||
insert into t4 values (11,2,3,4,5,6);
|
||||
insert into t4 values (12,2,3,4,5,6);
|
||||
insert into t5 values (1,2,3,4,5,6);
|
||||
insert into t5 values (2,2,3,4,5,6);
|
||||
insert into t5 values (3,2,3,4,5,6);
|
||||
insert into t5 values (4,2,3,4,5,6);
|
||||
insert into t5 values (5,2,3,4,5,6);
|
||||
insert into t5 values (6,2,3,4,5,6);
|
||||
insert into t5 values (7,2,3,4,5,6);
|
||||
insert into t5 values (8,2,3,4,5,6);
|
||||
insert into t5 values (9,2,3,4,5,6);
|
||||
insert into t5 values (10,2,3,4,5,6);
|
||||
insert into t5 values (11,2,3,4,5,6);
|
||||
insert into t5 values (12,2,3,4,5,6);
|
||||
insert into t5 values (13,2,3,4,5,6);
|
||||
insert into t5 values (14,2,3,4,5,6);
|
||||
insert into t5 values (15,2,3,4,5,6);
|
||||
insert into t6 values (1,2,3,4,5,6);
|
||||
insert into t6 values (2,2,3,4,5,6);
|
||||
insert into t6 values (3,2,3,4,5,6);
|
||||
insert into t6 values (4,2,3,4,5,6);
|
||||
insert into t6 values (5,2,3,4,5,6);
|
||||
insert into t6 values (6,2,3,4,5,6);
|
||||
insert into t6 values (7,2,3,4,5,6);
|
||||
insert into t6 values (8,2,3,4,5,6);
|
||||
insert into t6 values (9,2,3,4,5,6);
|
||||
insert into t6 values (10,2,3,4,5,6);
|
||||
insert into t6 values (11,2,3,4,5,6);
|
||||
insert into t6 values (12,2,3,4,5,6);
|
||||
insert into t6 values (13,2,3,4,5,6);
|
||||
insert into t6 values (14,2,3,4,5,6);
|
||||
insert into t6 values (15,2,3,4,5,6);
|
||||
insert into t6 values (16,2,3,4,5,6);
|
||||
insert into t6 values (17,2,3,4,5,6);
|
||||
insert into t6 values (18,2,3,4,5,6);
|
||||
insert into t7 values (1,2,3,4,5,6);
|
||||
insert into t7 values (2,2,3,4,5,6);
|
||||
insert into t7 values (3,2,3,4,5,6);
|
||||
insert into t7 values (4,2,3,4,5,6);
|
||||
insert into t7 values (5,2,3,4,5,6);
|
||||
insert into t7 values (6,2,3,4,5,6);
|
||||
insert into t7 values (7,2,3,4,5,6);
|
||||
insert into t7 values (8,2,3,4,5,6);
|
||||
insert into t7 values (9,2,3,4,5,6);
|
||||
insert into t7 values (10,2,3,4,5,6);
|
||||
insert into t7 values (11,2,3,4,5,6);
|
||||
insert into t7 values (12,2,3,4,5,6);
|
||||
insert into t7 values (13,2,3,4,5,6);
|
||||
insert into t7 values (14,2,3,4,5,6);
|
||||
insert into t7 values (15,2,3,4,5,6);
|
||||
insert into t7 values (16,2,3,4,5,6);
|
||||
insert into t7 values (17,2,3,4,5,6);
|
||||
insert into t7 values (18,2,3,4,5,6);
|
||||
insert into t7 values (19,2,3,4,5,6);
|
||||
insert into t7 values (20,2,3,4,5,6);
|
||||
insert into t7 values (21,2,3,4,5,6);
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
62
|
||||
select @@heuristic;
|
||||
@@heuristic
|
||||
1
|
||||
set plan_search_depth=63;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
63
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
set heuristic=0;
|
||||
select @@heuristic;
|
||||
@@heuristic
|
||||
0
|
||||
set plan_search_depth=0;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
0
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
set plan_search_depth=1;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
1
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
set plan_search_depth=62;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
62
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 274.419727
|
||||
set heuristic=1;
|
||||
select @@heuristic;
|
||||
@@heuristic
|
||||
1
|
||||
set plan_search_depth=0;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
0
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
set plan_search_depth=1;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
1
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
set plan_search_depth=62;
|
||||
select @@plan_search_depth;
|
||||
@@plan_search_depth
|
||||
62
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 821.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
|
||||
show status like 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 794.838037
|
||||
drop table t1,t2,t3,t4,t5,t6,t7;
|
@ -1393,8 +1393,8 @@ companynr companynr
|
||||
41 40
|
||||
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
|
||||
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
|
||||
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
|
||||
fld1 companynr fld3 period
|
||||
038008 37 reporters 1008
|
||||
@ -2279,10 +2279,10 @@ a a a
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
|
||||
a a
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
|
||||
a a a
|
||||
1 1 1
|
||||
@ -2314,30 +2314,10 @@ left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
|
||||
1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
|
||||
1 SIMPLE t4 ALL id4 NULL NULL NULL 1
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
|
||||
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
id1 id2 id3 id4 id44
|
||||
1 1 NULL NULL NULL
|
||||
drop table t1,t2,t3,t4;
|
||||
create table t1(s varchar(10) not null);
|
||||
create table t2(s varchar(10) not null primary key);
|
||||
create table t3(s varchar(10) not null primary key);
|
||||
insert into t1 values ('one\t'), ('two\t');
|
||||
insert into t2 values ('one\r'), ('two\t');
|
||||
insert into t3 values ('one '), ('two\t');
|
||||
select * from t1 where s = 'one';
|
||||
s
|
||||
select * from t2 where s = 'one';
|
||||
s
|
||||
select * from t3 where s = 'one';
|
||||
s
|
||||
one
|
||||
select * from t1,t2 where t1.s = t2.s;
|
||||
s s
|
||||
two two
|
||||
select * from t2,t3 where t2.s = t3.s;
|
||||
s s
|
||||
two two
|
||||
drop table t1, t2, t3;
|
||||
|
@ -6,7 +6,7 @@ explain extended select (select 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1003 select high_priority 2 AS `(select 2)`
|
||||
SELECT (SELECT 1) UNION SELECT (SELECT 2);
|
||||
(SELECT 1)
|
||||
@ -17,8 +17,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1249 Select 4 was reduced during optimisation
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1248 Select 4 was reduced during optimisation
|
||||
Note 1003 select high_priority 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
|
||||
SELECT (SELECT (SELECT 0 UNION SELECT 0));
|
||||
(SELECT (SELECT 0 UNION SELECT 0))
|
||||
@ -29,7 +29,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1003 select high_priority (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
@ -46,8 +46,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select high_priority 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
@ -219,7 +219,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select high_priority test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
@ -307,8 +307,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1
|
||||
3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select high_priority (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
@ -326,7 +326,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1275 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select high_priority test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq) limit 1)
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column: 'a' in field list is ambiguous
|
||||
@ -715,7 +715,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
|
||||
id
|
||||
@ -727,8 +727,8 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
|
||||
Warnings:
|
||||
Note 1249 Select 3 was reduced during optimisation
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1248 Select 3 was reduced during optimisation
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
|
||||
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -860,8 +860,8 @@ explain extended select (select a+1) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1249 Select 2 was reduced during optimisation
|
||||
Note 1275 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1248 Select 2 was reduced during optimisation
|
||||
Note 1003 select high_priority (test.t1.a + 1) AS `(select a+1)` from test.t1
|
||||
select (select a+1) from t1;
|
||||
(select a+1)
|
||||
@ -978,7 +978,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
CREATE TABLE t1 (a int, KEY(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a=((SELECT 1));
|
||||
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1))' at line 1
|
||||
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
|
||||
HANDLER t1 CLOSE;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
@ -1049,12 +1049,12 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
|
||||
) ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'date' at row 1
|
||||
Warning 1265 Data truncated for column 'date' at row 2
|
||||
Warning 1264 Data truncated for column 'date' at row 1
|
||||
Warning 1264 Data truncated for column 'date' at row 2
|
||||
INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'date' at row 1
|
||||
Warning 1265 Data truncated for column 'date' at row 2
|
||||
Warning 1264 Data truncated for column 'date' at row 1
|
||||
Warning 1264 Data truncated for column 'date' at row 2
|
||||
INSERT INTO t3 VALUES (1,1);
|
||||
SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
|
||||
numeropost=topic);
|
||||
@ -1168,9 +1168,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a where isnull(1) having <is_not_null_test>(1) limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@ -1178,9 +1178,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a where isnull(1) having <is_not_null_test>(1) limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@ -1246,7 +1246,7 @@ insert into t1 values (1,0), (2,0), (3,0);
|
||||
insert into t2 values (1,1), (2,1), (3,1), (2,2);
|
||||
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
|
||||
Warnings:
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1241 Subquery returns more than 1 row
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
@ -1348,8 +1348,8 @@ a
|
||||
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1000 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
|
||||
insert into t1 values (3,31);
|
||||
@ -1577,16 +1577,6 @@ INSERT INTO t2 VALUES (100, 200, 'C');
|
||||
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
|
||||
COLC
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a int(1));
|
||||
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
|
||||
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
|
||||
(SELECT a)
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b decimal(13, 3));
|
||||
insert into t1 values (1, 0.123);
|
||||
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
|
||||
@ -1621,97 +1611,3 @@ id max_anno_dep PIPPO
|
||||
50 1990 0
|
||||
51 1990 NULL
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1), (2), (3);
|
||||
SET SQL_SELECT_LIMIT=1;
|
||||
select sum(a) from (select * from t1) as a;
|
||||
sum(a)
|
||||
6
|
||||
select 2 in (select * from t1);
|
||||
2 in (select * from t1)
|
||||
1
|
||||
SET SQL_SELECT_LIMIT=default;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int, b int, INDEX (a));
|
||||
INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
|
||||
SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
|
||||
a b
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
DROP TABLE t1;
|
||||
create table t1(val varchar(10));
|
||||
insert into t1 values ('aaa'), ('bbb'),('eee'),('mmm'),('ppp');
|
||||
select count(*) from t1 as w1 where w1.val in (select w2.val from t1 as w2 where w2.val like 'm%') and w1.val in (select w3.val from t1 as w3 where w3.val like 'e%');
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12');
|
||||
select * from t1 where id not in (select id from t1 where id < 8);
|
||||
id text
|
||||
8 text8
|
||||
9 text9
|
||||
10 text10
|
||||
11 text11
|
||||
12 text12
|
||||
select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
|
||||
id text
|
||||
8 text8
|
||||
9 text9
|
||||
10 text10
|
||||
11 text11
|
||||
12 text12
|
||||
explain extended select * from t1 where id not in (select id from t1 where id < 8);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where
|
||||
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
|
||||
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select high_priority test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null) limit 1))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
|
||||
id text id text id text
|
||||
1 text1 1 text1 1 text1
|
||||
2 text2 2 text2 2 text2
|
||||
3 text3 3 text3 3 text3
|
||||
4 text4 4 text4 4 text4
|
||||
5 text5 5 text5 5 text5
|
||||
6 text6 6 text6 6 text6
|
||||
7 text7 7 text7 7 text7
|
||||
8 text8 8 text8 8 text8
|
||||
9 text9 9 text9 9 text9
|
||||
10 text10 10 text10 10 text10
|
||||
11 text11 11 text1 11 text11
|
||||
12 text12 12 text2 12 text12
|
||||
1000 text1000 NULL NULL 1000 text1000
|
||||
1001 text1001 NULL NULL 1000 text1000
|
||||
explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE a ALL NULL NULL NULL NULL 14
|
||||
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
|
||||
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
|
||||
drop table t1,t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
explain select benchmark(1000, (select a from t1 where a=sha(rand())));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
|
||||
drop table t1;
|
||||
create table t1(id int);
|
||||
create table t2(id int);
|
||||
create table t3(flag int);
|
||||
select (select * from t3 where id not null) from t1, t2;
|
||||
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'null) from t1, t2' at line 1
|
||||
drop table t1,t2,t3;
|
||||
|
313
mysql-test/t/greedy_optimizer.test
Normal file
313
mysql-test/t/greedy_optimizer.test
Normal file
@ -0,0 +1,313 @@
|
||||
#
|
||||
# A simple test of the greedy query optimization algorithm and the switches that
|
||||
# control the optimizationprocess.
|
||||
#
|
||||
|
||||
#
|
||||
# Schema
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (
|
||||
c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
|
||||
primary key (c11)
|
||||
);
|
||||
create table t2 (
|
||||
c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer,
|
||||
);
|
||||
create table t3 (
|
||||
c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
|
||||
primary key (c31)
|
||||
);
|
||||
create table t4 (
|
||||
c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
|
||||
);
|
||||
create table t5 (
|
||||
c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
|
||||
primary key (c51)
|
||||
);
|
||||
create table t6 (
|
||||
c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
|
||||
);
|
||||
create table t7 (
|
||||
c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
|
||||
primary key (c71)
|
||||
);
|
||||
|
||||
#
|
||||
# Data
|
||||
# cardinality(Ti) = cardinality(T(i-1)) + 3
|
||||
#
|
||||
insert into t1 values (1,2,3,4,5,6);
|
||||
insert into t1 values (2,2,3,4,5,6);
|
||||
insert into t1 values (3,2,3,4,5,6);
|
||||
|
||||
insert into t2 values (1,2,3,4,5,6);
|
||||
insert into t2 values (2,2,3,4,5,6);
|
||||
insert into t2 values (3,2,3,4,5,6);
|
||||
insert into t2 values (4,2,3,4,5,6);
|
||||
insert into t2 values (5,2,3,4,5,6);
|
||||
insert into t2 values (6,2,3,4,5,6);
|
||||
|
||||
insert into t3 values (1,2,3,4,5,6);
|
||||
insert into t3 values (2,2,3,4,5,6);
|
||||
insert into t3 values (3,2,3,4,5,6);
|
||||
insert into t3 values (4,2,3,4,5,6);
|
||||
insert into t3 values (5,2,3,4,5,6);
|
||||
insert into t3 values (6,2,3,4,5,6);
|
||||
insert into t3 values (7,2,3,4,5,6);
|
||||
insert into t3 values (8,2,3,4,5,6);
|
||||
insert into t3 values (9,2,3,4,5,6);
|
||||
|
||||
insert into t4 values (1,2,3,4,5,6);
|
||||
insert into t4 values (2,2,3,4,5,6);
|
||||
insert into t4 values (3,2,3,4,5,6);
|
||||
insert into t4 values (4,2,3,4,5,6);
|
||||
insert into t4 values (5,2,3,4,5,6);
|
||||
insert into t4 values (6,2,3,4,5,6);
|
||||
insert into t4 values (7,2,3,4,5,6);
|
||||
insert into t4 values (8,2,3,4,5,6);
|
||||
insert into t4 values (9,2,3,4,5,6);
|
||||
insert into t4 values (10,2,3,4,5,6);
|
||||
insert into t4 values (11,2,3,4,5,6);
|
||||
insert into t4 values (12,2,3,4,5,6);
|
||||
|
||||
insert into t5 values (1,2,3,4,5,6);
|
||||
insert into t5 values (2,2,3,4,5,6);
|
||||
insert into t5 values (3,2,3,4,5,6);
|
||||
insert into t5 values (4,2,3,4,5,6);
|
||||
insert into t5 values (5,2,3,4,5,6);
|
||||
insert into t5 values (6,2,3,4,5,6);
|
||||
insert into t5 values (7,2,3,4,5,6);
|
||||
insert into t5 values (8,2,3,4,5,6);
|
||||
insert into t5 values (9,2,3,4,5,6);
|
||||
insert into t5 values (10,2,3,4,5,6);
|
||||
insert into t5 values (11,2,3,4,5,6);
|
||||
insert into t5 values (12,2,3,4,5,6);
|
||||
insert into t5 values (13,2,3,4,5,6);
|
||||
insert into t5 values (14,2,3,4,5,6);
|
||||
insert into t5 values (15,2,3,4,5,6);
|
||||
|
||||
insert into t6 values (1,2,3,4,5,6);
|
||||
insert into t6 values (2,2,3,4,5,6);
|
||||
insert into t6 values (3,2,3,4,5,6);
|
||||
insert into t6 values (4,2,3,4,5,6);
|
||||
insert into t6 values (5,2,3,4,5,6);
|
||||
insert into t6 values (6,2,3,4,5,6);
|
||||
insert into t6 values (7,2,3,4,5,6);
|
||||
insert into t6 values (8,2,3,4,5,6);
|
||||
insert into t6 values (9,2,3,4,5,6);
|
||||
insert into t6 values (10,2,3,4,5,6);
|
||||
insert into t6 values (11,2,3,4,5,6);
|
||||
insert into t6 values (12,2,3,4,5,6);
|
||||
insert into t6 values (13,2,3,4,5,6);
|
||||
insert into t6 values (14,2,3,4,5,6);
|
||||
insert into t6 values (15,2,3,4,5,6);
|
||||
insert into t6 values (16,2,3,4,5,6);
|
||||
insert into t6 values (17,2,3,4,5,6);
|
||||
insert into t6 values (18,2,3,4,5,6);
|
||||
|
||||
insert into t7 values (1,2,3,4,5,6);
|
||||
insert into t7 values (2,2,3,4,5,6);
|
||||
insert into t7 values (3,2,3,4,5,6);
|
||||
insert into t7 values (4,2,3,4,5,6);
|
||||
insert into t7 values (5,2,3,4,5,6);
|
||||
insert into t7 values (6,2,3,4,5,6);
|
||||
insert into t7 values (7,2,3,4,5,6);
|
||||
insert into t7 values (8,2,3,4,5,6);
|
||||
insert into t7 values (9,2,3,4,5,6);
|
||||
insert into t7 values (10,2,3,4,5,6);
|
||||
insert into t7 values (11,2,3,4,5,6);
|
||||
insert into t7 values (12,2,3,4,5,6);
|
||||
insert into t7 values (13,2,3,4,5,6);
|
||||
insert into t7 values (14,2,3,4,5,6);
|
||||
insert into t7 values (15,2,3,4,5,6);
|
||||
insert into t7 values (16,2,3,4,5,6);
|
||||
insert into t7 values (17,2,3,4,5,6);
|
||||
insert into t7 values (18,2,3,4,5,6);
|
||||
insert into t7 values (19,2,3,4,5,6);
|
||||
insert into t7 values (20,2,3,4,5,6);
|
||||
insert into t7 values (21,2,3,4,5,6);
|
||||
|
||||
#
|
||||
# The actual test begins here
|
||||
#
|
||||
|
||||
# Check the default values for the optimizer paramters
|
||||
|
||||
select @@plan_search_depth;
|
||||
select @@heuristic;
|
||||
|
||||
-- This value swithes back to the old implementation of 'find_best()'
|
||||
-- set plan_search_depth=63; - old (independent of the heuristic)
|
||||
--
|
||||
-- These are the values for the parameters that control the greedy optimizer
|
||||
-- (total 6 combinations - 3 for plan_search_depth, 2 for heuristic):
|
||||
--
|
||||
-- set plan_search_depth=0; - automatic
|
||||
-- set plan_search_depth=1; - min
|
||||
-- set plan_search_depth=62; - max (default)
|
||||
--
|
||||
-- set heuristic=0 - exhaustive;
|
||||
-- set heuristic=1 - heuristic; -- default
|
||||
|
||||
|
||||
#
|
||||
# Compile several queries with all combinations of the query
|
||||
# optimizer parameters. Each test query has two variants, where
|
||||
# in the second variant the tables in the FROM clause are in
|
||||
# inverse order to the tables in the first variant.
|
||||
# Due to pre-sorting of tables before compilation, there should
|
||||
# be no difference in the plans for each two such query variants.
|
||||
#
|
||||
|
||||
# First, for reference compile the test queries with the 'old' optimization
|
||||
# procedure 'find_best'. Notice that 'find_best' does not depend on the
|
||||
# choice of heuristic.
|
||||
|
||||
set plan_search_depth=63;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
|
||||
# Test the new optimization procedures
|
||||
|
||||
set heuristic=0;
|
||||
select @@heuristic;
|
||||
|
||||
set plan_search_depth=0;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
set plan_search_depth=1;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
set plan_search_depth=62;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
|
||||
set heuristic=1;
|
||||
select @@heuristic;
|
||||
|
||||
set plan_search_depth=0;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
set plan_search_depth=1;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
set plan_search_depth=62;
|
||||
select @@plan_search_depth;
|
||||
|
||||
-- 6-table join, chain
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, star
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
|
||||
show status like 'Last_query_cost';
|
||||
-- 6-table join, clique
|
||||
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
|
||||
show status like 'Last_query_cost';
|
||||
|
||||
drop table t1,t2,t3,t4,t5,t6,t7;
|
Reference in New Issue
Block a user