mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
3c43914f9a
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
23 lines
1.1 KiB
Bash
Executable File
23 lines
1.1 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
|
|
|
|
${CLICKHOUSE_CLIENT} --multiquery --query "
|
|
drop table if exists aliases_lazyness;
|
|
create table aliases_lazyness (x UInt32, y ALIAS sleepEachRow(0.1)) Engine=MergeTree ORDER BY x;
|
|
insert into aliases_lazyness(x) select * from numbers(100);
|
|
"
|
|
|
|
# In very old ClickHouse versions alias column was calculated for every row.
|
|
# If it works this way, the query will take at least 0.1 * 100 = 10 seconds.
|
|
# If the issue does not exist, the query should call sleepEachRow() "only" 4 times:
|
|
# - from MergeTreeData::getQueryProcessingStageWithAggregateProjection() -> MergeTreeWhereOptimizer -> getBlockWithConstants()
|
|
# - from MergeTreeWhereOptimizer -> getBlockWithConstants()
|
|
# - ReadFromMergeTree::selectRangesToRead() -> getBlockWithConstants()
|
|
# - Pipeline
|
|
${CLICKHOUSE_CLIENT} --profile-events-delay-ms=-1 --print-profile-events --query "SELECT x, y FROM aliases_lazyness WHERE x = 1 FORMAT Null" |& grep -o -e "SleepFunctionMicroseconds.*" -e "SleepFunctionCalls.*"
|
|
|
|
${CLICKHOUSE_CLIENT} --query "drop table aliases_lazyness"
|