dbms: added test for merges [#METR-19025].

This commit is contained in:
Alexey Milovidov 2015-11-27 23:48:55 +03:00
parent fb88629d67
commit 7e5b79fbe9
2 changed files with 493 additions and 0 deletions

View File

@ -0,0 +1,394 @@
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 5
2000-01-01 6
2000-01-01 7
2000-01-01 8
2000-01-01 9
2000-01-01 10
2000-01-01 11
2000-01-01 12
2000-01-01 13
2000-01-01 14
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 100
2000-01-01 101
2000-01-01 102
2000-01-01 103
2000-01-01 104
2000-01-01 105
2000-01-01 106
2000-01-01 107
2000-01-01 108
2000-01-01 109
2000-01-01 0
2000-01-01 1
2000-01-01 2
2000-01-01 3
2000-01-01 4
2000-01-01 5
2000-01-01 5
2000-01-01 5
2000-01-01 6
2000-01-01 6
2000-01-01 6
2000-01-01 7
2000-01-01 7
2000-01-01 7
2000-01-01 8
2000-01-01 8
2000-01-01 8
2000-01-01 9
2000-01-01 9
2000-01-01 9
2000-01-01 10
2000-01-01 10
2000-01-01 10
2000-01-01 11
2000-01-01 11
2000-01-01 11
2000-01-01 12
2000-01-01 12
2000-01-01 12
2000-01-01 13
2000-01-01 13
2000-01-01 13
2000-01-01 14
2000-01-01 14
2000-01-01 14
2000-01-01 15
2000-01-01 16
2000-01-01 17
2000-01-01 18
2000-01-01 19
2000-01-01 100
2000-01-01 101
2000-01-01 102
2000-01-01 103
2000-01-01 104
2000-01-01 105
2000-01-01 106
2000-01-01 107
2000-01-01 108
2000-01-01 109
16400 8200 0 8199 67231800 4574870733220668470
20000 15000 0 14999 149990000 5561824225056413482

View File

@ -0,0 +1,99 @@
DROP TABLE IF EXISTS test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
INSERT INTO test.merge (x) VALUES (1), (2), (3);
INSERT INTO test.merge (x) VALUES (4), (5), (6);
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
INSERT INTO test.merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number + 10 AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
INSERT INTO test.merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
INSERT INTO test.merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number + 9 AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 5);
INSERT INTO test.merge (x) SELECT number AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
INSERT INTO test.merge (x) SELECT number + 10 AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
INSERT INTO test.merge (x) SELECT number + 5 AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
INSERT INTO test.merge (x) SELECT number + 100 AS x FROM system.numbers LIMIT 10;
SELECT * FROM test.merge ORDER BY _part_index, x;
OPTIMIZE TABLE test.merge;
SELECT * FROM test.merge ORDER BY _part_index, x;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 8192);
SET max_block_size = 8200;
INSERT INTO test.merge (x) SELECT number AS x FROM (SELECT * FROM system.numbers LIMIT 8200) ORDER BY rand();
INSERT INTO test.merge (x) SELECT number AS x FROM (SELECT * FROM system.numbers LIMIT 8200) ORDER BY rand();
OPTIMIZE TABLE test.merge;
SELECT count(), uniqExact(x), min(x), max(x), sum(x), sum(cityHash64(x)) FROM test.merge;
DROP TABLE test.merge;
CREATE TABLE IF NOT EXISTS test.merge (d Date DEFAULT '2000-01-01', x UInt64) ENGINE = MergeTree(d, x, 8192);
SET max_block_size = 10000;
INSERT INTO test.merge (x) SELECT number AS x FROM (SELECT number FROM system.numbers LIMIT 10000);
INSERT INTO test.merge (x) SELECT number AS x FROM (SELECT number + 5000 AS number FROM system.numbers LIMIT 10000);
OPTIMIZE TABLE test.merge;
SELECT count(), uniqExact(x), min(x), max(x), sum(x), sum(cityHash64(x)) FROM test.merge;
DROP TABLE test.merge;