mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
WL#2985 "Partition Pruning": post-review fixes:
- Added more comments. - Added a RANGE_OPT_PARAM::remove_jump_scans flag that disables construction of index_merge SEL_TREEs that represent unusable conditions like "key1part1<c1 OR key2part2<c2" - make prune_partitions() function handle the case where range analysis produces a list of index_merge trees (it turned out that this is possible, appropriate test case added). - Other small fixes.
This commit is contained in:
@@ -213,3 +213,48 @@ explain partitions select * from t1 where a='b';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a1 int not null
|
||||
)
|
||||
partition by range (a1) (
|
||||
partition p0 values less than (3),
|
||||
partition p1 values less than (6),
|
||||
partition p2 values less than (9)
|
||||
);
|
||||
insert into t1 values (1),(2),(3);
|
||||
explain partitions select * from t1 where a1 > 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 a1 >= 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 a1 < 3 and a1 > 3;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
drop table t1;
|
||||
create table t3 (a int, b int)
|
||||
partition by list(a) subpartition by hash(b) subpartitions 4 (
|
||||
partition p0 values in (1),
|
||||
partition p1 values in (2),
|
||||
partition p2 values in (3),
|
||||
partition p3 values in (4)
|
||||
);
|
||||
insert into t3 values (1,1),(2,2),(3,3);
|
||||
explain partitions select * from t3 where a=2 or b=1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 p0_sp1,p1_sp0,p1_sp1,p1_sp2,p1_sp3,p2_sp1,p3_sp1 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t3 where a=4 or b=2;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 p0_sp2,p1_sp2,p2_sp2,p3_sp0,p3_sp1,p3_sp2,p3_sp3 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 p1_sp2,p3_sp1 ALL NULL NULL NULL NULL 3 Using where
|
||||
create table t1 (a int) partition by hash(a) partitions 2;
|
||||
insert into t1 values (1),(2);
|
||||
explain partitions select * from t1 where a is null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
explain partitions select * from t1 where a is not null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
|
||||
drop table t1;
|
||||
|
||||
Reference in New Issue
Block a user