approx_percentile_rank()

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

  1. approx_percentile_rank(
  2. value DOUBLE PRECISION,
  3. sketch UddSketch
  4. ) 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

  1. SELECT
  2. approx_percentile_rank(99, percentile_agg(data))
  3. FROM generate_series(0, 100) data;
  1. approx_percentile_rank
  2. ----------------------------
  3. 0.9851485148514851