approx_percentile_rank()

Estimate what percentile a given value would be located at in a UddSketch.

approx_percentile_rank(
    value DOUBLE PRECISION,
    sketch UddSketch
) RETURNS UddSketch

Required arguments

NameTypeDescription
valueDOUBLE PRECISIONThe value to estimate the percentile of
sketchUddSketchThe sketch to compute the percentile on.

Returns

ColumnTypeDescription
approx_percentile_rankDOUBLE PRECISIONThe estimated percentile associated with the provided value

Sample usage

SELECT
    approx_percentile_rank(99, percentile_agg(data))
FROM generate_series(0, 100) data;
approx_percentile_rank
----------------------------
         0.9851485148514851

Found an issue on this page?

Report an issue!

Related Content