tdigest
tdigest : Provides tdigest aggregate function.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4710 | tdigest | tdigest | 1.4.7 |
FUNC | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | ddsketch count_distinct topn omnisketch datasketches hll quantile lower_quantile weighted_statistics |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.4.7 |
18 17 16 15 14 | tdigest |
- |
| RPM | PGDG | 1.4.7 |
18 17 16 15 14 | tdigest_$v |
- |
| DEB | PGDG | 1.4.7 |
18 17 16 15 14 | postgresql-$v-tdigest |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| el8.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| el9.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| el9.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| el10.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| el10.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| d12.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| d12.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| d13.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| d13.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u22.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u22.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u24.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u24.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u26.x86_64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
| u26.aarch64 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 | PGDG 1.4.7 |
Source
github.com/tvondra/tdigest
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
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.