2022-10-28 23:26:06 +00:00
|
|
|
-- Tags: no-random-merge-tree-settings
|
|
|
|
|
2020-02-11 18:05:08 +00:00
|
|
|
DROP TABLE IF EXISTS set_array;
|
2019-08-24 22:01:36 +00:00
|
|
|
|
2020-02-11 18:05:08 +00:00
|
|
|
CREATE TABLE set_array
|
2019-08-24 22:01:36 +00:00
|
|
|
(
|
|
|
|
primary_key String,
|
|
|
|
index_array Array(UInt64),
|
|
|
|
INDEX additional_index_array (index_array) TYPE set(10000) GRANULARITY 1
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
ORDER BY (primary_key);
|
|
|
|
|
2020-02-11 18:05:08 +00:00
|
|
|
INSERT INTO set_array
|
2019-08-24 22:01:36 +00:00
|
|
|
select
|
2024-07-21 07:06:45 +00:00
|
|
|
toString(intDiv(number, 100000)) as primary_key,
|
2019-08-24 22:01:36 +00:00
|
|
|
array(number) as index_array
|
|
|
|
from system.numbers
|
2024-07-21 07:06:45 +00:00
|
|
|
limit 1000000;
|
2019-08-24 22:01:36 +00:00
|
|
|
|
2024-03-16 12:57:40 +00:00
|
|
|
OPTIMIZE TABLE set_array FINAL;
|
|
|
|
|
2019-08-24 22:01:36 +00:00
|
|
|
SET max_rows_to_read = 8192;
|
|
|
|
|
2020-02-11 18:05:08 +00:00
|
|
|
select count() from set_array where has(index_array, 333);
|
2019-08-24 22:01:36 +00:00
|
|
|
|
2020-02-11 18:05:08 +00:00
|
|
|
DROP TABLE set_array;
|