2019-02-14 08:49:31 +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
|
2019-02-14 08:49:31 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS set_idx;"
|
2019-02-14 08:49:31 +00:00
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -n --query="
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE set_idx
|
2019-02-14 08:49:31 +00:00
|
|
|
(
|
|
|
|
u64 UInt64,
|
|
|
|
i32 Int32,
|
|
|
|
INDEX idx (i32) TYPE set(2) GRANULARITY 1
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
ORDER BY u64
|
2023-02-20 22:43:11 +00:00
|
|
|
SETTINGS index_granularity = 6, index_granularity_bytes = '10Mi';"
|
2019-02-14 08:49:31 +00:00
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query="
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO set_idx
|
2019-02-14 08:49:31 +00:00
|
|
|
SELECT number, number FROM system.numbers LIMIT 100"
|
|
|
|
|
|
|
|
# simple select
|
2019-04-16 14:13:13 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT * FROM set_idx WHERE i32 > 0 FORMAT JSON" | grep "rows_read"
|
2019-02-14 08:49:31 +00:00
|
|
|
|
|
|
|
|
2023-02-20 22:43:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE set_idx;"
|