approx_percentile()

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

  1. approx_percentile(
  2. percentile DOUBLE PRECISION,
  3. sketch uddsketch
  4. ) 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

  1. SELECT
  2. approx_percentile(0.01, percentile_agg(data))
  3. FROM generate_series(0, 100) data;
  1. approx_percentile
  2. -------------------
  3. 0.999