mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 11:04:10 +00:00
97 lines
4.0 KiB
Plaintext
97 lines
4.0 KiB
Plaintext
DROP TABLE IF EXISTS replacing;
|
|
CREATE TABLE replacing (d Date, k UInt64, s String, v UInt16) ENGINE = ReplacingMergeTree(d, k, 8192, v);
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello', 0);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'World', 0);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello', 10);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello!', 9);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'abc', 1);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'def', 1);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'ghi', 0);
|
|
SELECT * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing;
|
|
OPTIMIZE TABLE replacing;
|
|
OPTIMIZE TABLE replacing;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
DROP TABLE replacing;
|
|
|
|
|
|
DROP TABLE IF EXISTS replacing;
|
|
CREATE TABLE replacing (d Date, k UInt64, s String, v UInt16) ENGINE = ReplacingMergeTree(d, k, 1, v);
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello', 0);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'World', 0);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello', 10);
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello!', 9);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'abc', 1);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'def', 1);
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'ghi', 0);
|
|
SELECT * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing PARTITION 200001 FINAL;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, v, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, v, _part_index;
|
|
|
|
DROP TABLE replacing;
|
|
|
|
|
|
DROP TABLE IF EXISTS replacing;
|
|
CREATE TABLE replacing (d Date, k UInt64, s String) ENGINE = ReplacingMergeTree(d, k, 2);
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello');
|
|
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'World');
|
|
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello');
|
|
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
INSERT INTO replacing VALUES ('2000-01-01', 1, 'Hello!');
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'abc');
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'def');
|
|
INSERT INTO replacing VALUES ('2000-01-01', 2, 'ghi');
|
|
SELECT * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
OPTIMIZE TABLE replacing PARTITION 200001 FINAL;
|
|
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
|
|
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
|
|
|
|
DROP TABLE replacing;
|