layout_suffix
HASHED
SPARSE_HASHED
load_factor
5
7
99
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_l0_{load_factor}
(
id UInt64,
value_int UInt64
)
PRIMARY KEY id
SOURCE(CLICKHOUSE(TABLE 'simple_key_dictionary_source_table'))
LAYOUT({layout_suffix}(MAX_LOAD_FACTOR 0.{load_factor}))
LIFETIME(0)
CREATE DICTIONARY IF NOT EXISTS complex_key_{layout_suffix}_dictionary_l0_{load_factor}
(
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}(MAX_LOAD_FACTOR 0.{load_factor}))
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_l0_{load_factor}
SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary_l0_{load_factor}
SYSTEM RELOAD DICTIONARY simple_key_{layout_suffix}_dictionary_l0_{load_factor}
SYSTEM RELOAD DICTIONARY complex_key_{layout_suffix}_dictionary_l0_{load_factor}
WITH rand64() % 3_000_000 as key
SELECT dictHas('default.simple_key_{layout_suffix}_dictionary_l0_{load_factor}', 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_l0_{load_factor}', key)
FROM numbers(2_000_000)
FORMAT Null
DROP DICTIONARY simple_key_{layout_suffix}_dictionary_l0_{load_factor}
DROP DICTIONARY complex_key_{layout_suffix}_dictionary_l0_{load_factor}
DROP TABLE simple_key_dictionary_source_table
DROP TABLE complex_key_dictionary_source_table