mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
25 lines
432 B
SQL
25 lines
432 B
SQL
DROP TABLE IF EXISTS agg;
|
|
|
|
CREATE TABLE agg
|
|
(
|
|
`key` UInt32,
|
|
`ts` DateTime,
|
|
`value` UInt32,
|
|
PROJECTION aaaa
|
|
(
|
|
SELECT
|
|
ts,
|
|
key,
|
|
sum(value)
|
|
GROUP BY ts, key
|
|
)
|
|
)
|
|
ENGINE = MergeTree
|
|
ORDER BY (key, ts);
|
|
|
|
SET max_bytes_before_external_group_by=1;
|
|
|
|
INSERT INTO agg SELECT 1, toDateTime('2021-12-06 00:00:00') + number, number FROM numbers(100000);
|
|
|
|
DROP TABLE agg;
|