Test with sparse serialization, vertical merge and skip indices

This commit is contained in:
Alexander Gololobov 2024-09-10 20:57:03 +02:00
parent bb82465a5f
commit 2f15fcd23f
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
key Sparse
value Sparse
1000
1

View File

@ -0,0 +1,45 @@
DROP TABLE IF EXISTS t_bloom_filter;
CREATE TABLE t_bloom_filter(
key UInt64,
value UInt64,
INDEX key_bf key TYPE bloom_filter(0.01) GRANULARITY 2147483648, -- bloom filter on sorting key column
INDEX value_bf value TYPE bloom_filter(0.01) GRANULARITY 2147483648 -- bloom filter on no-sorting column
) ENGINE=MergeTree ORDER BY key
SETTINGS
-- settings to trigger sparse serialization and vertical merge
ratio_of_defaults_for_sparse_serialization = 0.0
,vertical_merge_algorithm_min_rows_to_activate = 1
,vertical_merge_algorithm_min_columns_to_activate = 1
,allow_vertical_merges_from_compact_to_wide_parts = 1
,min_bytes_for_wide_part=0
;
SYSTEM STOP MERGES t_bloom_filter;
-- Create at least one part
INSERT INTO t_bloom_filter
SELECT
number % 100 as key, -- 100 unique keys
rand() % 100 as value -- 100 unique values
FROM numbers(50_000);
-- And another part
INSERT INTO t_bloom_filter
SELECT
number % 100 as key, -- 100 unique keys
rand() % 100 as value -- 100 unique values
FROM numbers(50_000, 50_000);
SYSTEM START MERGES t_bloom_filter;
-- Merge everything into a single part
OPTIMIZE TABLE t_bloom_filter FINAL;
-- Check sparse serialization
SELECT column, serialization_kind FROM system.parts_columns WHERE database = currentDatabase() AND table = 't_bloom_filter' AND active ORDER BY column;
SELECT COUNT() FROM t_bloom_filter WHERE key = 1;
-- Check bloom filter non-zero size
SELECT COUNT() FROM system.parts WHERE database = currentDatabase() AND table = 't_bloom_filter' AND secondary_indices_uncompressed_bytes > 200 AND active;