timescaledb_toolkit
timescaledb_toolkit : Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1010 | timescaledb_toolkit | timescaledb_toolkit | 1.28.0 |
TIME | Timescale | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-dt- | No | Yes | No | Yes | no | yes |
| Relationships | |
|---|---|
| See Also | timescaledb timeseries pg_stl first_last_agg extra_window_functions quantile tdigest topn tablefunc |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| el8.aarch64 | N/A | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| el9.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| el9.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| el10.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| el10.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| d12.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| d12.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| d13.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| d13.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u22.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u22.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u24.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u24.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u26.x86_64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
| u26.aarch64 | MISS | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 | PIGSTY 1.27.0 |
Source
github.com/timescale/timescaledb-toolkit
timescaledb-toolkit-1.28.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
TimescaleDB Toolkit provides specialized functions for time-series analytics using a two-step aggregation pattern. Most functions create intermediate representations that accessor functions then query, enabling efficient reuse and multiple analyses.
Enablement and Compatibility
timescaledb_toolkit 1.27.0 is published under tag 1.27.0+p2; upstream CI covers PostgreSQL 16–18. After installing the matching library, enable it in each database:
The control file marks it trusted, permitting installation by a role with CREATE privilege on the database; shared preload is not required. Examples using time_bucket below also assume TimescaleDB is enabled. Upgrade existing installations with matching libraries and supplied SQL upgrade paths; experimental objects have no upgrade compatibility guarantee.
Approximate Analytics
HyperLogLog - Distinct Count Estimation
Probabilistic distinct counting with configurable precision for high-cardinality datasets.
T-Digest - Quantile Approximation
High-accuracy percentile estimation optimized for tail quantiles (P95, P99).
UddSketch - Bounded Error Quantiles
Quantile estimation with a requested starting error bound. Too few buckets can increase the actual bound; check error on the resulting sketch.
Counter Analytics
Counter Aggregates - Monotonic Metrics
Handle counters that increase monotonically with automatic reset detection.
Gauge Aggregates - Varying Metrics
Analytics for metrics that vary up and down (temperature, memory usage).
Time-Weighted Analytics
Time-Weighted Averages
Handle irregularly sampled data with interpolation methods (LOCF, Linear).
Data Visualization
LTTB Downsampling
Downsample time series while preserving visual similarity for charts.
ASAP Smoothing
Generate human-readable graphs by reducing noise while preserving trends.
Statistical Analysis
Stats Aggregates
Comprehensive statistical analysis with 1D and 2D regression capabilities.
Timevector Data Type
Timevectors hold intermediate time-series values. Pipeline operators such as toolkit_experimental.lttb remain experimental; sort before downsampling.
Integration Patterns
Materialized Aggregates
The following is an ordinary materialized view; refresh it explicitly when source data changes. A TimescaleDB continuous aggregate additionally requires a hypertable, its continuous option and a suitable refresh policy.
Two-Step Analysis Pattern
Store intermediate aggregates for multiple analyses:
All functions in the experimental schema (toolkit_experimental) may change between versions. Use stable functions for production workloads requiring API stability.
Version Notes
Since 1.23, max_n, max_n_by, min_n and min_n_by return empty results on empty input, while stats_agg(bigint) rejects values outside the exact double-precision integer range. Retain application tests for these behaviors when upgrading.
1.24 adds equality for heartbeat_agg and repairs empty frequency aggregates and statistical overflow handling. 1.25 stabilizes gauge_agg and fixes empty t-digest input and several type-handling defects. 1.26 removes combine/serialize/deserialize support from time_weight and its rollup, retaining their nonparallel aggregation boundary.
1.27 adds equality for statssummary1d and statssummary2d, fixes sparse HyperLogLog rollups and prevents an ignored counter point at the same timestamp from counting as a reset. It rejects invalid UTF-8 state names, lambdas longer than 1024 bytes or nested beyond 256 parenthesis levels, frequency rollups of different element types and a mismatched NULL type argument to topn. It also restores the pipeline map ACL check.
Version 1.28.0
Version 1.28.0 adds equality operators for timeweightsummary and fixes interpolated_delta and interpolated_rate on NULL counter summaries. It removes PostgreSQL 15 build and release support; the source declares PostgreSQL 16–18. Upgrade a PG15 server before selecting this Toolkit release. Existing package support fields describe separately published packages and are not evidence that 1.28.0 is available for every coordinate.
Install matching files, update the extension through its supplied path and recheck queries relying on NULL counter inputs or equality of time-weight summaries: