mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 09:44:17 +01:00
MWL#90: Subqueries: Inside-out execution for non-semijoin materialized subqueries that are AND-parts of the WHERE
- Change "SUBQUERY#n" to "<subquery{n}>" in EXPLAIN output. We need to it to be lowercase so that EXPLAIN results do not differ in case between systems with case-sensitive and case-insensitive filesystems. - Remove garbage comments, add better comments.
This commit is contained in:
parent
52faa44966
commit
0cc3724697
15 changed files with 316 additions and 189 deletions
|
@ -2255,8 +2255,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL distinct_key NULL NULL NULL 8
|
||||
1 PRIMARY t1_outer ref a a 5 SUBQUERY#2.max(b) 2 Using index
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8
|
||||
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 Using index
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
|
||||
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||
|
|
|
@ -3418,7 +3418,7 @@ EXPLAIN
|
|||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
ALTER TABLE t1 ADD INDEX(a);
|
||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||
|
@ -3430,7 +3430,7 @@ EXPLAIN
|
|||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL a NULL NULL NULL 9
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
create table t1( f1 int,f2 int);
|
||||
|
@ -4325,17 +4325,17 @@ INSERT INTO t1 VALUES (1),(2);
|
|||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 PRIMARY SUBQUERY#2 const distinct_key distinct_key 4 const 1 100.00
|
||||
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`SUBQUERY#2`.`1` = 1)
|
||||
Note 1003 select 1 AS `1` from <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 PRIMARY SUBQUERY#2 const distinct_key distinct_key 4 const 1 100.00
|
||||
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`SUBQUERY#2`.`1` = 1)
|
||||
Note 1003 select 1 AS `1` from <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
|
|
|
@ -1017,7 +1017,7 @@ update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
|||
explain select t21.* from t21,t22 where t21.a = t22.a and
|
||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 8 Using temporary; Using filesort
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 8 Using temporary; Using filesort
|
||||
1 PRIMARY t21 ALL NULL NULL NULL NULL 26 Using where; Using join buffer
|
||||
1 PRIMARY t22 ALL NULL NULL NULL NULL 26 Using where; Using join buffer
|
||||
2 SUBQUERY t11 ALL NULL NULL NULL NULL 8 Using where
|
||||
|
@ -1035,7 +1035,7 @@ select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) a
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY X ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY Y ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY SUBQUERY#3 eq_ref unique_key unique_key 5 func 1
|
||||
2 DEPENDENT SUBQUERY <subquery3> eq_ref unique_key unique_key 5 func 1
|
||||
3 SUBQUERY Z ALL NULL NULL NULL NULL 2
|
||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||
subq
|
||||
|
@ -1158,7 +1158,7 @@ create table t3 ( a int , filler char(100), key(a));
|
|||
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
||||
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
select * from t3 where a in (select a from t2);
|
||||
|
@ -1207,25 +1207,25 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t1 A, t1 B, t1 C
|
|||
explain select * from t1, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30) and t1.a =3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 10
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
|
||||
explain select straight_join * from t1 A, t1 B where A.a in (select a from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY A ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.A.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.A.a 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10
|
||||
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
explain select straight_join * from t2 X, t2 Y
|
||||
|
@ -1233,7 +1233,7 @@ where X.a in (select straight_join A.a from t1 A, t1 B);
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY X ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.X.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.X.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
create table t0 (a int, b int);
|
||||
|
@ -1241,14 +1241,14 @@ insert into t0 values(1,1);
|
|||
explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t0 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 10
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
|
||||
create table t4 as select a as x, a as y from t1;
|
||||
explain select * from t0, t3 where (t3.a, t3.b) in (select x,y from t4) and (t3.a < 10 or t3.a >30);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t0 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t4.x 10 Using where
|
||||
2 SUBQUERY t4 ALL NULL NULL NULL NULL 10 Using where
|
||||
drop table t0,t1,t2,t3,t4;
|
||||
|
@ -1274,14 +1274,14 @@ set @@optimizer_switch='firstmatch=off';
|
|||
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 10 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 10 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
|
||||
set @save_optimizer_search_depth=@@optimizer_search_depth;
|
||||
set @@optimizer_search_depth=63;
|
||||
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 10 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 10 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
|
||||
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
||||
set @@optimizer_switch=default;
|
||||
|
@ -1320,7 +1320,7 @@ insert into t2 select * from t2;
|
|||
explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y, t2 Z where X.b=33);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 15 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 15 func 1
|
||||
2 SUBQUERY X ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY Y ALL NULL NULL NULL NULL 6 Using join buffer
|
||||
2 SUBQUERY Z ALL NULL NULL NULL NULL 6 Using join buffer
|
||||
|
@ -1393,7 +1393,7 @@ INNER JOIN t2 c ON c.idContact=cona.idContact
|
|||
WHERE cona.postalStripped='T2H3B2'
|
||||
);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2 1.00
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2 1.00
|
||||
1 PRIMARY a index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer
|
||||
2 SUBQUERY cona ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00
|
||||
|
|
|
@ -1021,7 +1021,7 @@ update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
|||
explain select t21.* from t21,t22 where t21.a = t22.a and
|
||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 8 Using temporary; Using filesort
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 8 Using temporary; Using filesort
|
||||
1 PRIMARY t21 ALL NULL NULL NULL NULL 26 Using where; Using join buffer
|
||||
1 PRIMARY t22 ALL NULL NULL NULL NULL 26 Using where; Using join buffer
|
||||
2 SUBQUERY t11 ALL NULL NULL NULL NULL 8 Using where
|
||||
|
@ -1040,7 +1040,7 @@ select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) a
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY X ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY Y ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY SUBQUERY#3 eq_ref unique_key unique_key 5 func 1
|
||||
2 DEPENDENT SUBQUERY <subquery3> eq_ref unique_key unique_key 5 func 1
|
||||
3 SUBQUERY Z ALL NULL NULL NULL NULL 2
|
||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||
subq
|
||||
|
@ -1163,7 +1163,7 @@ create table t3 ( a int , filler char(100), key(a));
|
|||
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
||||
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 1 Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
select * from t3 where a in (select a from t2);
|
||||
|
@ -1212,25 +1212,25 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t1 A, t1 B, t1 C
|
|||
explain select * from t1, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30) and t1.a =3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 10 Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
|
||||
explain select straight_join * from t1 A, t1 B where A.a in (select a from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY A ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.A.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.A.a 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10
|
||||
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.t2.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
explain select straight_join * from t2 X, t2 Y
|
||||
|
@ -1238,7 +1238,7 @@ where X.a in (select straight_join A.a from t1 A, t1 B);
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY X ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 5 test.X.a 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 test.X.a 1
|
||||
2 SUBQUERY A ALL NULL NULL NULL NULL 10
|
||||
2 SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer
|
||||
create table t0 (a int, b int);
|
||||
|
@ -1246,14 +1246,14 @@ insert into t0 values(1,1);
|
|||
explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t0 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t2.a 10 Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
|
||||
create table t4 as select a as x, a as y from t1;
|
||||
explain select * from t0, t3 where (t3.a, t3.b) in (select x,y from t4) and (t3.a < 10 or t3.a >30);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t0 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref a a 5 test.t4.x 10 Using where; Using join buffer
|
||||
2 SUBQUERY t4 ALL NULL NULL NULL NULL 10 Using where
|
||||
drop table t0,t1,t2,t3,t4;
|
||||
|
@ -1279,14 +1279,14 @@ set @@optimizer_switch='firstmatch=off';
|
|||
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 10 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 10 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
|
||||
set @save_optimizer_search_depth=@@optimizer_search_depth;
|
||||
set @@optimizer_search_depth=63;
|
||||
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 10 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 10 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
|
||||
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
||||
set @@optimizer_switch=default;
|
||||
|
@ -1325,7 +1325,7 @@ insert into t2 select * from t2;
|
|||
explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y, t2 Z where X.b=33);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 15 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 15 func 1
|
||||
2 SUBQUERY X ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY Y ALL NULL NULL NULL NULL 6 Using join buffer
|
||||
2 SUBQUERY Z ALL NULL NULL NULL NULL 6 Using join buffer
|
||||
|
@ -1398,7 +1398,7 @@ INNER JOIN t2 c ON c.idContact=cona.idContact
|
|||
WHERE cona.postalStripped='T2H3B2'
|
||||
);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2 1.00
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2 1.00
|
||||
1 PRIMARY a index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer
|
||||
2 SUBQUERY cona ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using join buffer
|
||||
|
|
|
@ -216,7 +216,7 @@ FROM t2
|
|||
WHERE PTYPE = 'Design'));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
|
||||
|
@ -231,13 +231,13 @@ WHERE EMPNUM IN
|
|||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 SIMPLE SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 SIMPLE <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
@ -254,7 +254,7 @@ FROM t2
|
|||
WHERE PTYPE = 'Design'));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
|
||||
|
@ -269,13 +269,13 @@ WHERE EMPNUM IN
|
|||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
|
||||
1 SIMPLE SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 SIMPLE <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
@ -291,7 +291,7 @@ FROM t2
|
|||
WHERE PTYPE = 'Design'));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
|
||||
|
@ -306,13 +306,13 @@ WHERE EMPNUM IN
|
|||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 SIMPLE <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
|
|
@ -42,7 +42,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`)))))
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -53,7 +53,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`)))))
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -64,7 +64,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -75,7 +75,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`min(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -86,7 +86,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index it2i1,it2i3 it2i1 9 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`)))))
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -97,7 +97,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL # 18 # 3 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # 9 # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`)))))
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -108,7 +108,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index it2i1,it2i3 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -119,7 +119,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL # # # 3 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # # # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -130,7 +130,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL # # # 3 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # # # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#2`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`min(b2)`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -141,7 +141,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,max(`test`.`t2i`.`b2`) AS `max(b2)` from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`max(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,max(`test`.`t2i`.`b2`) AS `max(b2)` from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`max(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -170,7 +170,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`min(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -211,7 +211,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -222,7 +222,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index NULL it2i3 18 NULL 5 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -277,7 +277,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
4 SUBQUERY t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#4`.`b1`) and (`test`.`t3`.`c2` = `SUBQUERY#4`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#3`.`c1`) and (`test`.`t1`.`a2` = `SUBQUERY#3`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery4>`.`b1`) and (`test`.`t3`.`c2` = `<subquery4>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery3>`.`c1`) and (`test`.`t1`.`a2` = `<subquery3>`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
|
||||
(a1, a2) in (select c1, c2 from t3
|
||||
|
@ -296,7 +296,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
4 SUBQUERY t2i index it2i2 # # # 5 100.00 #
|
||||
2 SUBQUERY t2i index it2i1,it2i3 # # # 5 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#2`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `SUBQUERY#4`.`b1`) and (`test`.`t3i`.`c2` = `SUBQUERY#4`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#3`.`c1`) and (`test`.`t1i`.`a2` = `SUBQUERY#3`.`c2`))))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `<subquery4>`.`b1`) and (`test`.`t3i`.`c2` = `<subquery4>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery3>`.`c1`) and (`test`.`t1i`.`a2` = `<subquery3>`.`c2`))))))
|
||||
select * from t1i
|
||||
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
|
||||
(a1, a2) in (select c1, c2 from t3i
|
||||
|
@ -319,7 +319,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#3`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#6`.`b1`) and (`test`.`t3`.`c2` = `SUBQUERY#6`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#5`.`c1`) and (`test`.`t1`.`a2` = `SUBQUERY#5`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3`.`c2` = `<subquery6>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
|
@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where <in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where ((`test`.`t3c`.`c1` = `SUBQUERY#6`.`b1`) and (`test`.`t3c`.`c2` = `SUBQUERY#6`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#5`.`c1`) and (`test`.`t1`.`a2` = `SUBQUERY#5`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where <in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where ((`test`.`t3c`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3c`.`c2` = `<subquery6>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 t3a where c1 = a1) or
|
||||
|
@ -380,7 +380,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
8 SUBQUERY t2i index it2i1,it2i3 # # # 5 100.00 #
|
||||
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#3`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#6`.`b1`) and (`test`.`t3`.`c2` = `SUBQUERY#6`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#5`.`c1`) and (`test`.`t1`.`a2` = `SUBQUERY#5`.`c2`))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#8`.`b1`) and (`test`.`t1i`.`a2` = `SUBQUERY#8`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `SUBQUERY#10`.`b1`) and (`test`.`t3i`.`c2` = `SUBQUERY#10`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `SUBQUERY#9`.`c1`) and (`test`.`t1i`.`a2` = `SUBQUERY#9`.`c2`)))))))
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3`.`c2` = `<subquery6>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery8>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery8>`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `<subquery10>`.`b1`) and (`test`.`t3i`.`c2` = `<subquery10>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery9>`.`c1`) and (`test`.`t1i`.`a2` = `<subquery9>`.`c2`)))))))
|
||||
(select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
|
@ -409,7 +409,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#5`.`b1`) and (`test`.`t3`.`c2` = `SUBQUERY#5`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `SUBQUERY#4`.`c1`) and (`test`.`t1`.`a2` = `SUBQUERY#4`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery5>`.`b1`) and (`test`.`t3`.`c2` = `<subquery5>`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery4>`.`c1`) and (`test`.`t1`.`a2` = `<subquery4>`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
|
||||
(a1, a2) in (select c1, c2 from t3
|
||||
|
@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#5`.`b1`) and (`test`.`t3`.`c2` = `SUBQUERY#5`.`b2`))))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `SUBQUERY#4`.`c1`) and (`test`.`t3`.`c2` = `SUBQUERY#4`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery5>`.`b1`) and (`test`.`t3`.`c2` = `<subquery5>`.`b2`))))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery4>`.`c1`) and (`test`.`t3`.`c2` = `<subquery4>`.`c2`))))))
|
||||
select * from t1, t3
|
||||
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
|
||||
(c1, c2) in (select c1, c2 from t3
|
||||
|
@ -478,7 +478,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where (<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where (<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))
|
||||
explain extended
|
||||
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
@ -612,7 +612,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) AS `substring(b1,1,16)` from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `SUBQUERY#2`.`substring(b1,1,16)`)))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) AS `substring(b1,1,16)` from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `<subquery2>`.`substring(b1,1,16)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
|
||||
|
@ -641,7 +641,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select group_concat(b1) from t2_16 group by b2);
|
||||
|
@ -663,7 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select 1 AS `Not_used` from `test`.`t1_16` where (<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` AS `c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where ((`test`.`t2`.`b1` = `SUBQUERY#4`.`c1`))))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))) and (<cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select 1 AS `Not_used` from `test`.`t1_16` where (<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` AS `c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where ((`test`.`t2`.`b1` = `<subquery4>`.`c1`))))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))) and (<cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))))
|
||||
drop table t1_16, t2_16, t3_16;
|
||||
set @blob_len = 512;
|
||||
set @suffix_len = @blob_len - @prefix_len;
|
||||
|
@ -725,7 +725,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) AS `substring(b1,1,512)` from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `SUBQUERY#2`.`substring(b1,1,512)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) AS `substring(b1,1,512)` from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`substring(b1,1,512)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
|
||||
|
@ -739,7 +739,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
|
@ -752,7 +752,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
|
@ -832,7 +832,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
|
@ -845,7 +845,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
|
@ -925,7 +925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
|
@ -938,7 +938,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
|
@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2bit ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1` AS `b1`,`test`.`t2bit`.`b2` AS `b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where ((`test`.`t1bit`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t1bit`.`a2` = `SUBQUERY#2`.`b2`)))))
|
||||
Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1` AS `b1`,`test`.`t2bit`.`b2` AS `b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where ((`test`.`t1bit`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1bit`.`a2` = `<subquery2>`.`b2`)))))
|
||||
select bin(a1), bin(a2)
|
||||
from t1bit
|
||||
where (a1, a2) in (select b1, b2 from t2bit);
|
||||
|
@ -1030,7 +1030,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1044,7 +1044,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1058,7 +1058,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1071,7 +1071,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1083,7 +1083,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1200,7 +1200,7 @@ set @save_optimizer_switch=@@optimizer_switch;
|
|||
SET @@optimizer_switch='default,semijoin=on,materialization=on';
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
|
||||
|
@ -1224,7 +1224,7 @@ SET @@optimizer_switch='default,semijoin=on,materialization=on';
|
|||
EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using MRR
|
||||
SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
||||
pk
|
||||
|
|
|
@ -1302,7 +1302,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
2
|
||||
|
@ -1312,7 +1312,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
a
|
||||
2
|
||||
|
@ -1323,7 +1323,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 SUBQUERY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
|
@ -1345,7 +1345,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
2
|
||||
|
@ -1355,7 +1355,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
a
|
||||
2
|
||||
|
@ -1366,7 +1366,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 SUBQUERY t3 index a a 5 NULL 3 100.00 Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using where; Using index; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
|
@ -1382,7 +1382,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10005 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `SUBQUERY#2`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`)))))
|
||||
drop table t0, t1, t2, t3;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
|
@ -2836,7 +2836,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `SUBQUERY#2`.`one`) and (`test`.`t1`.`two` = `SUBQUERY#2`.`two`)))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`)))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
|
@ -4329,13 +4329,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `SUBQUERY#2`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`1`)))))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `SUBQUERY#2`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`1`)))))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
|
|
|
@ -848,7 +848,7 @@ INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','f
|
|||
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 13 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 13 func 1 1.00
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using MRR
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
|
||||
|
@ -1017,7 +1017,7 @@ FROM t1
|
|||
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 8 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 8 func 1 1.00
|
||||
2 SUBQUERY t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_nokey` < 'n') xor `test`.`t1`.`pk`))
|
||||
|
|
|
@ -32,7 +32,7 @@ a b
|
|||
9 5
|
||||
explain select * from t2 where b in (select a from t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 3
|
||||
1 PRIMARY t2 ref b b 5 test.t1.a 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3
|
||||
select * from t2 where b in (select a from t1);
|
||||
|
@ -74,7 +74,7 @@ A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
|
|||
from t0 A, t0 B where B.a <5;
|
||||
explain select * from t3 where b in (select a from t0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref b b 5 test.t0.a 1
|
||||
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10
|
||||
set @save_ecp= @@engine_condition_pushdown;
|
||||
|
@ -101,7 +101,7 @@ set max_heap_table_size= @save_max_heap_table_size;
|
|||
explain select * from t1 where a in (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t2 index b b 5 NULL 10 Using index
|
||||
select * from t1;
|
||||
a b
|
||||
|
@ -129,7 +129,7 @@ explain select
|
|||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||
from t1 ot where a in (select a from t2 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 32 Using where; Using join buffer
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||
select
|
||||
|
@ -163,7 +163,7 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||
from t2 ot where a in (select a from t1 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 32
|
||||
select
|
||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||
|
@ -197,7 +197,7 @@ explain select
|
|||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||
from t1 ot where a in (select a from t2 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 52 Using where; Using join buffer
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||
select
|
||||
|
@ -231,7 +231,7 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||
from t2 ot where a in (select a from t1 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 52
|
||||
select
|
||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||
|
@ -348,7 +348,7 @@ WHERE t1.Code IN (
|
|||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL CountryCode NULL NULL NULL 545 Using where
|
||||
SELECT Name FROM t1
|
||||
WHERE t1.Code IN (
|
||||
|
@ -696,7 +696,7 @@ The following must use loose index scan over t3, key a:
|
|||
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index a a 5 NULL 1000 Using index
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t3 index a a 5 NULL 30000 Using index
|
||||
select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||
count(a)
|
||||
|
|
|
@ -36,7 +36,7 @@ a b
|
|||
9 5
|
||||
explain select * from t2 where b in (select a from t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 3
|
||||
1 PRIMARY t2 ref b b 5 test.t1.a 2 Using join buffer
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3
|
||||
select * from t2 where b in (select a from t1);
|
||||
|
@ -78,7 +78,7 @@ A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
|
|||
from t0 A, t0 B where B.a <5;
|
||||
explain select * from t3 where b in (select a from t0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 10
|
||||
1 PRIMARY t3 ref b b 5 test.t0.a 1 Using join buffer
|
||||
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10
|
||||
set @save_ecp= @@engine_condition_pushdown;
|
||||
|
@ -105,7 +105,7 @@ set max_heap_table_size= @save_max_heap_table_size;
|
|||
explain select * from t1 where a in (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t2 index b b 5 NULL 10 Using index
|
||||
select * from t1;
|
||||
a b
|
||||
|
@ -133,7 +133,7 @@ explain select
|
|||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||
from t1 ot where a in (select a from t2 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 32 Using where; Using join buffer
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||
select
|
||||
|
@ -167,7 +167,7 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||
from t2 ot where a in (select a from t1 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 32
|
||||
select
|
||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||
|
@ -201,7 +201,7 @@ explain select
|
|||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||
from t1 ot where a in (select a from t2 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 22
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 52 Using where; Using join buffer
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||
select
|
||||
|
@ -235,7 +235,7 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||
from t2 ot where a in (select a from t1 it);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY it ALL NULL NULL NULL NULL 52
|
||||
select
|
||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||
|
@ -352,7 +352,7 @@ WHERE t1.Code IN (
|
|||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t2 ALL CountryCode NULL NULL NULL 545 Using where
|
||||
SELECT Name FROM t1
|
||||
WHERE t1.Code IN (
|
||||
|
@ -702,7 +702,7 @@ The following must use loose index scan over t3, key a:
|
|||
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index a a 5 NULL 1000 Using index
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t3 index a a 5 NULL 30000 Using index
|
||||
select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||
count(a)
|
||||
|
|
|
@ -852,7 +852,7 @@ INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','f
|
|||
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 13 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 13 func 1 1.00
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using MRR
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
|
||||
|
@ -1021,7 +1021,7 @@ FROM t1
|
|||
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 8 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 8 func 1 1.00
|
||||
2 SUBQUERY t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_nokey` < 'n') xor `test`.`t1`.`pk`))
|
||||
|
|
|
@ -39,7 +39,7 @@ explain extended
|
|||
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 9 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 9 func 1 1.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0'))
|
||||
|
@ -51,10 +51,10 @@ explain extended
|
|||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 9 test.t1.a1 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 9 test.t1.a1 1 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`)
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where (`<subquery2>`.`b1` = `test`.`t1`.`a1`)
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -63,10 +63,10 @@ explain extended
|
|||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`SUBQUERY#2`.`b2` = `test`.`t1`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b2` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -75,10 +75,10 @@ explain extended
|
|||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`SUBQUERY#2`.`min(b2)` = `test`.`t1`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -97,11 +97,11 @@ a1 a2
|
|||
explain extended
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL distinct_key # NULL # 3 100.00 #
|
||||
1 PRIMARY <subquery2> ALL distinct_key # NULL # 3 100.00 #
|
||||
1 PRIMARY t1i ref it1i1,it1i3 # 9 # 1 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # 9 # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (`test`.`t1i`.`a1` = `SUBQUERY#2`.`b1`)
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (`test`.`t1i`.`a1` = `<subquery2>`.`b1`)
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -121,10 +121,10 @@ explain extended
|
|||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 #
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key # # # 1 100.00 #
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # # # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`SUBQUERY#2`.`b2` = `test`.`t1i`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1i`.`a1`))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b2` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -133,10 +133,10 @@ explain extended
|
|||
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 #
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key # # # 1 100.00 #
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
|
||||
2 SUBQUERY t2i range it2i1,it2i3 # # # 3 100.00 #
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`SUBQUERY#2`.`min(b2)` = `test`.`t1i`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1i`.`a1`))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
|
||||
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -145,10 +145,10 @@ explain extended
|
|||
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
2 SUBQUERY t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,max(`test`.`t2i`.`b2`) AS `max(b2)` from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`SUBQUERY#2`.`max(b2)` = `test`.`t1`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,max(`test`.`t2i`.`b2`) AS `max(b2)` from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
|
||||
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -157,12 +157,12 @@ prepare st1 from "explain select * from t1 where (a1, a2) in (select b1, max(b2)
|
|||
execute st1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1
|
||||
2 SUBQUERY t2i range NULL it2i3 9 NULL 3 Using index for group-by
|
||||
execute st1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1
|
||||
2 SUBQUERY t2i range NULL it2i3 9 NULL 3 Using index for group-by
|
||||
prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1)";
|
||||
execute st2;
|
||||
|
@ -177,10 +177,10 @@ explain extended
|
|||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`SUBQUERY#2`.`min(b2)` = `test`.`t1`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -219,10 +219,10 @@ explain extended
|
|||
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1.a1,test.t1.a2 1 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`SUBQUERY#2`.`b2` = `test`.`t1`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1`.`a1`))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b2` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -231,10 +231,10 @@ explain extended
|
|||
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index it1i1,it1i2,it1i3 it1i3 18 NULL 3 100.00 Using index
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 18 test.t1i.a1,test.t1i.a2 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 18 test.t1i.a1,test.t1i.a2 1 100.00
|
||||
2 SUBQUERY t2i index NULL it2i3 18 NULL 5 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`SUBQUERY#2`.`b2` = `test`.`t1i`.`a2`) and (`SUBQUERY#2`.`b1` = `test`.`t1i`.`a1`))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b2` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
|
@ -285,8 +285,8 @@ where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
|
|||
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY SUBQUERY#3 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery3> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
3 SUBQUERY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer
|
||||
|
@ -306,8 +306,8 @@ where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
|
|||
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 #
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key # # # 1 1.00 #
|
||||
1 PRIMARY SUBQUERY#3 eq_ref unique_key # # # 1 1.00 #
|
||||
1 PRIMARY <subquery2> eq_ref unique_key # # # 1 1.00 #
|
||||
1 PRIMARY <subquery3> eq_ref unique_key # # # 1 1.00 #
|
||||
2 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 #
|
||||
3 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 #
|
||||
3 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 #
|
||||
|
@ -329,15 +329,15 @@ b2 in (select c2 from t3 where c2 LIKE '%03')) and
|
|||
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY SUBQUERY#5 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery5> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
5 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
5 SUBQUERY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#3`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) and (`test`.`t3`.`c2` > '0'))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) and (`test`.`t3`.`c2` > '0'))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
|
@ -356,14 +356,14 @@ where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Start temporary
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer
|
||||
1 PRIMARY SUBQUERY#5 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery5> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
5 SUBQUERY t3c ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
5 SUBQUERY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer
|
||||
4 SUBQUERY t3b ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) and (`test`.`t3c`.`c2` > '0'))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) and (`test`.`t3c`.`c2` > '0'))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 t3a where c1 = a1) or
|
||||
|
@ -387,7 +387,7 @@ where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
|
|||
(a1, a2) in (select c1, c2 from t3i
|
||||
where (c1, c2) in (select b1, b2 from t2i where b2 > '0')));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL distinct_key # # # 5 0.00 #
|
||||
1 PRIMARY <subquery2> ALL distinct_key # # # 5 0.00 #
|
||||
1 PRIMARY t3 ALL NULL # # # 4 100.00 #
|
||||
1 PRIMARY t1 ALL NULL # # # 3 100.00 #
|
||||
1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
|
||||
|
@ -395,14 +395,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
4 SUBQUERY t3 ALL NULL # # # 4 100.00 #
|
||||
3 SUBQUERY t3 ALL NULL # # # 4 100.00 #
|
||||
7 UNION t1i index it1i1,it1i2,it1i3 # # # 3 100.00 #
|
||||
7 UNION SUBQUERY#8 eq_ref unique_key # # # 1 1.00 #
|
||||
7 UNION SUBQUERY#9 eq_ref unique_key # # # 1 1.00 #
|
||||
7 UNION <subquery8> eq_ref unique_key # # # 1 1.00 #
|
||||
7 UNION <subquery9> eq_ref unique_key # # # 1 1.00 #
|
||||
8 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 #
|
||||
9 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 #
|
||||
9 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 #
|
||||
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#3`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t1` where ((`test`.`t3`.`c2` = `SUBQUERY#2`.`b2`) and (`test`.`t1`.`a2` = `SUBQUERY#2`.`b2`) and (`test`.`t2i`.`b2` = `SUBQUERY#2`.`b2`) and (`test`.`t3`.`c1` = `SUBQUERY#2`.`b1`) and (`test`.`t1`.`a1` = `SUBQUERY#2`.`b1`) and (`test`.`t2i`.`b1` = `SUBQUERY#2`.`b1`) and (`SUBQUERY#2`.`b2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')))
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t1` where ((`test`.`t3`.`c2` = `<subquery2>`.`b2`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`) and (`test`.`t2i`.`b2` = `<subquery2>`.`b2`) and (`test`.`t3`.`c1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t2i`.`b1` = `<subquery2>`.`b1`) and (`<subquery2>`.`b2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')))
|
||||
(select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
|
@ -425,7 +425,7 @@ where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where
|
|||
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
1 PRIMARY SUBQUERY#4 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery4> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
4 SUBQUERY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
|
@ -449,7 +449,7 @@ a1 = c1;
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer
|
||||
1 PRIMARY SUBQUERY#4 eq_ref unique_key unique_key 18 func 1 1.00
|
||||
1 PRIMARY <subquery4> eq_ref unique_key unique_key 18 func 1 1.00
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
4 SUBQUERY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
|
@ -502,7 +502,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `SUBQUERY#4`.`c2`)))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))))
|
||||
explain extended
|
||||
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
@ -634,7 +634,7 @@ from t1_16
|
|||
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 20 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 20 func 1 1.00
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` > '0') and (`test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16)))
|
||||
|
@ -664,10 +664,10 @@ from t1_16
|
|||
where a1 in (select group_concat(b1) from t2_16 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_16.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_16.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where (`test`.`t1_16`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where (`test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select group_concat(b1) from t2_16 group by b2);
|
||||
|
@ -749,7 +749,7 @@ from t1_512
|
|||
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 517 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 517 func 1 1.00
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` > '0') and (`test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512)))
|
||||
|
@ -764,10 +764,10 @@ from t1_512
|
|||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_512.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_512.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
|
@ -778,10 +778,10 @@ from t1_512
|
|||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_512.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_512.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
|
@ -845,7 +845,7 @@ from t1_1024
|
|||
where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 15 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 15 func 1 1.00
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` > '0') and (`test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024)))
|
||||
|
@ -858,10 +858,10 @@ from t1_1024
|
|||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_1024.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_1024.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
|
@ -872,10 +872,10 @@ from t1_1024
|
|||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_1024.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_1024.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
|
@ -939,7 +939,7 @@ from t1_1025
|
|||
where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 15 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 15 func 1 1.00
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` > '0') and (`test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025)))
|
||||
|
@ -952,10 +952,10 @@ from t1_1025
|
|||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_1025.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_1025.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
|
@ -966,10 +966,10 @@ from t1_1025
|
|||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref distinct_key distinct_key 261 test.t1_1025.a1 1 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 261 test.t1_1025.a1 1 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `SUBQUERY#2`.`group_concat(b1)`)
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
|
@ -988,7 +988,7 @@ from t1bit
|
|||
where (a1, a2) in (select b1, b2 from t2bit);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 10 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 10 func 1 1.00
|
||||
2 SUBQUERY t2bit ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` semi join (`test`.`t2bit`) where 1
|
||||
|
@ -1059,7 +1059,7 @@ insert into t3 values (30);
|
|||
explain extended
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 6 1.00
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 6 1.00
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
|
@ -1074,7 +1074,7 @@ create index it1a on t1(a);
|
|||
explain extended
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 6 1.00
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 6 1.00
|
||||
1 PRIMARY t1 ref it1a it1a 4 test.t2.c 2 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
|
@ -1090,7 +1090,7 @@ explain extended
|
|||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index it1a it1a 4 NULL 7 100.00 Using index
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 4 func 1 1.00
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 4 func 1 1.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` >= 20))
|
||||
|
@ -1106,7 +1106,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1118,7 +1118,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `SUBQUERY#2`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
|
@ -1174,7 +1174,7 @@ insert into t1 values (5);
|
|||
explain select min(a1) from t1 where 7 in (select b1 from t2 group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY SUBQUERY#2 const distinct_key distinct_key 5 const 1
|
||||
1 PRIMARY <subquery2> const distinct_key distinct_key 5 const 1
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2 group by b1);
|
||||
min(a1)
|
||||
|
@ -1217,7 +1217,7 @@ insert into t1 values ('aa', 'aaaa');
|
|||
explain select a,b from t1 where b in (select a from t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 3 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 3 func 1
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
select a,b from t1 where b in (select a from t1);
|
||||
a b
|
||||
|
@ -1238,7 +1238,7 @@ set @save_optimizer_switch=@@optimizer_switch;
|
|||
SET @@optimizer_switch='default,semijoin=on,materialization=on';
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY SUBQUERY#2 ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY <subquery2> ALL unique_key NULL NULL NULL 2
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
|
||||
|
@ -1262,7 +1262,7 @@ SET @@optimizer_switch='default,semijoin=on,materialization=on';
|
|||
EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY SUBQUERY#2 eq_ref unique_key unique_key 5 func 1
|
||||
1 PRIMARY <subquery2> eq_ref unique_key unique_key 5 func 1
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using MRR
|
||||
SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
||||
pk
|
||||
|
|
|
@ -3710,7 +3710,7 @@ bool subselect_hash_sj_engine::init_permanent(List<Item> *tmp_columns,
|
|||
}
|
||||
*/
|
||||
char buf[32];
|
||||
uint len= my_snprintf(buf, sizeof(buf), "SUBQUERY#%d", subquery_id);
|
||||
uint len= my_snprintf(buf, sizeof(buf), "<subquery%d>", subquery_id);
|
||||
char *name;
|
||||
if (!(name= (char*)thd->alloc(len + 1)))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
|
|
@ -16,6 +16,136 @@
|
|||
|
||||
#include <my_bit.h>
|
||||
|
||||
/*
|
||||
This file contains optimizations for semi-join subqueries.
|
||||
|
||||
Contents
|
||||
--------
|
||||
1. What is a semi-join subquery
|
||||
2. General idea about semi-join execution
|
||||
2.1 Correlated vs uncorrelated semi-joins
|
||||
2.2 Mergeable vs non-mergeable semi-joins
|
||||
3. Code-level view of semi-join processing
|
||||
3.1 Conversion
|
||||
3.1.1 Merged semi-join TABLE_LIST object
|
||||
3.1.2 Non-merged semi-join data structure
|
||||
3.2 Semi-joins and query optimization
|
||||
3.3 Semi-joins and query execution
|
||||
|
||||
1. What is a semi-join subquery
|
||||
-------------------------------
|
||||
We use this definition of semi-join:
|
||||
|
||||
outer_tbl SEMI JOIN inner_tbl ON cond = {set of outer_tbl.row such that
|
||||
exist inner_tbl.row, for which
|
||||
cond(outer_tbl.row,inner_tbl.row)
|
||||
is satisfied}
|
||||
|
||||
That is, semi-join operation is similar to inner join operation, with
|
||||
exception that we don't care how many matches a row from outer_tbl has in
|
||||
inner_tbl.
|
||||
|
||||
In SQL, that translates into following: a semi-join subquery is an IN
|
||||
subquery that is an AND-part of the WHERE/ON clause.
|
||||
|
||||
2. General idea about semi-join execution
|
||||
-----------------------------------------
|
||||
We can execute semi-join in a way similar to inner join, with exception that
|
||||
we need to somehow ensure that we do not generate record combinations that
|
||||
differ only in rows of inner tables.
|
||||
There is a number of different ways to achieve this property, implemented by
|
||||
a number of semi-join execution strategies.
|
||||
Some strategies can handle any semi-joins, other can be applied only to
|
||||
semi-joins that have certain properties that are described below:
|
||||
|
||||
2.1 Correlated vs uncorrelated semi-joins
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Uncorrelated semi-joins are special in the respect that they allow to
|
||||
- execute the subquery (possible as it's uncorrelated)
|
||||
- somehow make sure that generated set does not have duplicates
|
||||
- perform an inner join with outer tables.
|
||||
|
||||
or, rephrasing in SQL form:
|
||||
|
||||
SELECT ... FROM ot WHERE ot.col IN (SELECT it.col FROM it WHERE uncorr_cond)
|
||||
->
|
||||
SELECT ... FROM ot JOIN (SELECT DISTINCT it.col FROM it WHERE uncorr_cond)
|
||||
|
||||
2.2 Mergeable vs non-mergeable semi-joins
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Semi-join operation has some degree of commutability with inner join
|
||||
operation: we can join subquery's tables with ouside table(s) and eliminate
|
||||
duplicate record combination after that:
|
||||
|
||||
ot1 JOIN ot2 SEMI_JOIN{it1,it2} (it1 JOIN it2) ON sjcond(ot2,it*) ->
|
||||
|
|
||||
+-------------------------------+
|
||||
v
|
||||
ot1 SEMI_JOIN{it1,it2} (it1 JOIN it2 JOIN ot2) ON sjcond(ot2,it*)
|
||||
|
||||
In order for this to work, subquery's top-level operation must be join, and
|
||||
grouping or ordering with limit (grouping or ordering with limit are not
|
||||
commutative with duplicate removal). In other words, the conversion is
|
||||
possible when the subquery doesn't have GROUP BY clause, any aggregate
|
||||
functions*, or ORDER BY ... LIMIT clause.
|
||||
|
||||
Definitions:
|
||||
- Subquery whose top-level operation is a join is called *mergeable semi-join*
|
||||
- All other kinds of semi-join subqueries are considered non-mergeable.
|
||||
|
||||
*- this requirement is actually too strong, but its exceptions are too
|
||||
complicated to be considered here.
|
||||
|
||||
3. Code-level view of semi-join processing
|
||||
------------------------------------------
|
||||
|
||||
3.1 Conversion
|
||||
--------------
|
||||
* When doing JOIN::prepare for the subquery, we detect that it can be
|
||||
converted into a semi-join and register it in parent_join->sj_subselects
|
||||
|
||||
* At the start of parent_join->optimize(), the predicate is converted into
|
||||
a semi-join node. A semi-join node is a TABLE_LIST object that is linked
|
||||
somewhere in parent_join->join_list (either it is just present there, or
|
||||
it is a descendant of some of its members).
|
||||
|
||||
There are two kinds of semi-joins:
|
||||
- Merged semi-joins
|
||||
- Non-merged semi-joins
|
||||
|
||||
3.1.1 Merged semi-join TABLE_LIST object
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Merged semi-join object is a TABLE_LIST that contains a sub-join of
|
||||
subquery tables and the semi-join ON expression (in this respect it is
|
||||
ery similar to nested outer join representation)
|
||||
Merged semi-join represents this SQL:
|
||||
|
||||
... SEMI JOIN (inner_tbl1 JOIN ... JOIN inner_tbl_n) ON sj_on_expr
|
||||
|
||||
Semi-join objects of this kind have TABLE_LIST::sj_subq_pred set.
|
||||
|
||||
3.1.2 Non-merged semi-join data structure
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Non-merged semi-join object is a leaf TABLE_LIST object that has a subquery
|
||||
that produces rows. It is similar to a base table and represents this SQL:
|
||||
|
||||
... SEMI_JOIN (SELECT non_mergeable_select) ON sj_on_expr
|
||||
|
||||
Subquery items that were converted into semi-joins are removed from the WHERE
|
||||
clause. (They do remain in PS-saved WHERE clause, and they replace themselves
|
||||
with Item_int(1) on subsequent re-executions).
|
||||
|
||||
3.2 Semi-joins and query optimization
|
||||
-------------------------------------
|
||||
Query optimizer operates on semi-join nests.
|
||||
|
||||
3.3 Semi-joins and query execution
|
||||
----------------------------------
|
||||
* Join executor has hooks for all semi-join strategies.
|
||||
TODO elaborate
|
||||
*/
|
||||
|
||||
|
||||
static
|
||||
bool subquery_types_allow_materialization(Item_in_subselect *in_subs);
|
||||
static bool replace_where_subcondition(JOIN *join, Item **expr,
|
||||
|
@ -1092,7 +1222,7 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
|
|||
|
||||
TABLE_LIST *jtbm;
|
||||
char *tbl_alias;
|
||||
const char alias_mask[]="SUBQUERY#%d";
|
||||
const char alias_mask[]="<subquery%d>";
|
||||
if (!(tbl_alias= (char*)parent_join->thd->calloc(sizeof(alias_mask)+5)) ||
|
||||
!(jtbm= alloc_join_nest(parent_join->thd))) //todo: this is not a join nest!
|
||||
{
|
||||
|
|
|
@ -5899,7 +5899,6 @@ get_best_combination(JOIN *join)
|
|||
TABLE *form;
|
||||
*j= *join->best_positions[tablenr].table;
|
||||
form=join->table[tablenr]=j->table;
|
||||
//psergey-merge: or is the above: form=join->all_tables[tablenr]=j->table;
|
||||
used_tables|= form->map;
|
||||
form->reginfo.join_tab=j;
|
||||
if (!*j->on_expr_ref)
|
||||
|
@ -15052,8 +15051,6 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||
&usable_keys)) < MAX_KEY)
|
||||
{
|
||||
/* Found key that can be used to retrieve data in sorted order */
|
||||
//psergey-mrr:if (tab->pre_idx_push_select_cond)
|
||||
// tab->select_cond= tab->select->cond= tab->pre_idx_push_select_cond;
|
||||
if (tab->ref.key >= 0)
|
||||
{
|
||||
/*
|
||||
|
@ -17990,7 +17987,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
|||
/* table */
|
||||
int len= my_snprintf(table_name_buffer,
|
||||
sizeof(table_name_buffer)-1,
|
||||
"SUBQUERY#%d",
|
||||
"<subquery%d>",
|
||||
tab->emb_sj_nest->sj_subq_pred->get_identifier());
|
||||
item_list.push_back(new Item_string(table_name_buffer, len, cs));
|
||||
/* partitions */
|
||||
|
|
Loading…
Add table
Reference in a new issue