timeSeriesLastTwoSamples
Introduced in: v25.6.0 Aggregate function for re-sampling time series data for PromQL-like irate and idelta calculation. Aggregate function that takes time series data as pairs of timestamps and values and stores only at most 2 recent samples. This aggregate function is intended to be used with a Materialized View and Aggregated table that stores re-sampled time series data for grid-aligned timestamps. The aggregated table stores only last 2 values for each aligned timestamp. This allows to calculate PromQL-likeirate and idelta by reading much less data then is stored in the raw table.
Syntax
timestamp— Timestamp of the sample.DateTimeorDateTime64or(U)Int*orInt*value— Value of the time series corresponding to the timestamp.Float32orFloat64
Tuple(Array(DateTime), Array(Float64))
Examples
Example table for raw data, and a table for storing re-sampled data
Query
Response
Query
Response
Query
Response
Query
Response