diff options
author | Martin Hansson <martin.hansson@sun.com> | 2010-08-11 17:55:07 +0200 |
---|---|---|
committer | Martin Hansson <martin.hansson@sun.com> | 2010-08-11 17:55:07 +0200 |
commit | 2c47236bef243e5920309921515a8e9d5b00b64a (patch) | |
tree | 1475ef1bef523613baf91f1c40ba2a68081539e4 /mysql-test/t/partition_range.test | |
parent | afd775d9e10684670213f50d4b62c8a3d4e36c78 (diff) | |
parent | 41cfa3e76966b55b8a5354f0d0b57ce624a8c95c (diff) | |
download | mariadb-git-2c47236bef243e5920309921515a8e9d5b00b64a.tar.gz |
Merge of fix for Bug#54444.
Diffstat (limited to 'mysql-test/t/partition_range.test')
-rw-r--r-- | mysql-test/t/partition_range.test | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 673d05532eb..4e2c1b98a70 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -931,3 +931,44 @@ insert into t2 values(52, 20070322, 456, 'filler') ; select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid; drop table t1, t2; + +--echo # +--echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range +--echo # endpoints +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + KEY ( a, b ) +) PARTITION BY HASH (a) PARTITIONS 1; + +CREATE TABLE t2 ( + a INT, + b INT, + KEY ( a, b ) +); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; +INSERT INTO t1 SELECT a + 10, b + 10 FROM t1; +INSERT INTO t1 SELECT a + 20, b + 20 FROM t1; +INSERT INTO t1 SELECT a + 40, b + 40 FROM t1; + +INSERT INTO t2 SELECT * FROM t1; + +--echo # plans should be identical +EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; +EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; + +FLUSH status; +SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a; +--echo # Should be no more than 4 reads. +SHOW status LIKE 'handler_read_key'; + +FLUSH status; +SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; +--echo # Should be no more than 4 reads. +SHOW status LIKE 'handler_read_key'; + +DROP TABLE t1, t2; |