最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

aggregate - Compacting to minmax row on TTL in Clickhouse - Stack Overflow

programmeradmin6浏览0评论

It's rather easy and well documented how to compact the data in clickhouse after TTL, for example from the docs...

CREATE TABLE events
(
    `event` String,
    `time` DateTime,
    `value` UInt64
)
ENGINE = MergeTree
ORDER BY (toDate(time), event)
TTL time + INTERVAL 1 MONTH GROUP BY toDate(time), event SET value = SUM(value)

What I currently fail to grasp is how to compact it down to two rows, instead of one. For example let's say I have only dates and values and want the min and max for the day here instead of the sum. So, for example...

time value
2024-12-24 01:00:00 1
2024-12-24 02:00:00 2
2024-12-24 03:00:00 3
2024-12-24 04:00:00 4
发布评论

评论列表(0)

  1. 暂无评论