2020-11-17 16:56:36 +00:00
|
|
|
SET optimize_on_insert = 0;
|
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
DROP TABLE IF EXISTS test_00616;
|
|
|
|
DROP TABLE IF EXISTS replacing_00616;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2022-06-23 12:11:16 +00:00
|
|
|
set allow_deprecated_syntax_for_merge_tree=1;
|
2019-06-03 17:36:27 +00:00
|
|
|
CREATE TABLE test_00616
|
2018-04-05 21:36:55 +00:00
|
|
|
(
|
|
|
|
date Date,
|
|
|
|
x Int32,
|
|
|
|
ver UInt64
|
|
|
|
)
|
|
|
|
ENGINE = MergeTree(date, x, 4096);
|
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
INSERT INTO test_00616 VALUES ('2018-03-21', 1, 1), ('2018-03-21', 1, 2);
|
2022-06-23 10:58:34 +00:00
|
|
|
set allow_deprecated_syntax_for_merge_tree=1;
|
2019-06-03 17:36:27 +00:00
|
|
|
CREATE TABLE replacing_00616 ENGINE = ReplacingMergeTree(date, x, 4096, ver) AS SELECT * FROM test_00616;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
SELECT * FROM test_00616 ORDER BY ver;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
SELECT * FROM replacing_00616 ORDER BY ver;
|
|
|
|
SELECT * FROM replacing_00616 FINAL ORDER BY ver;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
OPTIMIZE TABLE replacing_00616 PARTITION '201803' FINAL;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
SELECT * FROM replacing_00616 ORDER BY ver;
|
|
|
|
SELECT * FROM replacing_00616 FINAL ORDER BY ver;
|
2018-04-05 21:36:55 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
DROP TABLE test_00616;
|
|
|
|
DROP TABLE replacing_00616;
|