diff options
author | sergefp@mysql.com <> | 2006-01-04 11:09:01 +0300 |
---|---|---|
committer | sergefp@mysql.com <> | 2006-01-04 11:09:01 +0300 |
commit | 93669bfe0bce493f02226c8c5b0fab3e1c8c3270 (patch) | |
tree | 4ea8a914fa12cca3d8ad46e0c42492a7b099eebc /mysql-test | |
parent | f2d603c245f623019efe7badcfeae2927f56414a (diff) | |
download | mariadb-git-93669bfe0bce493f02226c8c5b0fab3e1c8c3270.tar.gz |
WL#2985 "Partition Pruning":
- post-...-post review fixes
- Added "integer range walking" that allows to do partition pruning for "a <=? t.field <=? b"
by finding used partitions for a, a+1, a+2, ..., b-1, b.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition_pruning.result | 30 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 2 | ||||
-rw-r--r-- | mysql-test/t/partition_pruning.test | 23 |
3 files changed, 54 insertions, 1 deletions
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index ef431b2c00e..6f210a76778 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -274,3 +274,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where 1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2 drop table t1; +create table t1 (a int) partition by hash(a) partitions 20; +insert into t1 values (1),(2),(3); +explain partitions select * from t1 where a > 1 and a < 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t1 where a >= 1 and a < 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t1 where a > 1 and a <= 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t1 where a >= 1 and a <= 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where +drop table t1; +create table t1 (a int, b int) +partition by list(a) subpartition by hash(b) subpartitions 20 +( +partition p0 values in (0), +partition p1 values in (1), +partition p2 values in (2), +partition p3 values in (3) +); +insert into t1 values (1,1),(2,2),(3,3); +explain partitions select * from t1 where b > 1 and b < 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0_sp2,p1_sp2,p2_sp2,p3_sp2 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1_sp2,p2_sp2 ALL NULL NULL NULL NULL 3 Using where diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 609e24023d7..7591f8d77e5 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -209,7 +209,7 @@ create table t1 (a int not null, b int not null) partition by LIST (a+b) ( partition p0 values in (12), partition p1 values in (14) ); ---error 1500 +--error ER_NO_PARTITION_FOR_GIVEN_VALUE insert into t1 values (10,1); drop table t1; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 0d6bd344159..b45e6cf0d76 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -247,5 +247,28 @@ explain partitions select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2); drop table t1; + +# Tests for "short ranges" +create table t1 (a int) partition by hash(a) partitions 20; +insert into t1 values (1),(2),(3); +explain partitions select * from t1 where a > 1 and a < 3; +explain partitions select * from t1 where a >= 1 and a < 3; +explain partitions select * from t1 where a > 1 and a <= 3; +explain partitions select * from t1 where a >= 1 and a <= 3; +drop table t1; + +create table t1 (a int, b int) + partition by list(a) subpartition by hash(b) subpartitions 20 +( + partition p0 values in (0), + partition p1 values in (1), + partition p2 values in (2), + partition p3 values in (3) +); +insert into t1 values (1,1),(2,2),(3,3); + +explain partitions select * from t1 where b > 1 and b < 3; +explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2); + # No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447 # being fixed. |