diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-01-30 20:34:47 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-01-30 20:34:47 +0400 |
commit | 12bd3dfe29164a4a74a97da5c09d9401491ea27d (patch) | |
tree | b24535c67961180684125425be9dc91e70ccda66 /mysql-test | |
parent | 9fce78a48225e0aa584d590943e460ce98649669 (diff) | |
download | mariadb-git-12bd3dfe29164a4a74a97da5c09d9401491ea27d.tar.gz |
BUG#923246: Loosescan reports different result than other semijoin methods
- If LooseScan is used with quick select, require that quick select produces
data in key order (this disables use of MRR, which can return data in arbitrary order).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/subselect3_jcl6.result | 2 | ||||
-rw-r--r-- | mysql-test/r/subselect_sj.result | 40 | ||||
-rw-r--r-- | mysql-test/r/subselect_sj_jcl6.result | 40 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj.test | 22 |
4 files changed, 103 insertions, 1 deletions
diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result index 38284345fc2..77b8b5faebc 100644 --- a/mysql-test/r/subselect3_jcl6.result +++ b/mysql-test/r/subselect3_jcl6.result @@ -1156,7 +1156,7 @@ insert into t4 select a from t3; explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20 and t4.pk=t1.c); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using index condition; Using where; Rowid-ordered scan; LooseScan +1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using index condition; Using where; LooseScan 1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t1) 1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join) drop table t1, t3, t4; diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index 260cd512863..f92b33ff651 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2588,4 +2588,44 @@ k 8 v g 0 j g 8 v DROP TABLE t1, t2; +# +# BUG#923246: Loosescan reports different result than other semijoin methods +# +set @tmp_923246= @@optimizer_switch; +set optimizer_switch='mrr=on,materialization=off'; +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (kp1 int, kp2 int, c int, filler char(100), key(kp1, kp2)); +insert into t1 select A.a+10*(B.a+10*C.a), 0, 0, 'filler' from t0 A, t0 B, t0 C; +insert into t1 select * from t1 where kp1 < 20; +create table t3 (a int); +insert into t3 select A.a + 10*B.a from t0 A, t0 B; +select * from t3 where a in (select kp1 from t1 where kp1<20); +a +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +explain select * from t3 where a in (select kp1 from t1 where kp1<20); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using where; Using index; LooseScan +1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join) +drop table t0,t1,t3; +set optimizer_switch= @tmp_923246; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index a27b6b7b55d..dd358ced14a 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2602,6 +2602,46 @@ k 8 v g 0 j g 8 v DROP TABLE t1, t2; +# +# BUG#923246: Loosescan reports different result than other semijoin methods +# +set @tmp_923246= @@optimizer_switch; +set optimizer_switch='mrr=on,materialization=off'; +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (kp1 int, kp2 int, c int, filler char(100), key(kp1, kp2)); +insert into t1 select A.a+10*(B.a+10*C.a), 0, 0, 'filler' from t0 A, t0 B, t0 C; +insert into t1 select * from t1 where kp1 < 20; +create table t3 (a int); +insert into t3 select A.a + 10*B.a from t0 A, t0 B; +select * from t3 where a in (select kp1 from t1 where kp1<20); +a +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +explain select * from t3 where a in (select kp1 from t1 where kp1<20); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using where; Using index; LooseScan +1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join) +drop table t0,t1,t3; +set optimizer_switch= @tmp_923246; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index eabdbf33ecd..6b8a757b9e8 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2309,5 +2309,27 @@ WHERE alias2.c IN ( DROP TABLE t1, t2; +--echo # +--echo # BUG#923246: Loosescan reports different result than other semijoin methods +--echo # +set @tmp_923246= @@optimizer_switch; +set optimizer_switch='mrr=on,materialization=off'; + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (kp1 int, kp2 int, c int, filler char(100), key(kp1, kp2)); +insert into t1 select A.a+10*(B.a+10*C.a), 0, 0, 'filler' from t0 A, t0 B, t0 C; +insert into t1 select * from t1 where kp1 < 20; + +create table t3 (a int); +insert into t3 select A.a + 10*B.a from t0 A, t0 B; + +select * from t3 where a in (select kp1 from t1 where kp1<20); +explain select * from t3 where a in (select kp1 from t1 where kp1<20); + +drop table t0,t1,t3; +set optimizer_switch= @tmp_923246; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; |