approx_percentile()

Get the approximate value at a percentile from a percentile estimate.

approx_percentile(
    percentile DOUBLE PRECISION,
    sketch  uddsketch
) RETURNS DOUBLE PRECISION

Required arguments

NameTypeDescription
approx_percentileDOUBLE PRECISIONThe desired percentile (0.0-1.0) to approximate
sketchUddSketchThe sketch to compute the approx_percentile on, usually from a percentile_agg

Returns

ColumnTypeDescription
approx_percentileDOUBLE PRECISIONThe estimated value at the requested percentile

Sample usage

SELECT
    approx_percentile(0.01, percentile_agg(data))
FROM generate_series(0, 100) data;
approx_percentile
-------------------
             0.999

Found an issue on this page?

Report an issue!

Related Content