percentile_disc

Aliases: percentiledisc (deprecated).

percentile_disc(expression: numeric or duration, percentile: const numeric) -> expression

percentile_disc(expression, p) returns one of the non-null input values from expression at the discrete rank implied by p between 0 and 1, without interpolating between neighbors. The returned value has the same type as the input expression. If there is no non-null input in the group the result is null. Discrete percentile behaves differently from percentile and percentile_cont, which approximate or interpolate. Use it in aggregate or within window with the usual window frame rules.

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 disc:percentile_disc(error_count, 0.5), group_by(service)

Returns an actual sampled error_count value at the discrete half quantile for each service group.

make_col wd:window(percentile_disc(payload_bytes, 0.95), group_by(conn_id), order_by(valid_from), frame(back:30m))

Discrete 95th percentile of payload_bytes inside a thirty-minute analytic frame per connection.