Warning 4213 Unresolved index name `t1`@`select#1` `idx_å` for NO_MRR hint
Warning 4220 Unresolved index name `t1`@`select#1` `idx_å` for NO_MRR hint
SELECT /*+ NO_MRR(t1 idx_a, idx_å, idx_A) */ a FROM t1;
a
1
2
Warnings:
Warning 4210 Hint NO_MRR(`t1` `idx_A`) is ignored as conflicting/duplicated
Warning 4213 Unresolved index name `t1`@`select#1` `idx_å` for NO_MRR hint
Warning 4217 Hint NO_MRR(`t1` `idx_A`) is ignored as conflicting/duplicated
Warning 4220 Unresolved index name `t1`@`select#1` `idx_å` for NO_MRR hint
DROP TABLE t1;
# Testing that query block names are accent sensitive case insensitive
CREATE TABLE t1 (a INT);
SELECT /*+ QB_NAME(a) BKA(t1@a) BKA(t1@A) */ * FROM t1;
a
Warnings:
Warning 4210 Hint BKA(`t1`@`A`) is ignored as conflicting/duplicated
Warning 4217 Hint BKA(`t1`@`A`) is ignored as conflicting/duplicated
SELECT /*+ QB_NAME(a) BKA(t1@a) BKA(t1@å) */ * FROM t1;
a
Warnings:
Warning 4211 Query block name `å` is not found for BKA hint
Warning 4218 Query block name `å` is not found for BKA hint
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES
@ -230,7 +230,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ref y_idx y_idx 5 const 1 100.00
1 SIMPLE t5 range x_idx x_idx 5 NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Warning 4213 Unresolved index name `t5`@`select#2` `z_idx` for NO_ICP hint
Warning 4220 Unresolved index name `t5`@`select#2` `z_idx` for NO_ICP hint
Note 1003 select /*+ NO_ICP(`t5`@`select#2` `y_idx`) NO_ICP(`t5`@`select#2` `x_idx`) */ `test`.`t4`.`x` AS `x`,`test`.`t5`.`y` AS `y` from `test`.`t4` join `test`.`t4` `t5` where `test`.`t4`.`y` = 8 and `test`.`t5`.`x` between 7 and <cache>(8 + 0)
@ -557,7 +557,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL f1 NULL NULL NULL 28 25.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Warning 4211 Query block name `qb1` is not found for BKA hint
Warning 4218 Query block name `qb1` is not found for BKA hint
Note 1003 select /*+ QB_NAME(`qb1`) */ `test`.`t2`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f1` = `test`.`t1`.`f1` and `test`.`t2`.`f2` between `test`.`t1`.`f1` and `test`.`t1`.`f2` and `test`.`t2`.`f2` + 1 >= `test`.`t1`.`f1` + 1
# Should not crash
PREPARE stmt1 FROM "SELECT /*+ BKA(t2) */ t2.f1, t2.f2, t2.f3 FROM t1,t2
@ -601,9 +601,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL f1 NULL NULL NULL 28 25.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Warning 4212 Unresolved table name `t3`@`select#1` for BKA hint
Warning 4212 Unresolved table name `t3`@`select#1` for NO_RANGE_OPTIMIZATION hint
Warning 4213 Unresolved index name `t3`@`select#1` `idx1` for NO_RANGE_OPTIMIZATION hint
Warning 4219 Unresolved table name `t3`@`select#1` for BKA hint
Warning 4219 Unresolved table name `t3`@`select#1` for NO_RANGE_OPTIMIZATION hint
Warning 4220 Unresolved index name `t3`@`select#1` `idx1` for NO_RANGE_OPTIMIZATION hint
Note 1003 select /*+ BKA(`t2`@`select#1`) NO_BNL(`t1`@`select#1`) */ `test`.`t2`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f1` = `test`.`t1`.`f1` and `test`.`t2`.`f2` between `test`.`t1`.`f1` and `test`.`t1`.`f2` and `test`.`t2`.`f2` + 1 >= `test`.`t1`.`f1` + 1
# Check illegal syntax
EXPLAIN EXTENDED SELECT /*+ BKA(qb1 t3@qb1) */ f2 FROM
@ -640,7 +640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE tbl12 ALL NULL NULL NULL NULL 10 100.00 Using where
1 SIMPLE tbl13 hash_ALL a #hash#a 5 test.tbl12.a 1000 0.10 Using where; Using join buffer (flat, BNLH join)
Warnings:
Warning 4212 Unresolved table name `tbl2`@`select#1` for BKA hint
Warning 4219 Unresolved table name `tbl2`@`select#1` for BKA hint
Note 1003 select `test`.`tbl12`.`a` AS `a`,`test`.`tbl12`.`b` AS `b`,`test`.`tbl13`.`a` AS `a`,`test`.`tbl13`.`b` AS `b`,`test`.`tbl13`.`c` AS `c`,`test`.`tbl13`.`filler` AS `filler` from `test`.`t12` `tbl12` join `test`.`t13` `tbl13` where `test`.`tbl13`.`a` = `test`.`tbl12`.`a` and `test`.`tbl13`.`b` + 1 <= `test`.`tbl13`.`b` + 1
# Check that PS and conventional statements give the same result.
@ -922,7 +922,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 100.00 Using where
1 PRIMARY ta2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Warning 4210 Hint JOIN_SUFFIX(`ta2`,`t3`,`ta1`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_SUFFIX(`ta2`,`t3`,`ta1`) is ignored as conflicting/duplicated
Note 1003 delete from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
@ -935,8 +935,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 100.00 Using where
1 PRIMARY ta2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Warning 4210 Hint JOIN_PREFIX(`ta1`,`t2`,`t3`) is ignored as conflicting/duplicated
Warning 4210 Hint JOIN_SUFFIX(`t3`,`ta2`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_PREFIX(`ta1`,`t2`,`t3`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_SUFFIX(`t3`,`ta2`) is ignored as conflicting/duplicated
Note 1003 delete from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
DROP TABLE t1, t2, t3;
# Const table behavior, table order is not changed, hint is applicable.
@ -980,7 +980,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 Using where
Warnings:
Warning 4210 Hint JOIN_SUFFIX(`t1`,`t2`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_SUFFIX(`t1`,`t2`) is ignored as conflicting/duplicated
DROP TABLE t1, t2;
CREATE TABLE t1
(
@ -1008,7 +1008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t1 ref f1 f1 5 test.t3.f1 1 100.00 Using where; Using index
Warnings:
Warning 4210 Hint JOIN_ORDER(`t1`,`t2`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_ORDER(`t1`,`t2`) is ignored as conflicting/duplicated
Note 1003 select /*+ JOIN_ORDER(@`select#1` `t2`,`t3`) */ `test`.`t3`.`f1` AS `f1` from `test`.`t2` join `test`.`t3` left join `test`.`t1` on(`test`.`t1`.`f1` = `test`.`t3`.`f1` and `test`.`t3`.`f1` is not null) where `test`.`t2`.`f1` < 7 and convert(`test`.`t3`.`f2` using utf8mb3) = `test`.`t2`.`f2`
FROM ( t2 INNER JOIN t3 ON t3.f2 = t2.f2 LEFT JOIN t1 ON t1.f1 = t3.f1 )
@ -1018,7 +1018,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref f1 f1 5 test.t3.f1 1 100.00 Using where; Using index
1 SIMPLE t2 ref f2,f1 f2 768 func 1 100.00 Using index condition; Using where
Warnings:
Warning 4210 Hint JOIN_ORDER(`t2`,`t3`) is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_ORDER(`t2`,`t3`) is ignored as conflicting/duplicated
Note 1003 select /*+ JOIN_ORDER(@`select#1` `t1`,`t2`) */ `test`.`t3`.`f1` AS `f1` from `test`.`t2` join `test`.`t3` left join `test`.`t1` on(`test`.`t1`.`f1` = `test`.`t3`.`f1` and `test`.`t3`.`f1` is not null) where `test`.`t2`.`f1` < 7 and convert(`test`.`t3`.`f2` using utf8mb3) = `test`.`t2`.`f2`
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (
@ -1035,7 +1035,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 Using where
Warning 4210 Hint JOIN_FIXED_ORDER() is ignored as conflicting/duplicated
Warning 4217 Hint JOIN_FIXED_ORDER() is ignored as conflicting/duplicated
Note 1276 Field or reference 'test.als2.f2' of SELECT #2 was resolved in SELECT #1
Note 1003 update /*+ JOIN_ORDER(@`select#1` `t2`,`als1`,`als3`) */ (`test`.`t2`) join `test`.`t3` `als4` left join (`test`.`t3` `als1` join `test`.`t1` `als2` join `test`.`t1` `als3`) on(`test`.`als1`.`f3` = `test`.`als4`.`f2` and multiple equal(`test`.`als1`.`f1`, `test`.`als3`.`f3`) and multiple equal(`test`.`als1`.`f3`, `test`.`als2`.`f1`)) set `test`.`als1`.`f4` = 'eogqjvbhzodzimqahyzlktkbexkhdwxwgifikhcgblhgswxyutepc' where 0
DROP TABLE t1, t2, t3;
@ -1238,7 +1238,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref f2 f2 5 const 1 100.00 Using index condition; Using where
1 SIMPLE t1 ref f2 f2 5 test.t2.f3 1 100.00 Using index
Warnings:
Warning 4212 Unresolved table name `alias1` for JOIN_PREFIX hint
Warning 4219 Unresolved table name `alias1` for JOIN_PREFIX hint
Note 1003 select `test`.`t2`.`f3` AS `field1` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`f2` = `test`.`t2`.`f3` and `test`.`t2`.`f2` is null having `f3` <> 3 and `f3` >= 8
Warning 4211 Query block name `qb1` is not found for SUBQUERY hint
Warning 4218 Query block name `qb1` is not found for SUBQUERY hint
SELECT /*+ SUBQUERY() */ a FROM t1;
a
1
@ -195,15 +195,15 @@ SELECT /*+ SEMIJOIN() SEMIJOIN(dupsweedout) NO_SEMIJOIN(firstmatch)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(DUPSWEEDOUT) is ignored as conflicting/duplicated
Warning 4210 Hint NO_SEMIJOIN(FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(DUPSWEEDOUT) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`select#1`) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SEMIJOIN(loosescan,materialization) SEMIJOIN(dupsweedout)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(DUPSWEEDOUT) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(DUPSWEEDOUT) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`select#1` LOOSESCAN, MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ NO_SEMIJOIN(firstmatch,loosescan,materialization) SEMIJOIN() NO_SEMIJOIN()*/ a
@ -211,8 +211,8 @@ FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN() is ignored as conflicting/duplicated
Warning 4210 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Note 1003 select /*+ NO_SEMIJOIN(@`select#1` FIRSTMATCH, LOOSESCAN, MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ QB_NAME(qb1) SEMIJOIN(@qb1) SEMIJOIN(loosescan) NO_SEMIJOIN(@qb1 dupsweedout)*/ a
@ -220,36 +220,36 @@ FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(LOOSESCAN) is ignored as conflicting/duplicated
Warning 4210 Hint NO_SEMIJOIN(@`qb1` DUPSWEEDOUT) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(LOOSESCAN) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(@`qb1` DUPSWEEDOUT) is ignored as conflicting/duplicated
Note 1003 select /*+ QB_NAME(`qb1`) SEMIJOIN(@`qb1`) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED SELECT /*+ SEMIJOIN(firstmatch) NO_SEMIJOIN()*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`select#1` FIRSTMATCH) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SUBQUERY(materialization) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ SUBQUERY(@`select#1` MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SEMIJOIN() SUBQUERY(materialization) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`select#1`) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SUBQUERY(materialization) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ SUBQUERY(@`select#1` MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SUBQUERY(materialization) SUBQUERY(intoexists) SUBQUERY(materialization)*/ a
@ -257,32 +257,32 @@ FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4210 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Note 1003 select /*+ SUBQUERY(@`select#1` MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SUBQUERY(materialization) SEMIJOIN(firstmatch) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ SUBQUERY(@`select#1` MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ QB_NAME(qb1) SEMIJOIN(@qb1) SUBQUERY(@qb1 materialization) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(@`qb1` MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(@`qb1` MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ QB_NAME(`qb1`) SEMIJOIN(@`qb1`) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ QB_NAME(qb1) SUBQUERY(@qb1 materialization) SEMIJOIN(@qb1 firstmatch) SUBQUERY(intoexists)*/ a FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(@`qb1` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`qb1` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 select /*+ QB_NAME(`qb1`) SUBQUERY(@`qb1` MATERIALIZATION) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
EXPLAIN EXTENDED
SELECT /*+ SEMIJOIN(@qb1) SEMIJOIN(loosescan) NO_SEMIJOIN(@qb1 dupsweedout)*/ a
@ -291,7 +291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t2 index NULL a 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint NO_SEMIJOIN(@`qb1` DUPSWEEDOUT) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(@`qb1` DUPSWEEDOUT) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`qb1`) SEMIJOIN(@`select#1` LOOSESCAN) */ `tt`.`a` AS `a` from (/* select#2 */ select /*+ QB_NAME(`qb1`) */ `test`.`t2`.`a` AS `a` from `test`.`t2`) `tt`
DROP TABLE t1, t2 ,t3;
set optimizer_switch=default;
@ -1434,7 +1434,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN() is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`select#2`) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Try opposite order
EXPLAIN EXTENDED
@ -1444,7 +1444,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t2 ref a a 4 test.t1.a 1 100.00 Using index
Warnings:
Warning 4210 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN() is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`select#2`) */ `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a`
# Specify at different levels, hint inside block has effect
EXPLAIN EXTENDED
@ -1454,7 +1454,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t2 ref a a 4 test.t1.a 1 100.00 Using index
Warnings:
Warning 4210 Hint NO_SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a`
# Specify at different levels, opposite order
EXPLAIN EXTENDED
@ -1464,7 +1464,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Duplicate hints also gives warning, but hint has effect
EXPLAIN EXTENDED
@ -1474,7 +1474,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t2 ref a a 4 test.t1.a 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a`
EXPLAIN EXTENDED
SELECT /*+ NO_SEMIJOIN(@subq) */ * FROM t2
@ -1483,7 +1483,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint NO_SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(@`subq` ) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Multiple subqueries with conflicting hints
EXPLAIN EXTENDED
@ -1495,8 +1495,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ref a a 4 test.t1.b 1 66.67 Using index; Start temporary; End temporary
2 DEPENDENT SUBQUERY t3 index_subquery a a 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq1` LOOSESCAN) is ignored as conflicting/duplicated
Warning 4210 Hint SEMIJOIN(@`subq2` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq1` LOOSESCAN) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq2` FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`subq1`) SEMIJOIN(@`subq2` LOOSESCAN) */ `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t1`.`b` and <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t3 on a))))
EXPLAIN EXTENDED
SELECT /*+ SEMIJOIN(@subq1 LOOSESCAN) SEMIJOIN(@subq2 FIRSTMATCH) */ * FROM t1
@ -1507,8 +1507,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ref a a 4 test.t1.a 1 100.00 Using index; FirstMatch(t1)
1 PRIMARY t2 ref a a 4 test.t1.b 1 66.67 Using index; Start temporary; End temporary
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq1` LOOSESCAN) is ignored as conflicting/duplicated
Warning 4210 Hint SEMIJOIN(@`subq2` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq1` LOOSESCAN) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq2` FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 select /*+ NO_SEMIJOIN(@`subq1` LOOSESCAN) SEMIJOIN(@`subq2` LOOSESCAN) */ `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t3`) semi join (`test`.`t2`) where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t2`.`a` = `test`.`t1`.`b`
# Conflicting hints in same hint comment
EXPLAIN EXTENDED
@ -1520,7 +1520,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.a 1 25.00 Using where
1 PRIMARY t2 ref a a 4 test.t1.b 1 66.67 Using index; FirstMatch(t1)
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq1` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq1` FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`subq1` LOOSESCAN) */ `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t3`) semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t3`.`a` and `test`.`t2`.`a` = `test`.`t1`.`b`
@ -1544,7 +1544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ref a a 4 test.t1.a 1 100.00 Using index; FirstMatch(t1)
1 PRIMARY t2 ref a a 4 test.t1.b 1 66.67 Using index; FirstMatch(t3)
Warnings:
Warning 4210 Hint NO_SEMIJOIN(@`subq1` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint NO_SEMIJOIN(@`subq1` FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 select /*+ NO_SEMIJOIN(@`subq1` LOOSESCAN) */ `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t3`) semi join (`test`.`t2`) where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t2`.`a` = `test`.`t1`.`b`
# Non-supported strategies should give warnings
EXPLAIN EXTENDED
@ -1770,7 +1770,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 MATERIALIZED t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`select#2` MATERIALIZATION) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`))))
# Try opposite order
EXPLAIN EXTENDED
@ -1781,7 +1781,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`select#2` INTOEXISTS) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Specify at different levels, hint inside block has effect
EXPLAIN EXTENDED
@ -1791,7 +1791,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(@`subq` MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(@`subq` MATERIALIZATION) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` INTOEXISTS) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Specify at different levels, opposite order
EXPLAIN EXTENDED
@ -1801,7 +1801,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 MATERIALIZED t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(@`subq` INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(@`subq` INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` MATERIALIZATION) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (/* select#2 */ select /*+ QB_NAME(`subq`) */ `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`))))
# Specifying combinations of SUBQUERY and SEMIJOIN/NO_SEMIJOIN
# for same query block gives warning
@ -1813,7 +1813,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN() is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN() is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`select#2` INTOEXISTS) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Try opposite order
EXPLAIN EXTENDED
@ -1823,7 +1823,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(MATERIALIZATION) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`select#2`) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
# Specify at different levels, hint inside block has effect
EXPLAIN EXTENDED
@ -1833,7 +1833,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t2 ref a a 4 test.t1.a 1 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(@`subq` MATERIALIZATION) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(@`subq` MATERIALIZATION) is ignored as conflicting/duplicated
Note 1003 select /*+ SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a`
EXPLAIN EXTENDED
SELECT /*+ SUBQUERY(@subq INTOEXISTS) */ * FROM t2
@ -1842,7 +1842,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SUBQUERY(@`subq` INTOEXISTS) is ignored as conflicting/duplicated
Warning 4217 Hint SUBQUERY(@`subq` INTOEXISTS) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ NO_SEMIJOIN(@`subq`) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
EXPLAIN EXTENDED
SELECT /*+ SEMIJOIN(@subq FIRSTMATCH) */ * FROM t2
@ -1851,6 +1851,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 4 NULL 6 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Warning 4210 Hint SEMIJOIN(@`subq` FIRSTMATCH) is ignored as conflicting/duplicated
Warning 4217 Hint SEMIJOIN(@`subq` FIRSTMATCH) is ignored as conflicting/duplicated
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` INTOEXISTS) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))