Skip to main content
Since 1.0.0 Get the maximum relative error of a uddsketch. The correct (non-estimated) percentile falls within the range defined by approx_percentile(sketch) +/- (approx_percentile(sketch) * error(sketch)).
error(
  sketch UddSketch
) RETURNS DOUBLE PRECISION

Arguments

NameTypeDefaultRequiredDescription
sketchUddSketch-The uddsketch to determine the error of

Returns

ColumnTypeDescription
errorDOUBLE PRECISIONThe maximum relative error of any percentile estimate

Samples

Calculate the maximum relative error when estimating percentiles using uddsketch.
SELECT error(uddsketch(data))
FROM generate_series(0, 100) data;
error
-------
0.001