datasketches
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
datasketches | 1.7.0 | FUNC | Apache-2.0 | C++ |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4690 | datasketches | No | Yes | No | Yes | No | Yes | - |
| Related | ddsketch count_distinct tdigest topn omnisketch hll |
|---|
Built against Apache DataSketches C++ core 5.0.0.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.7.0 | 1817161514 | datasketches | - |
| RPM | PIGSTY | 1.7.0 | 1817161514 | datasketches_$v | - |
| DEB | PIGSTY | 1.7.0 | 1817161514 | postgresql-$v-datasketches | - |
Build
You can build the RPM / DEB packages for datasketches using pig build:
Install
You can install datasketches directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources: README, latest release 1.7.0, Apache DataSketches
datasketches adds approximate analytics sketch types and aggregates to PostgreSQL. The upstream README lists CPC, HLL, Theta, Array Of Doubles, KLL, Quantiles, and Frequent Strings sketches; the 1.7.0 release is the latest published GitHub release, while the default branch has already moved on to 1.8.0-SNAPSHOT.
Core Sketch Families
cpc_sketchandhll_sketchfor approximate distinct counting.theta_sketchfor distinct counting plus set operations such as union, intersection, and A-not-B.aod_sketchfor tuple-style metrics keyed by identifiers with arrays of doubles.kll_*_sketchandquantiles_*_sketchfor quantiles, ranks, PMF, and CDF.frequent_strings_sketchfor heavy-hitter detection.
Common Patterns
Build a sketch from raw values:
Use one-shot approximate aggregates:
Merge sketches across groups or cube dimensions:
Run set operations on Theta sketches:
Find frequent items above a threshold:
Caveats
- Upstream documents PostgreSQL 9.6+ plus Boost 1.75.0 and DataSketches C++ core 5.0.0 or later as build dependencies.
- These are approximate structures meant to be mergeable across dimensions; they are not exact replacements for
COUNT(DISTINCT ...)or exact histograms.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)