error()

error(sketch UddSketch) RETURNS DOUBLE PRECISION

This returns the maximum relative error that a percentile estimate will have (relative to the correct value). This means the actual value will fall in the range defined by approx_percentile(sketch) +/- approx_percentile(sketch)*error(sketch).

This function can only be used on estimators produced by percentile_agg() or uddsketch() calls.

Required arguments

NameTypeDescription
sketchUddSketchThe sketch to determine the error of, usually from a percentile_agg() call

Returns

ColumnTypeDescription
errorDOUBLE PRECISIONThe maximum relative error of any percentile estimate

Sample usage

SELECT error(percentile_agg(data))
FROM generate_series(0, 100) data;
error
-------
 0.001

Found an issue on this page?

Report an issue!

Related Content