ClickHouse/tests/queries/0_stateless/00976_ttl_with_old_parts.sql

19 lines
638 B
MySQL
Raw Normal View History

2021-09-12 12:35:27 +00:00
-- Tags: no-parallel
drop table if exists ttl;
2020-11-15 02:24:47 +00:00
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d) settings remove_empty_parts = 0;
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 3);
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 4);
alter table ttl modify ttl d + interval 1 day;
select sleep(1) format Null; -- wait if very fast merge happen
optimize table ttl partition 10 final;
2022-02-02 19:50:33 +00:00
select * from ttl order by d, a;
drop table if exists ttl;