CREATE TABLE hits_wide AS hits_10m_single ENGINE = MergeTree()
PARTITION BY toYYYYMM(EventDate)
ORDER BY (CounterID, EventDate, intHash32(UserID))
SAMPLE BY intHash32(UserID)
SETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0
CREATE TABLE hits_compact AS hits_10m_single ENGINE = MergeTree()
PARTITION BY toYYYYMM(EventDate)
ORDER BY (CounterID, EventDate, intHash32(UserID))
SAMPLE BY intHash32(UserID)
SETTINGS min_bytes_for_wide_part = '10M'
CREATE TABLE hits_buffer AS hits_10m_single
ENGINE = Buffer(default, hits_wide, 1, 0, 0, 10000, 10000, 0, 0)
1
1
INSERT INTO hits_wide(UserID) SELECT rand() FROM numbers(100)
INSERT INTO hits_compact(UserID) SELECT rand() FROM numbers(1000)
INSERT INTO hits_buffer(UserID) SELECT rand() FROM numbers(100)
DROP TABLE IF EXISTS hits_wide
DROP TABLE IF EXISTS hits_compact
DROP TABLE IF EXISTS hits_buffer