tdigest
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
tdigest | 1.4.7 | FUNC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4710 | tdigest | No | Yes | No | Yes | No | Yes | - |
| Related | ddsketch count_distinct topn omnisketch datasketches hll quantile lower_quantile weighted_statistics |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.4.7 | 1817161514 | tdigest | - |
| RPM | PGDG | 1.4.7 | 1817161514 | tdigest_$v | - |
| DEB | PGDG | 1.4.7 | 1817161514 | postgresql-$v-tdigest | - |
Install
You can install tdigest directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
tdigest 1.4.7 supplies approximate, mergeable rank statistics. Store partial digests and combine them to calculate quantiles without sorting the complete original data.
Core Workflow
Functions and Accuracy
tdigest(value, compression) builds a digest; tdigest(digest) merges stored digests. tdigest_percentile estimates quantiles and tdigest_percentile_of estimates ranks, with scalar and array forms. tdigest_add and tdigest_union update or combine digests; tdigest_count, tdigest_sum and tdigest_avg report counts and trimmed aggregates. The low and high arguments to trimmed aggregates are quantile thresholds, not raw value bounds. tdigest_is_valid checks serialized values.
compression must be between 10 and 10000. Higher values trade memory and CPU for generally better accuracy, but do not provide a fixed error bound. Validate estimates against exact results on representative data and use consistent compression when merging states.
Upgrade and Boundaries
Version 1.4.7 fixes closely spaced percentile interpolation, large-count inverse ranks, reusable-state finalization and NULL-compression handling, and marks more scalar functions parallel safe. Upgrade the installed library and SQL together with ALTER EXTENSION tdigest UPDATE TO '1.4.7'. Review stored digests with tdigest_is_valid; older malformed values can be rejected by the stricter validation. Installation requires superuser rights; the extension is relocatable and requires no preload. The release metadata sets PostgreSQL 13 as the minimum, and the changelog records PostgreSQL 19 build fixes without making a broad performance guarantee.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)