Skip to main content
Since 1.0.0 Get the number of values contained in a uddsketch. This accessor allows you to calculate a count alongside percentiles, without needing to create two separate aggregates from the same raw data.
num_vals(
  sketch UddSketch
) RETURNS DOUBLE PRECISION

Arguments

NameTypeDefaultRequiredDescription
sketchUddSketch-The uddsketch to extract the number of values from

Returns

ColumnTypeDescription
num_valsDOUBLE PRECISIONThe number of values in the uddsketch

Samples

Count the number of integers from 0 to 100.
SELECT num_vals(uddsketch(data))
FROM generate_series(0, 100) data;
num_vals
-----------
    101