tdigest()
Aggregate data in a `tdigest` for further calculation of percentile estimates
Since 1.0.0
This is the first step for calculating approximate percentiles with the tdigest algorithm. Use tdigest to create an
intermediate aggregate from your raw data. This intermediate form can then be used by one or more accessors in this
group to compute final results.
Optionally, multiple such intermediate aggregate objects can be combined using rollup() before an accessor is applied.
Samples
Section titled “Samples”Given a table called samples, with a column called data, build a tdigest using the data column. Use 100 buckets
for the approximation.
SELECT tdigest(100, data) FROM samples;Arguments
Section titled “Arguments”The syntax is:
tdigest( buckets INTEGER, value DOUBLE PRECISION) RETURNS TDigest| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| buckets | INTEGER | - | ✔ | Number of buckets in the digest. Increasing this provides more accurate quantile estimates, but requires more memory |
| value | DOUBLE PRECISION | - | ✔ | Column of values to aggregate for the tdigest object |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| tdigest | TDigest | A percentile estimator object created to calculate percentiles using the tdigest algorithm |