2021-12-05 01:15:53 +00:00
|
|
|
drop table if exists ttl_test_02129;
|
2021-12-13 14:21:05 +00:00
|
|
|
|
|
|
|
create table ttl_test_02129(a Int64, b String, d Date)
|
|
|
|
Engine=MergeTree partition by d order by a
|
|
|
|
settings min_bytes_for_wide_part = 0, min_rows_for_wide_part = 0, materialize_ttl_recalculate_only = 0;
|
|
|
|
|
2023-01-16 11:20:54 +00:00
|
|
|
system stop ttl merges ttl_test_02129;
|
|
|
|
|
2021-12-05 01:15:53 +00:00
|
|
|
insert into ttl_test_02129 select number, '', '2021-01-01' from numbers(10);
|
|
|
|
alter table ttl_test_02129 add column c Int64 settings mutations_sync=2;
|
2021-12-13 14:21:05 +00:00
|
|
|
|
2023-01-16 11:20:54 +00:00
|
|
|
insert into ttl_test_02129 select number, '', '2021-01-01', 1 from numbers(10);
|
2021-12-05 01:15:53 +00:00
|
|
|
alter table ttl_test_02129 modify TTL (d + INTERVAL 1 MONTH) DELETE WHERE c=1 settings mutations_sync=2;
|
2021-12-13 14:21:05 +00:00
|
|
|
|
|
|
|
select * from ttl_test_02129 order by a, b, d, c;
|
|
|
|
drop table ttl_test_02129;
|
|
|
|
|
|
|
|
drop table if exists ttl_test_02129;
|
|
|
|
|
|
|
|
select '==========';
|
|
|
|
|
|
|
|
create table ttl_test_02129(a Int64, b String, d Date)
|
|
|
|
Engine=MergeTree partition by d order by a
|
|
|
|
settings min_bytes_for_wide_part = 0, min_rows_for_wide_part = 0, materialize_ttl_recalculate_only = 1;
|
|
|
|
|
2023-01-16 11:20:54 +00:00
|
|
|
system stop ttl merges ttl_test_02129;
|
|
|
|
|
2021-12-13 14:21:05 +00:00
|
|
|
insert into ttl_test_02129 select number, '', '2021-01-01' from numbers(10);
|
|
|
|
alter table ttl_test_02129 add column c Int64 settings mutations_sync=2;
|
|
|
|
|
2023-01-16 11:20:54 +00:00
|
|
|
insert into ttl_test_02129 select number, '', '2021-01-01', 1 from numbers(10);
|
2021-12-13 14:21:05 +00:00
|
|
|
alter table ttl_test_02129 modify TTL (d + INTERVAL 1 MONTH) DELETE WHERE c=1 settings mutations_sync=2;
|
|
|
|
|
2023-01-16 11:20:54 +00:00
|
|
|
select * from ttl_test_02129 order by a, b, d, c;
|
|
|
|
|
|
|
|
select '==========';
|
|
|
|
|
|
|
|
system start ttl merges ttl_test_02129;
|
|
|
|
|
|
|
|
optimize table ttl_test_02129 final;
|
|
|
|
|
2021-12-05 01:15:53 +00:00
|
|
|
select * from ttl_test_02129 order by a, b, d, c;
|
|
|
|
drop table ttl_test_02129;
|