layout_suffix HASHED SPARSE_HASHED shards 1 8 16 CREATE TABLE simple_key_dictionary_source_table ( id UInt64, value_int UInt16 ) ENGINE = Memory CREATE TABLE complex_key_dictionary_source_table ( id UInt64, id_key String, value_int UInt64 ) ENGINE = Memory CREATE DICTIONARY IF NOT EXISTS simple_key_{layout_suffix}_dictionary_s{shards} ( id UInt64, value_int UInt64 ) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'simple_key_dictionary_source_table')) LAYOUT({layout_suffix}(SHARDS {shards})) LIFETIME(0) CREATE DICTIONARY IF NOT EXISTS complex_key_{layout_suffix}_dictionary_s{shards} ( id UInt64, id_key String, value_int UInt64 ) PRIMARY KEY id, id_key SOURCE(CLICKHOUSE(TABLE 'complex_key_dictionary_source_table')) LAYOUT(COMPLEX_KEY_{layout_suffix}(SHARDS {shards})) LIFETIME(0) INSERT INTO simple_key_dictionary_source_table SELECT number, number FROM numbers(3_000_000) INSERT INTO complex_key_dictionary_source_table SELECT number, toString(number), number FROM numbers(2_000_000) SYSTEM RELOAD DICTIONARY simple_key_{layout_suffix}_dictionary_s{shards} SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary_s{shards} SYSTEM RELOAD DICTIONARY simple_key_{layout_suffix}_dictionary_s{shards} SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary_s{shards} WITH rand64() % 3_000_000 as key SELECT dictHas('default.simple_key_{layout_suffix}_dictionary_s{shards}', key) FROM numbers(3_000_000) FORMAT Null WITH (rand64() % 2_000_000, toString(rand64() % 2_000_000)) as key SELECT dictHas('default.complex_key_{layout_suffix}_dictionary_s{shards}', key) FROM numbers(2_000_000) FORMAT Null DROP DICTIONARY IF EXISTS simple_key_{layout_suffix}_dictionary_s{shards} DROP DICTIONARY IF EXISTS complex_key_{layout_suffix}_dictionary_s{shards} DROP TABLE IF EXISTS simple_key_dictionary_source_table DROP TABLE IF EXISTS complex_key_dictionary_source_table