clickhouse downsample into OHLC time bar intervals
问题 For a table e.g. containing a date, price timeseries with prices every e.g. millisecond, how can this be downsampled into groups of open high low close (ohlc) rows with time interval e.g. minute? 回答1: While option with arrays will work, the simplest option here is to use use combination of group by timeintervals with min , max , argMin , argMax aggregate functions. SELECT id, minute, max(value) AS high, min(value) AS low, avg(value) AS avg, argMin(value, timestamp) AS first, argMax(value,