CREATE TABLE WatchLog_old(
date Date,
UserId Int64,
EventType String,
Cnt UInt64
)
ENGINE=MergeTree
ORDER BY (date, UserId, EventType);
INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3);
CREATE TABLE WatchLog_new(
date Date,
UserId Int64,
EventType String,
Cnt UInt64
)
ENGINE=MergeTree
PARTITION BY date
ORDER BY (UserId, EventType)
SETTINGS index_granularity=8192;
INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3);
CREATE TABLE WatchLog AS WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog');
SELECT * FROM WatchLog;