1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-18501 Partition pruning doesn't work for historical queries (refactoring)

SYSTEM_TYPE partitioning: COLUMN properties removed. Partitioning is
now pure RANGE based on UNIX_TIMESTAMP(row_end).

DECIMAL type is now allowed as RANGE partitioning, we can partition by
UNIX_TIMESTAMP() (but not for DATETIME which depends on local timezone
of course).
This commit is contained in:
Aleksey Midenkov
2019-08-28 11:57:16 +03:00
parent a3e49c0d36
commit c3f35ea55a
7 changed files with 83 additions and 40 deletions

View File

@ -981,4 +981,31 @@ a MAX(b)
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
#
# MDEV-18501 Partition pruning doesn't work for historical queries
#
set time_zone= '+00:00';
create or replace table t1 (d datetime(6))
partition by range (unix_timestamp(d)) (
partition p0 values less than (1),
partition p1 values less than (maxvalue));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
# DECIMAL functions are now allowed, partitioning is done by integer part
create or replace table t1 (d timestamp(6))
partition by range (unix_timestamp(d)) (
partition p0 values less than (946684801),
partition p1 values less than (maxvalue));
insert into t1 values
# go to p0
('2000-01-01 00:00:00'),
('2000-01-01 00:00:00.000001'),
# goes to p1
('2000-01-01 00:00:01');
select * from t1 partition (p0);
d
2000-01-01 00:00:00.000000
2000-01-01 00:00:00.000001
select * from t1 partition (p1);
d
2000-01-01 00:00:01.000000
DROP TABLE t1, t2;