ClickHouse/tests/queries/0_stateless/00325_replacing_merge_tree.sql.disabled

97 lines
4.0 KiB
Plaintext
Raw Normal View History

DROP TABLE IF EXISTS replacing;
CREATE TABLE replacing (d Date, k UInt64, s String, v UInt16) ENGINE = ReplacingMergeTree(d, k, 8192, v);
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
DROP TABLE replacing;
2016-04-15 19:37:19 +00:00
DROP TABLE IF EXISTS replacing;
CREATE TABLE replacing (d Date, k UInt64, s String, v UInt16) ENGINE = ReplacingMergeTree(d, k, 1, v);
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
DROP TABLE replacing;
2016-04-15 19:37:19 +00:00
DROP TABLE IF EXISTS replacing;
CREATE TABLE replacing (d Date, k UInt64, s String) ENGINE = ReplacingMergeTree(d, k, 2);
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
OPTIMIZE TABLE replacing;
SELECT _part_index, * FROM replacing ORDER BY k, _part_index;
SELECT _part_index, * FROM replacing FINAL ORDER BY k, _part_index;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
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;
2016-04-15 19:37:19 +00:00
DROP TABLE replacing;