approx_percentile()
Estimate the value at a given percentile from a `tdigest`
Since 1.0.0
Estimate the approximate value at a percentile from a tdigest aggregate.
Samples
Section titled “Samples”Estimate the value at the first percentile, given a sample containing the numbers from 0 to 100.
SELECT approx_percentile(0.01, tdigest(100, data))FROM generate_series(0, 100) data;approx_percentile------------------- 0.51Arguments
Section titled “Arguments”The syntax is:
approx_percentile( quantile DOUBLE PRECISION, digest TDigest) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| quantile | DOUBLE PRECISION | - | ✔ | The percentile to compute. Values outside the range [0.0, 1.0] are treated as 0.0 or 1.0 |
| digest | TDigest | - | ✔ | The tdigest aggregate |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| approx_percentile | DOUBLE PRECISION | The estimated value at the requested percentile. |