timescaledb
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
timescaledb | 2.27.0 | TIME | Timescale | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1000 | timescaledb | No | Yes | Yes | Yes | Yes | No | timescaledb_information |
| Related | timescaledb_toolkit timeseries pg_cron pg_partman periods temporal_tables emaj pg_task |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.27.0 | 1817161514 | timescaledb | - |
| RPM | PIGSTY | 2.27.0 | 1817161514 | timescaledb-tsl_$v | - |
| DEB | PIGSTY | 2.27.0 | 1817161514 | postgresql-$v-timescaledb-tsl | - |
Build
You can build the RPM / DEB packages for timescaledb using pig build:
pig build pkg timescaledb # build RPM / DEB packages
Install
You can install timescaledb directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install timescaledb; # Install for current active PG version
pig ext install -y timescaledb -v 18 # PG 18
pig ext install -y timescaledb -v 17 # PG 17
pig ext install -y timescaledb -v 16 # PG 16
pig ext install -y timescaledb -v 15 # PG 15
dnf install -y timescaledb-tsl_18 # PG 18
dnf install -y timescaledb-tsl_17 # PG 17
dnf install -y timescaledb-tsl_16 # PG 16
dnf install -y timescaledb-tsl_15 # PG 15
apt install -y postgresql-18-timescaledb-tsl # PG 18
apt install -y postgresql-17-timescaledb-tsl # PG 17
apt install -y postgresql-16-timescaledb-tsl # PG 16
apt install -y postgresql-15-timescaledb-tsl # PG 15
Preload:
shared_preload_libraries = 'timescaledb';
Create Extension:
CREATE EXTENSION timescaledb;
Usage
Sources: README, TimescaleDB 2.27.0 release, CREATE TABLE API, create_hypertable() API, continuous aggregate API, add_columnstore_policy() API, GUCs
timescaledb is a PostgreSQL extension for time-series and event analytics. The current docs emphasize CREATE TABLE ... WITH (tsdb.hypertable), continuous aggregates, automation jobs, and moving chunks into the columnstore.
Hypertables
CREATE EXTENSION timescaledb;
CREATE TABLE ts_test (
ts timestamptz NOT NULL,
id bigint,
v integer
) WITH (
tsdb.hypertable,
tsdb.orderby = 'ts DESC'
);
To convert an existing PostgreSQL table, use the generalized hypertable API:
CREATE TABLE ts_existing (
ts timestamptz NOT NULL,
id bigint,
v integer
);
SELECT create_hypertable('ts_existing', by_range('ts'));
CREATE TABLE ... WITH (tsdb.hypertable)has been documented since TimescaleDB 2.20.0 and is the best-practice path for new hypertables.- For TimescaleDB 2.23.0 and later, the first
TIMESTAMPorTIMESTAMPTZcolumn is selected automatically as the partition column unless more than one candidate makes the choice ambiguous. create_hypertable()still works for converting existing tables.
Continuous aggregates and jobs
CREATE MATERIALIZED VIEW ts_hourly
WITH (timescaledb.continuous) AS
SELECT time_bucket('1 hour', ts) AS bucket,
count(*) AS cnt,
avg(v) AS avg_v
FROM ts_test
GROUP BY bucket;
SELECT add_continuous_aggregate_policy(
'ts_hourly',
start_offset => INTERVAL '3 hours',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour'
);
SELECT add_job('user_defined_action', '1h');
- Continuous aggregates require
time_bucket(...)on the hypertable’s time dimension. - The continuous aggregate
WITHclause supportstimescaledb.materialized_only; the current API default isTRUE, so real-time aggregation is not enabled unless configured otherwise.
Columnstore
CREATE TABLE crypto_ticks (
"time" timestamptz,
symbol text,
price double precision,
day_volume numeric
) WITH (
tsdb.hypertable,
tsdb.segmentby = 'symbol',
tsdb.orderby = 'time DESC'
);
CALL add_columnstore_policy('crypto_ticks', after => INTERVAL '60 days');
CREATE TABLE ... WITH (tsdb.hypertable)enables columnstore by default unlesstsdb.columnstore = false.add_columnstore_policy()replaces the olderadd_compression_policy()API and requires eitherafterorcreated_before, not both.- Bloom filters are enabled by default for new columnstore chunks. Existing chunks need recompression before they have bloom indexes.
Relevant GUCs
SET timescaledb.enable_direct_compress_insert = on;
SET timescaledb.enable_cagg_rewrites = on;
SET timescaledb.enable_columnar_scan_filter_pushdown = on;
timescaledb.enable_direct_compress_insert and timescaledb.enable_direct_compress_copy enable tech-preview direct compression during ingestion. TimescaleDB 2.27.0 adds timescaledb.enable_cagg_rewrites and timescaledb.cagg_rewrites_debug_info, and documents timescaledb.enable_columnar_scan_filter_pushdown as enabled by default.
Caveats
- This project’s CSV tracks TimescaleDB
2.27.0for PostgreSQL 15-18. - TimescaleDB 2.27.0 adds Hypercore columnstore performance work: vectorized filters, bloom-filter pruning for
UPDATE/DELETEequality predicates, and bloom-filter pruning forUPSERT. - The 2.27.0 release notes list backward-incompatible upgrade caveats for affected compressed
int2bloom sparse indexes and for composite bloom metadata generated by v2.26. - The 2.27.0 release notes announce that the June 2026 TimescaleDB release is planned to be the last version supporting PostgreSQL 15.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.