И
Size: a a a
И
И
DP
S
S
И
И
CREATE DATABASE IF NOT EXISTS test;
CREATE TABLE test.source(dt Date, key UInt8, cnt UInt64) ENGINE MergeTree PARTITION BY dt ORDER BY key;
CREATE TABLE test.target(dt Date, total_cnt UInt64) ENGINE SummingMergeTree(total_cnt) PARTITION BY dt ORDER BY dt;
CREATE MATERIALIZED VIEW test.mv TO test.target AS SELECT dt, sum(cnt) total_cnt FROM test.source GROUP BY dt;
INSERT INTO test.source VALUES (today(), 1, 10), (today(), 2, 10), (today() - 1, 1, 10);
DP
CREATE DATABASE IF NOT EXISTS test;
CREATE TABLE test.source(dt Date, key UInt8, cnt UInt64) ENGINE MergeTree PARTITION BY dt ORDER BY key;
CREATE TABLE test.target(dt Date, total_cnt UInt64) ENGINE SummingMergeTree(total_cnt) PARTITION BY dt ORDER BY dt;
CREATE MATERIALIZED VIEW test.mv TO test.target AS SELECT dt, sum(cnt) total_cnt FROM test.source GROUP BY dt;
INSERT INTO test.source VALUES (today(), 1, 10), (today(), 2, 10), (today() - 1, 1, 10);
SC
SC
И
DP
SC
N
S
И
DP
DP
ЕА
И