ClickHouse/tests/queries/0_stateless/00325_replacing_merge_tree.sql.disabled
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

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;