mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 22:12:21 +00:00
4366f7fb3b
It does not give significant benefit, but now, you hashed/sparse_hashed dictionaries can be filled in parallel (#40003), using sharded dictionaries, and this should be used instead of PREALLOCATE. Note, that dictionaries, that had been created with PREALLOCATE will work, but simply ignore this attribute. Fixes: #41985 (cc @alexey-milovidov) Reverts: #23979 (cc @kitaisreal) Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
# shellcheck source=../shell_config.sh
|
|
. "$CUR_DIR"/../shell_config.sh
|
|
|
|
|
|
# In [1] PREALLOCATE attribute had been added for HASHED dictionaries,
|
|
# but it had been removed in [2].
|
|
#
|
|
# [1]: https://github.com/ClickHouse/ClickHouse/pull/23979
|
|
# [2]: https://github.com/ClickHouse/ClickHouse/pull/45388
|
|
#
|
|
# This is a backward compatiblity test that you can create dictionary with
|
|
# PREALLOCATE attribute (and also for the history/greppability, that it was
|
|
# such).
|
|
|
|
$CLICKHOUSE_CLIENT -nm -q "
|
|
DROP TABLE IF EXISTS data_01509;
|
|
DROP DICTIONARY IF EXISTS dict_01509;
|
|
CREATE TABLE data_01509
|
|
(
|
|
key UInt64,
|
|
value String
|
|
)
|
|
ENGINE = MergeTree()
|
|
ORDER BY key;
|
|
INSERT INTO data_01509 SELECT number key, toString(number) value FROM numbers(10e3);
|
|
|
|
CREATE DICTIONARY dict_01509
|
|
(
|
|
key UInt64,
|
|
value String DEFAULT '-'
|
|
)
|
|
PRIMARY KEY key
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() TABLE 'data_01509'))
|
|
LAYOUT(SPARSE_HASHED(PREALLOCATE 1))
|
|
LIFETIME(0);
|
|
SYSTEM RELOAD DICTIONARY dict_01509;
|
|
" |& grep -o "HashedDictionary: .*"
|