1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-3798: EXPLAIN UPDATE/DELETE

- Handle the case when EXPLAIN UPDATE/DELETE has pruned away all partitions.
This commit is contained in:
Sergey Petrunya
2013-10-05 13:44:01 +04:00
parent 72bc6d7364
commit abcf14e595
7 changed files with 73 additions and 9 deletions

View File

@ -161,3 +161,23 @@ explain extended delete from t2 where a in (3,4);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
drop table t1,t2;
#
# Check the special case where partition pruning removed all partitions
#
create table t1 (a int, b int)
partition by range (a) (
partition p0 values less than (10),
partition p1 values less than (20),
partition p2 values less than (30)
);
insert into t1 values (9,9), (19,19), (29,29);
explain partitions select * from t1 where a in (32,33);
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
explain partitions delete from t1 where a in (32,33);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning
explain partitions update t1 set b=12345 where a in (32,33);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning
drop table t1;

View File

@ -136,3 +136,22 @@ explain extended delete from t2 where a in (3,4);
drop table t1,t2;
--echo #
--echo # Check the special case where partition pruning removed all partitions
--echo #
create table t1 (a int, b int)
partition by range (a) (
partition p0 values less than (10),
partition p1 values less than (20),
partition p2 values less than (30)
);
insert into t1 values (9,9), (19,19), (29,29);
explain partitions select * from t1 where a in (32,33);
explain partitions delete from t1 where a in (32,33);
explain partitions update t1 set b=12345 where a in (32,33);
drop table t1;