diff --git a/tests/performance/hashed_dictionary.xml b/tests/performance/hashed_dictionary.xml index cf1cdac6df1..01ee35c8ed4 100644 --- a/tests/performance/hashed_dictionary.xml +++ b/tests/performance/hashed_dictionary.xml @@ -1,72 +1,4 @@ - - CREATE TABLE simple_key_hashed_dictionary_source_table - ( - id UInt64, - value_int UInt64, - value_string String, - value_decimal Decimal64(8), - value_string_nullable Nullable(String) - ) ENGINE = Memory; - - - - CREATE TABLE complex_key_hashed_dictionary_source_table - ( - id UInt64, - id_key String, - value_int UInt64, - value_string String, - value_decimal Decimal64(8), - value_string_nullable Nullable(String) - ) ENGINE = Memory; - - - - CREATE DICTIONARY simple_key_hashed_dictionary - ( - id UInt64, - value_int UInt64, - value_string String, - value_decimal Decimal64(8), - value_string_nullable Nullable(String) - ) - PRIMARY KEY id - SOURCE(CLICKHOUSE(DB 'default' TABLE 'simple_key_hashed_dictionary_source_table')) - LAYOUT(HASHED()) - LIFETIME(MIN 0 MAX 1000); - - - - CREATE DICTIONARY complex_key_hashed_dictionary - ( - id UInt64, - id_key String, - value_int UInt64, - value_string String, - value_decimal Decimal64(8), - value_string_nullable Nullable(String) - ) - PRIMARY KEY id, id_key - SOURCE(CLICKHOUSE(DB 'default' TABLE 'complex_key_hashed_dictionary_source_table')) - LAYOUT(COMPLEX_KEY_HASHED()) - LIFETIME(MIN 0 MAX 1000); - - - - INSERT INTO simple_key_hashed_dictionary_source_table - SELECT number, number, toString(number), toDecimal64(number, 8), toString(number) - FROM system.numbers - LIMIT 5000000; - - - - INSERT INTO complex_key_hashed_dictionary_source_table - SELECT number, toString(number), number, toString(number), toDecimal64(number, 8), toString(number) - FROM system.numbers - LIMIT 5000000; - - column_name @@ -85,54 +17,129 @@ 7500000 + + + layout_suffix + + HASHED + SPARSE_HASHED + + + + CREATE TABLE simple_key_dictionary_source_table + ( + id UInt64, + value_int UInt64, + value_string String, + value_decimal Decimal64(8), + value_string_nullable Nullable(String) + ) ENGINE = Memory + + + + CREATE TABLE complex_key_dictionary_source_table + ( + id UInt64, + id_key String, + value_int UInt64, + value_string String, + value_decimal Decimal64(8), + value_string_nullable Nullable(String) + ) ENGINE = Memory + + + + CREATE DICTIONARY IF NOT EXISTS simple_key_{layout_suffix}_dictionary + ( + id UInt64, + value_int UInt64, + value_string String, + value_decimal Decimal64(8), + value_string_nullable Nullable(String) + ) + PRIMARY KEY id + SOURCE(CLICKHOUSE(TABLE 'simple_key_dictionary_source_table')) + LAYOUT({layout_suffix}()) + LIFETIME(0) + + + + CREATE DICTIONARY IF NOT EXISTS complex_key_{layout_suffix}_dictionary + ( + id UInt64, + id_key String, + value_int UInt64, + value_string String, + value_decimal Decimal64(8), + value_string_nullable Nullable(String) + ) + PRIMARY KEY id, id_key + SOURCE(CLICKHOUSE(TABLE 'complex_key_dictionary_source_table')) + LAYOUT(COMPLEX_KEY_{layout_suffix}()) + LIFETIME(0) + + + + INSERT INTO simple_key_dictionary_source_table + SELECT number, number, toString(number), toDecimal64(number, 8), toString(number) + FROM system.numbers + LIMIT 5000000 + + + + INSERT INTO complex_key_dictionary_source_table + SELECT number, toString(number), number, toString(number), toDecimal64(number, 8), toString(number) + FROM system.numbers + LIMIT 5000000 + + + SYSTEM RELOAD DICTIONARY simple_key_{layout_suffix}_dictionary + SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary + + SYSTEM RELOAD DICTIONARY simple_key_{layout_suffix}_dictionary + SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary + WITH rand64() % toUInt64({elements_count}) as key - SELECT dictGet('default.simple_key_hashed_dictionary', {column_name}, key) + SELECT dictGet('default.simple_key_{layout_suffix}_dictionary', {column_name}, key) FROM system.numbers LIMIT {elements_count} - FORMAT Null; + FORMAT Null WITH rand64() % toUInt64({elements_count}) as key - SELECT dictHas('default.simple_key_hashed_dictionary', key) + SELECT dictHas('default.simple_key_{layout_suffix}_dictionary', key) FROM system.numbers LIMIT {elements_count} - FORMAT Null; + FORMAT Null + SELECT * FROM simple_key_{layout_suffix}_dictionary FORMAT Null + - SELECT * FROM simple_key_hashed_dictionary - FORMAT Null; + WITH (rand64() % toUInt64({elements_count}), toString(rand64() % toUInt64({elements_count}))) as key + SELECT dictGet('default.complex_key_{layout_suffix}_dictionary', {column_name}, key) + FROM system.numbers + LIMIT {elements_count} + FORMAT Null WITH (rand64() % toUInt64({elements_count}), toString(rand64() % toUInt64({elements_count}))) as key - SELECT dictGet('default.complex_key_hashed_dictionary', {column_name}, key) + SELECT dictHas('default.complex_key_{layout_suffix}_dictionary', key) FROM system.numbers LIMIT {elements_count} - FORMAT Null; + FORMAT Null - - WITH (rand64() % toUInt64({elements_count}), toString(rand64() % toUInt64({elements_count}))) as key - SELECT dictHas('default.complex_key_hashed_dictionary', key) - FROM system.numbers - LIMIT {elements_count} - FORMAT Null; - + SELECT * FROM complex_key_{layout_suffix}_dictionary FORMAT Null - - SELECT * FROM complex_key_hashed_dictionary - FORMAT Null; - - - DROP TABLE IF EXISTS simple_key_hashed_dictionary_source_table; - DROP TABLE IF EXISTS complex_key_hashed_dictionary_source_table; - - DROP DICTIONARY IF EXISTS simple_key_hashed_dictionary; - DROP DICTIONARY IF EXISTS complex_key_hashed_dictionary; + DROP TABLE IF EXISTS simple_key_dictionary_source_table + DROP TABLE IF EXISTS complex_key_dictionary_source_table + DROP DICTIONARY IF EXISTS simple_key_{layout_suffix}_dictionary + DROP DICTIONARY IF EXISTS complex_key_{layout_suffix}_dictionary