1405
1405
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
1406
1406
id select_type table type possible_keys key key_len ref rows filtered Extra
1407
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1408
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1407
1 PRIMARY t1 index NULL s1 8 NULL 3 100.00 Using index
1408
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 8 func 2 100.00 Using index; Full scan on NULL key
1410
1410
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 NOT IN (SELECT s1 FROM t2)" from "test"."t1"
1411
1411
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
1412
1412
id select_type table type possible_keys key key_len ref rows filtered Extra
1413
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1414
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1413
1 PRIMARY t1 index NULL s1 8 NULL 3 100.00 Using index
1414
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 8 func 2 100.00 Using index; Full scan on NULL key
1416
1416
Note 1003 select "test"."t1"."s1" AS "s1",<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))) AS "s1 = ANY (SELECT s1 FROM t2)" from "test"."t1"
1417
1417
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
1418
1418
id select_type table type possible_keys key key_len ref rows filtered Extra
1419
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1420
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1419
1 PRIMARY t1 index NULL s1 8 NULL 3 100.00 Using index
1420
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 8 func 2 100.00 Using index; Full scan on NULL key
1422
1422
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 <> ALL (SELECT s1 FROM t2)" from "test"."t1"
1423
1423
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
1424
1424
id select_type table type possible_keys key key_len ref rows filtered Extra
1425
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1426
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
1425
1 PRIMARY t1 index NULL s1 8 NULL 3 100.00 Using index
1426
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 8 func 2 100.00 Using index; Using where; Full scan on NULL key
1428
1428
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL where ("test"."t2"."s1" < 'a2') having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')" from "test"."t1"
1429
1429
drop table t1,t2;
3821
3821
CREATE INDEX I2 ON t1 (b);
3822
3822
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
3823
3823
id select_type table type possible_keys key key_len ref rows Extra
3824
1 PRIMARY t1 index I1 I1 2 NULL 2 Using index; LooseScan
3824
1 PRIMARY t1 index I1 I1 4 NULL 2 Using index; LooseScan
3825
3825
1 PRIMARY t1 ref I2 I2 13 test.t1.a 1 Using index condition
3826
3826
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
3839
3839
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
3840
3840
id select_type table type possible_keys key key_len ref rows Extra
3841
1 PRIMARY t1 index I1 I1 2 NULL 2 Using where; Using index; LooseScan
3841
1 PRIMARY t1 index I1 I1 4 NULL 2 Using where; Using index; LooseScan
3842
3842
1 PRIMARY t1 ref I2 I2 13 test.t1.a 1 Using index condition
3843
3843
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);