2020-06-30 15:33:16 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2020-06-30 15:33:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --multiquery <<EOF
|
2020-07-01 10:01:47 +00:00
|
|
|
DROP TABLE IF EXISTS pk_in_tuple_perf;
|
2020-06-30 15:33:16 +00:00
|
|
|
CREATE TABLE pk_in_tuple_perf
|
|
|
|
(
|
|
|
|
v UInt64,
|
|
|
|
u UInt32
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
ORDER BY v
|
|
|
|
SETTINGS index_granularity = 1;
|
|
|
|
|
|
|
|
INSERT INTO pk_in_tuple_perf SELECT number, number * 10 FROM numbers(100);
|
|
|
|
EOF
|
|
|
|
|
|
|
|
query="SELECT count() FROM pk_in_tuple_perf WHERE (v, u) IN ((2, 10), (2, 20))"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "$query"
|
2020-06-30 16:43:45 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "$query FORMAT JSON" | grep "rows_read"
|
2020-07-01 10:01:47 +00:00
|
|
|
|
|
|
|
## Test with non-const args in tuple
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --multiquery <<EOF
|
|
|
|
DROP TABLE IF EXISTS pk_in_tuple_perf_non_const;
|
|
|
|
CREATE TABLE pk_in_tuple_perf_non_const
|
|
|
|
(
|
|
|
|
d Date,
|
|
|
|
u UInt32
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
ORDER BY (u, d)
|
|
|
|
SETTINGS index_granularity = 1;
|
|
|
|
|
|
|
|
INSERT INTO pk_in_tuple_perf_non_const SELECT today() - number, number FROM numbers(100);
|
|
|
|
EOF
|
|
|
|
|
|
|
|
query="SELECT count() FROM pk_in_tuple_perf_non_const WHERE (u, d) IN ((0, today()), (1, today()))"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "$query"
|
|
|
|
$CLICKHOUSE_CLIENT --query "$query FORMAT JSON" | grep "rows_read"
|
2020-12-04 02:15:44 +00:00
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE pk_in_tuple_perf"
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE pk_in_tuple_perf_non_const"
|