tdigest_agg(value: numeric or duration) -> tdigest of float64

Builds a tdigest state from many numeric or duration samples in each aggregate window. It is both an aggregate and a window-capable function and produces an approximate percentile sketch. The returned digest’s inner numeric type matches the argument type (for example duration in yields duration-bearing digest typing). Follow with tdigest_quantile or histogram_quantile when you need a scalar estimate, or tdigest_combine to merge digests across sub-aggregations.

Domain

This is an aggregate function (aggregates rows over a group in aggregate verbs).

This is a window function (calculates over a group of multiple input rows using windowing).

Categories

Examples

align 1m, frame(back: 1m), o: tdigest_agg(latency_ms)

Builds a digest from raw millisecond samples for each aligned minute using the approximate percentile accumulator.

align 5m, frame(back: 5m), o: tdigest_quantile(tdigest_agg(duration), 0.99)

Chains aggregation to a digest and immediately estimates the 99th percentile of durations within each bin.