mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#2985 "Partition Pruning": post-review fixes: Better comments
This commit is contained in:
@ -259,3 +259,18 @@ 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;
|
||||
create table t1 (a int not null, b int not null, key(a), key(b))
|
||||
partition by hash(a) partitions 4;
|
||||
insert into t1 values (1,1),(2,2),(3,3),(4,4);
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y
|
||||
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 4 Using where
|
||||
1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
|
||||
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;
|
||||
|
@ -230,9 +230,22 @@ 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;
|
||||
|
||||
# this selects both
|
||||
# this uses both partitions
|
||||
explain partitions select * from t1 where a is not null;
|
||||
drop table t1;
|
||||
|
||||
# Join tests
|
||||
create table t1 (a int not null, b int not null, key(a), key(b))
|
||||
partition by hash(a) partitions 4;
|
||||
insert into t1 values (1,1),(2,2),(3,3),(4,4);
|
||||
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y
|
||||
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
|
||||
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
|
||||
|
||||
drop table t1;
|
||||
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
|
||||
# being fixed.
|
||||
|
Reference in New Issue
Block a user