Hi Oleg,

Why is the call to Item::date_conds_transformer done after
prune_partitions()? 

This causes partition pruning not to be able to use the conditions:

--source include/have_partition.inc
--source include/have_sequence.inc

create table t1 (
  a datetime,
  key(a)
) partition by range(year(a)) (
partition p0 values less than (2022),
partition p1 values less than (MAXVALUE)
);

insert into t1
select date_add('2020-01-01', interval seq day)
from
  seq_1_to_1000;

explain partitions select * from t1 where year(a) = 2020;

explain partitions delete from t1 where year(a) = 2020;

drop table t1;

Gives:

explain partitions select * from t1 where year(a) = 2020;
id      select_type     table   partitions      type    possible_keys   key     
key_len ref     rows    Extra
1       SIMPLE  t1      p0      range   a       a       6       NULL    348     
Using where; Using index
explain partitions delete from t1 where year(a) = 2020;
id      select_type     table   partitions      type    possible_keys   key     
key_len ref     rows    Extra
1       SIMPLE  t1      p0,p1   ALL     a       NULL    NULL    NULL    1000    
Using where


Note that SELECT uses one partition while DELETE uses two.
Please fix this.

BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net



_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to