mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-06 07:32:27 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
101 lines
3.4 KiB
SQL
101 lines
3.4 KiB
SQL
DROP TABLE IF EXISTS merge;
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
|
|
|
|
INSERT INTO merge (x) VALUES (1), (2), (3);
|
|
INSERT INTO merge (x) VALUES (4), (5), (6);
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
|
|
|
|
INSERT INTO merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number + 10 AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
|
|
|
|
INSERT INTO merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
|
|
|
|
INSERT INTO merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number + 9 AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
|
|
|
|
INSERT INTO merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
|
|
INSERT INTO merge (x) SELECT number + 10 AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
INSERT INTO merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
INSERT INTO merge (x) SELECT number + 100 AS x FROM system.numbers LIMIT 10;
|
|
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
OPTIMIZE TABLE merge;
|
|
SELECT * FROM merge ORDER BY _part_index, x;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 8192);
|
|
|
|
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
|
|
SET max_block_size = 8200;
|
|
INSERT INTO merge (x) SELECT number AS x FROM (SELECT * FROM system.numbers LIMIT 8200) ORDER BY rand();
|
|
INSERT INTO merge (x) SELECT number AS x FROM (SELECT * FROM system.numbers LIMIT 8200) ORDER BY rand();
|
|
|
|
OPTIMIZE TABLE merge;
|
|
|
|
SELECT count(), uniqExact(x), min(x), max(x), sum(x), sum(cityHash64(x)) FROM merge;
|
|
|
|
DROP TABLE merge;
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 8192);
|
|
|
|
SET max_block_size = 10000;
|
|
INSERT INTO merge (x) SELECT number AS x FROM (SELECT number FROM system.numbers LIMIT 10000);
|
|
INSERT INTO merge (x) SELECT number AS x FROM (SELECT number + 5000 AS number FROM system.numbers LIMIT 10000);
|
|
|
|
OPTIMIZE TABLE merge;
|
|
|
|
SELECT count(), uniqExact(x), min(x), max(x), sum(x), sum(cityHash64(x)) FROM merge;
|
|
|
|
DROP TABLE merge;
|