mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Optimisation if simple IN subselect with primary index
(SCRUM) (part of WL#818)
This commit is contained in:
@@ -1226,7 +1226,15 @@ a
|
||||
explain select * from t2 where t2.a in (select a from t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 simple_in PRIMARY PRIMARY 4 func 1 Using index
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
2
|
||||
4
|
||||
explain select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 simple_in PRIMARY PRIMARY 4 func 1 Using index; Using where
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
a
|
||||
2
|
||||
|
||||
@@ -819,6 +819,8 @@ insert into t2 values (2), (3), (4), (5);
|
||||
insert into t3 values (10,3), (20,4), (30,5);
|
||||
select * from t2 where t2.a in (select a from t1);
|
||||
explain select * from t2 where t2.a in (select a from t1);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
explain select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
explain select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
drop table t1, t2, t3;
|
||||
|
||||
Reference in New Issue
Block a user