total()
Calculate the exact sum of the values in a `uddsketch`
Since 1.21.0
Calculate the exact sum of all the values added to a uddsketch. Unlike percentile calculations, the sum is exact,
though there might be some loss of precision. This accessor allows you to calculate the total alongside percentiles,
without needing to create two separate aggregates from the same raw data.
Samples
Section titled “Samples”Calculate the sum of the integers from 0 to 100.
SELECT total(uddsketch(100, 0.001, data::double precision))FROM generate_series(0, 100) data;total-------5050Arguments
Section titled “Arguments”The syntax is:
total( sketch UddSketch) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| sketch | UddSketch | - | ✔ | The uddsketch to extract the sum from |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| total | DOUBLE PRECISION | The sum of the values in the uddsketch. |