diff options
author | Igor Babaev <igor@askmonty.org> | 2013-08-14 20:37:38 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-08-14 20:37:38 -0700 |
commit | 7ba78277b4d76649501e85f05be2780e00ffc9c3 (patch) | |
tree | 69f83e400da760d365fde50f4dd5e921d339c8c7 /mysql-test | |
parent | edcae48734058eadd5ed29330b0a525544fa36ed (diff) | |
parent | 6dd9f049ab2c8771feabec447cff66b703392046 (diff) | |
download | mariadb-git-7ba78277b4d76649501e85f05be2780e00ffc9c3.tar.gz |
Merge 5.1->5.2
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/range.result | 44 | ||||
-rw-r--r-- | mysql-test/t/range.test | 38 |
2 files changed, 78 insertions, 4 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 8a416de66ee..55958e2c542 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -700,14 +700,14 @@ INSERT INTO t1 VALUES 'd8c4177d09f8b11f5.52725521'); EXPLAIN SELECT s.oxid FROM t1 v, t1 s -WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND +WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE v ref OXLEFT,OXRIGHT,OXROOTID OXROOTID 34 const 5 Using where 1 SIMPLE s ALL OXLEFT NULL NULL NULL 6 Range checked for each record (index map: 0x4) SELECT s.oxid FROM t1 v, t1 s -WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND +WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; oxid @@ -1884,6 +1884,46 @@ AAA AAA AAA AAAA AAAA AAAA AAAAA AAAAA AAAAA DROP TABLE t1; +# +# mdev-4894: Poor performance with unnecessary +# (bug#70021) 'Range checked for each record' +# +create table t1( key1 int not null, INDEX i1(key1) ); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8); +insert into t1 select key1+8 from t1; +insert into t1 select key1+16 from t1; +insert into t1 select key1+32 from t1; +insert into t1 select key1+64 from t1; +insert into t1 select key1+128 from t1; +insert into t1 select key1+256 from t1; +insert into t1 select key1+512 from t1; +alter table t1 add key2 int not null, add index i2(key2); +update t1 set key2=key1; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +create table t2 (a int); +insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8); +insert into t2 select a+16 from t2; +insert into t2 select a+32 from t2; +insert into t2 select a+64 from t2; +explain +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 range i1,i2 i1 4 NULL 78 Using where +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000; +count(*) +128 +explain +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 range i1,i2 i1 4 NULL 78 Using where +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a; +count(*) +126 +drop table t1,t2; End of 5.1 tests # # LP Bug #533117: Wrong use_count in SEL_ARG trees diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index c3f6aad4638..7fb9f21282a 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -557,12 +557,12 @@ INSERT INTO t1 VALUES EXPLAIN SELECT s.oxid FROM t1 v, t1 s - WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND + WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; SELECT s.oxid FROM t1 v, t1 s - WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND + WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; @@ -1468,6 +1468,40 @@ SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND DROP TABLE t1; +--echo # +--echo # mdev-4894: Poor performance with unnecessary +--echo # (bug#70021) 'Range checked for each record' +--echo # + +create table t1( key1 int not null, INDEX i1(key1) ); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8); +insert into t1 select key1+8 from t1; +insert into t1 select key1+16 from t1; +insert into t1 select key1+32 from t1; +insert into t1 select key1+64 from t1; +insert into t1 select key1+128 from t1; +insert into t1 select key1+256 from t1; +insert into t1 select key1+512 from t1; + +alter table t1 add key2 int not null, add index i2(key2); +update t1 set key2=key1; +analyze table t1; + +create table t2 (a int); +insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8); +insert into t2 select a+16 from t2; +insert into t2 select a+32 from t2; +insert into t2 select a+64 from t2; + +explain +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000; +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000; +explain +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a; +select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a; + +drop table t1,t2; + --echo End of 5.1 tests --echo # |