total()
Calculate the exact sum of the values in a `tdigest`
Since 1.21.0
Calculate the exact sum of all the values added to a tdigest aggregate. 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(tdigest(100, data))FROM generate_series(0, 100) data;total-------5050Arguments
Section titled “Arguments”The syntax is:
total( digest TDigest) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| digest | TDigest | - | ✔ | The tdigest aggregate to extract the sum from |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| total | DOUBLE PRECISION | The sum of the values in the tdigest. |