2020-10-13 18:25:45 +00:00
|
|
|
DROP TABLE IF EXISTS optimize_final;
|
|
|
|
|
2020-11-20 14:29:13 +00:00
|
|
|
SET optimize_skip_merged_partitions=1;
|
|
|
|
|
|
|
|
CREATE TABLE optimize_final(t DateTime, x Int32) ENGINE = MergeTree() PARTITION BY toYYYYMM(t) ORDER BY x;
|
2020-10-13 18:25:45 +00:00
|
|
|
|
2020-11-10 21:02:11 +00:00
|
|
|
INSERT INTO optimize_final SELECT toDate('2020-01-01'), number FROM numbers(5);
|
|
|
|
INSERT INTO optimize_final SELECT toDate('2020-01-01'), number + 5 FROM numbers(5);
|
2020-10-13 18:25:45 +00:00
|
|
|
|
|
|
|
OPTIMIZE TABLE optimize_final FINAL;
|
|
|
|
|
2020-11-10 21:02:11 +00:00
|
|
|
INSERT INTO optimize_final SELECT toDate('2000-01-01'), number FROM numbers(5);
|
|
|
|
INSERT INTO optimize_final SELECT toDate('2000-01-01'), number + 5 FROM numbers(5);
|
2020-10-13 18:25:45 +00:00
|
|
|
|
|
|
|
OPTIMIZE TABLE optimize_final FINAL;
|
|
|
|
|
2021-05-22 05:43:24 +00:00
|
|
|
SELECT table, partition, active, level from system.parts where table = 'optimize_final' and database = currentDatabase() and active = 1;
|
2020-10-13 18:25:45 +00:00
|
|
|
|
|
|
|
DROP TABLE optimize_final;
|
|
|
|
|