median(expression: numeric or duration) -> expression

median(expression) is shorthand for an approximate 0.5 percentile of expression, implemented like percentile with p fixed at one half. Numeric results come out as float64; duration and timestamp inputs keep their temporal type. The value is an approximation, not a guaranteed exact middle element. It supports aggregate and window contexts with the same frame and accelerability considerations as percentile.

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

aggregate med:median(response_time_ms), group_by(api)

Approximate median response time per API endpoint using median in aggregate.