2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: no-parallel
|
|
|
|
|
2020-09-17 18:57:57 +00:00
|
|
|
CREATE DATABASE IF NOT EXISTS db_dict;
|
|
|
|
DROP DICTIONARY IF EXISTS db_dict.cache_hits;
|
|
|
|
|
2020-12-18 13:26:11 +00:00
|
|
|
CREATE DICTIONARY db_dict.cache_hits
|
|
|
|
(WatchID UInt64, UserID UInt64, SearchPhrase String)
|
|
|
|
PRIMARY KEY WatchID
|
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'hits' PASSWORD '' DB 'test'))
|
|
|
|
LIFETIME(MIN 300 MAX 600)
|
2021-02-15 11:27:16 +00:00
|
|
|
LAYOUT(CACHE(SIZE_IN_CELLS 100 QUERY_WAIT_TIMEOUT_MILLISECONDS 600000));
|
2020-09-17 18:57:57 +00:00
|
|
|
|
2021-02-15 11:27:16 +00:00
|
|
|
SELECT sum(flag) FROM (SELECT dictHas('db_dict.cache_hits', toUInt64(WatchID)) as flag FROM test.hits PREWHERE WatchID % 1400 == 0 LIMIT 100);
|
2020-09-17 18:57:57 +00:00
|
|
|
SELECT count() from test.hits PREWHERE WatchID % 1400 == 0;
|
|
|
|
|
2021-02-15 11:27:16 +00:00
|
|
|
SELECT sum(flag) FROM (SELECT dictHas('db_dict.cache_hits', toUInt64(WatchID)) as flag FROM test.hits PREWHERE WatchID % 350 == 0 LIMIT 100);
|
2020-09-17 18:57:57 +00:00
|
|
|
SELECT count() from test.hits PREWHERE WatchID % 350 == 0;
|
|
|
|
|
2021-02-15 11:27:16 +00:00
|
|
|
SELECT sum(flag) FROM (SELECT dictHas('db_dict.cache_hits', toUInt64(WatchID)) as flag FROM test.hits PREWHERE WatchID % 5 == 0 LIMIT 100);
|
2020-09-17 18:57:57 +00:00
|
|
|
SELECT count() from test.hits PREWHERE WatchID % 5 == 0;
|
|
|
|
|
|
|
|
DROP DICTIONARY IF EXISTS db_dict.cache_hits;
|
|
|
|
DROP DATABASE IF EXISTS db_dict;
|