2019-03-05 12:13:49 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table if exists null_lc_set_index;
|
2019-03-05 12:13:49 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE null_lc_set_index (
|
2019-03-05 12:13:49 +00:00
|
|
|
timestamp DateTime,
|
|
|
|
action LowCardinality(Nullable(String)),
|
|
|
|
user LowCardinality(Nullable(String)),
|
|
|
|
INDEX test_user_idx (user) TYPE set(0) GRANULARITY 8192
|
|
|
|
) ENGINE=MergeTree
|
|
|
|
PARTITION BY toYYYYMMDD(timestamp)
|
|
|
|
ORDER BY (timestamp, action, cityHash64(user))
|
|
|
|
SAMPLE BY cityHash64(user);
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO null_lc_set_index VALUES (1550883010, 'subscribe', 'alice');
|
|
|
|
INSERT INTO null_lc_set_index VALUES (1550883020, 'follow', 'bob');
|
2019-03-05 12:13:49 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT action, user FROM null_lc_set_index WHERE user = 'alice';
|
2019-03-05 12:13:49 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table if exists null_lc_set_index;
|
2019-03-05 12:13:49 +00:00
|
|
|
|