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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744357978a4570327.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信