mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
add test
This commit is contained in:
parent
6ab029b465
commit
450bcd7f70
@ -1,34 +0,0 @@
|
||||
DROP TABLE IF EXISTS t_ind_merge;
|
||||
|
||||
CREATE TABLE t_ind_merge (a UInt64, b UInt64, c UInt64, d UInt64, INDEX idx_b b TYPE minmax)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY a SETTINGS
|
||||
index_granularity = 64,
|
||||
vertical_merge_algorithm_min_rows_to_activate = 1,
|
||||
vertical_merge_algorithm_min_columns_to_activate = 1,
|
||||
min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO t_ind_merge SELECT number, number, rand(), rand() from numbers(1000);
|
||||
INSERT INTO t_ind_merge SELECT number, number, rand(), rand() from numbers(1000);
|
||||
|
||||
SELECT count() FROM t_ind_merge WHERE b < 100 SETTINGS force_data_skipping_indices = 'idx_b';
|
||||
EXPLAIN indexes = 1 SELECT count() FROM t_ind_merge WHERE b < 100;
|
||||
|
||||
OPTIMIZE TABLE t_ind_merge FINAL;
|
||||
|
||||
SELECT count() FROM t_ind_merge WHERE b < 100 SETTINGS force_data_skipping_indices = 'idx_b';
|
||||
EXPLAIN indexes = 1 SELECT count() FROM t_ind_merge WHERE b < 100;
|
||||
|
||||
DROP TABLE t_ind_merge;
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
WITH
|
||||
(SELECT uuid FROM system.tables WHERE database = currentDatabase() AND table = 't_ind_merge') AS uuid,
|
||||
extractAllGroupsVertical(message, 'containing (\\d+) columns \((\\d+) merged, (\\d+) gathered\)')[1] AS groups
|
||||
SELECT
|
||||
groups[1] AS total,
|
||||
groups[2] AS merged,
|
||||
groups[3] AS gathered
|
||||
FROM system.text_log
|
||||
WHERE query_id = uuid || '::all_1_2_1' AND notEmpty(groups)
|
||||
ORDER BY event_time_microseconds;
|
@ -3,7 +3,7 @@ Expression ((Project names + Projection))
|
||||
Aggregating
|
||||
Expression (Before GROUP BY)
|
||||
Filter ((WHERE + Change column names to column identifiers))
|
||||
ReadFromMergeTree (default.t_ind_merge)
|
||||
ReadFromMergeTree (default.t_ind_merge_1)
|
||||
Indexes:
|
||||
PrimaryKey
|
||||
Condition: true
|
||||
@ -19,7 +19,7 @@ Expression ((Project names + Projection))
|
||||
Aggregating
|
||||
Expression (Before GROUP BY)
|
||||
Filter ((WHERE + Change column names to column identifiers))
|
||||
ReadFromMergeTree (default.t_ind_merge)
|
||||
ReadFromMergeTree (default.t_ind_merge_1)
|
||||
Indexes:
|
||||
PrimaryKey
|
||||
Condition: true
|
||||
@ -30,3 +30,4 @@ Expression ((Project names + Projection))
|
||||
Description: minmax GRANULARITY 1
|
||||
Parts: 1/1
|
||||
Granules: 4/32
|
||||
4 1 3
|
@ -0,0 +1,35 @@
|
||||
DROP TABLE IF EXISTS t_ind_merge_1;
|
||||
|
||||
CREATE TABLE t_ind_merge_1 (a UInt64, b UInt64, c UInt64, d UInt64, INDEX idx_b b TYPE minmax)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY a SETTINGS
|
||||
index_granularity = 64,
|
||||
vertical_merge_algorithm_min_rows_to_activate = 1,
|
||||
vertical_merge_algorithm_min_columns_to_activate = 1,
|
||||
min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO t_ind_merge_1 SELECT number, number, rand(), rand() FROM numbers(1000);
|
||||
INSERT INTO t_ind_merge_1 SELECT number, number, rand(), rand() FROM numbers(1000);
|
||||
|
||||
SELECT count() FROM t_ind_merge_1 WHERE b < 100 SETTINGS force_data_skipping_indices = 'idx_b';
|
||||
EXPLAIN indexes = 1 SELECT count() FROM t_ind_merge_1 WHERE b < 100;
|
||||
|
||||
OPTIMIZE TABLE t_ind_merge_1 FINAL;
|
||||
|
||||
SELECT count() FROM t_ind_merge_1 WHERE b < 100 SETTINGS force_data_skipping_indices = 'idx_b';
|
||||
EXPLAIN indexes = 1 SELECT count() FROM t_ind_merge_1 WHERE b < 100;
|
||||
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
WITH
|
||||
(SELECT uuid FROM system.tables WHERE database = currentDatabase() AND table = 't_ind_merge_1') AS uuid,
|
||||
extractAllGroupsVertical(message, 'containing (\\d+) columns \((\\d+) merged, (\\d+) gathered\)')[1] AS groups
|
||||
SELECT
|
||||
groups[1] AS total,
|
||||
groups[2] AS merged,
|
||||
groups[3] AS gathered
|
||||
FROM system.text_log
|
||||
WHERE query_id = uuid || '::all_1_2_1' AND notEmpty(groups)
|
||||
ORDER BY event_time_microseconds;
|
||||
|
||||
DROP TABLE t_ind_merge_1;
|
@ -0,0 +1 @@
|
||||
6 3 3
|
@ -0,0 +1,41 @@
|
||||
DROP TABLE IF EXISTS t_ind_merge_2;
|
||||
|
||||
CREATE TABLE t_ind_merge_2 (
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
c UInt64,
|
||||
d UInt64,
|
||||
e UInt64,
|
||||
f UInt64,
|
||||
INDEX idx_a a TYPE minmax,
|
||||
INDEX idx_b b TYPE minmax,
|
||||
INDEX idx_cd c * d TYPE minmax,
|
||||
INDEX idx_d1 d TYPE minmax,
|
||||
INDEX idx_d2 d TYPE set(3),
|
||||
INDEX idx_e e TYPE set(3))
|
||||
ENGINE = MergeTree
|
||||
ORDER BY a SETTINGS
|
||||
index_granularity = 64,
|
||||
vertical_merge_algorithm_min_rows_to_activate = 1,
|
||||
vertical_merge_algorithm_min_columns_to_activate = 1,
|
||||
min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO t_ind_merge_2 SELECT number, number, rand(), rand(), rand(), rand() FROM numbers(1000);
|
||||
INSERT INTO t_ind_merge_2 SELECT number, number, rand(), rand(), rand(), rand() FROM numbers(1000);
|
||||
|
||||
OPTIMIZE TABLE t_ind_merge_2 FINAL;
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
--- merged: a, c, d; gathered: b, e, f
|
||||
WITH
|
||||
(SELECT uuid FROM system.tables WHERE database = currentDatabase() AND table = 't_ind_merge_2') AS uuid,
|
||||
extractAllGroupsVertical(message, 'containing (\\d+) columns \((\\d+) merged, (\\d+) gathered\)')[1] AS groups
|
||||
SELECT
|
||||
groups[1] AS total,
|
||||
groups[2] AS merged,
|
||||
groups[3] AS gathered
|
||||
FROM system.text_log
|
||||
WHERE query_id = uuid || '::all_1_2_1' AND notEmpty(groups)
|
||||
ORDER BY event_time_microseconds;
|
||||
|
||||
DROP TABLE t_ind_merge_2;
|
Loading…
Reference in New Issue
Block a user