@@ -289,9 +289,9 @@ insert into t3 values (7), (5), (7), (3);
...
@@ -289,9 +289,9 @@ insert into t3 values (7), (5), (7), (3);
explain extended delete from t1 where a in (select pk from t2);
explain extended delete from t1 where a in (select pk from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
2 MATERIALIZED t2 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index
Warnings:
Warnings:
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on PRIMARY)))
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`pk` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`pk`)))
@@ -251,7 +251,7 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
...
@@ -251,7 +251,7 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
FLUSH STATUS;
FLUSH STATUS;
FLUSH TABLES;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
...
@@ -1027,15 +1027,15 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
...
@@ -1027,15 +1027,15 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
FLUSH STATUS;
FLUSH STATUS;
FLUSH TABLES;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
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 t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Warnings:
Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where <in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where <cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`))
Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
4 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from <materialize> (/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),<exists>(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(<cache>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) join `test`.`t2` where `<subquery2>`.`c` = `test`.`t2`.`b`
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from <materialize> (/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1) in ( <materialize> (/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` ), <primary_index_lookup>(<cache>(`test`.`t1`.`a`) in <temporary table> on distinct_key where <cache>(`test`.`t1`.`a`) = `<subquery4>`.`d`)))) join `test`.`t2` where `<subquery2>`.`c` = `test`.`t2`.`b`
select b from t2
select b from t2
where b in (select c from t3
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
group by (select a from t1 where a = 1) in (select d from t4));
...
@@ -3116,10 +3124,10 @@ group by (select a from t1 where a = 1) in
...
@@ -3116,10 +3124,10 @@ group by (select a from t1 where a = 1) in
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
4 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <nop>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),<exists>(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(<cache>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) <= <cache>(`test`.`t2`.`b`)))
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <nop>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1) in ( <materialize> (/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` ), <primary_index_lookup>(<cache>(`test`.`t1`.`a`) in <temporary table> on distinct_key where <cache>(`test`.`t1`.`a`) = `<subquery4>`.`d`)))) <= <cache>(`test`.`t2`.`b`)))
select b from t2
select b from t2
where b >= any (select c from t3
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
group by (select a from t1 where a = 1) in
...
@@ -3132,10 +3140,10 @@ group by (select a from t1 where a = 1) in
...
@@ -3132,10 +3140,10 @@ group by (select a from t1 where a = 1) in
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
4 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <not>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),<exists>(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(<cache>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) < <cache>(`test`.`t2`.`b`)))
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <not>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by <in_optimizer>((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1) in ( <materialize> (/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` ), <primary_index_lookup>(<cache>(`test`.`t1`.`a`) in <temporary table> on distinct_key where <cache>(`test`.`t1`.`a`) = `<subquery4>`.`d`)))) < <cache>(`test`.`t2`.`b`)))
3 MATERIALIZED t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(/* select#3 */ select 0 from dual where <cache>(0) = 0)))
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,0 in ( <materialize> (/* select#3 */ select 0 from dual ), <primary_index_lookup>(0 in <temporary table> on distinct_key where 0 = `<subquery3>`.`b`))))
SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
WHERE t.a IN (SELECT b FROM t1);
WHERE t.a IN (SELECT b FROM t1);
a a b
a a b
...
@@ -366,9 +366,9 @@ WHERE t.a IN (SELECT b FROM t1);
...
@@ -366,9 +366,9 @@ WHERE t.a IN (SELECT b FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(/* select#2 */ select 0 from dual where <cache>(0) = 0)))
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,0 in ( <materialize> (/* select#2 */ select 0 from dual ), <primary_index_lookup>(0 in <temporary table> on distinct_key where 0 = `<subquery2>`.`b`))))