timescaledb
timescaledb
timescaledb : Enables scalable inserts and complex queries for time-series data
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1000 | timescaledb
|
timescaledb
|
2.25.2 |
TIME
|
Timescale
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd--
|
No
|
Yes
|
Yes
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Schemas | timescaledb_information timescaledb_experimental |
| See Also | timescaledb_toolkit
timeseries
pg_cron
pg_partman
periods
temporal_tables
emaj
pg_task
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
2.25.2 |
18
17
16
15
14
|
timescaledb |
- |
| RPM | PIGSTY
|
2.25.2 |
18
17
16
15
14
|
timescaledb-tsl_$v |
- |
| DEB | PIGSTY
|
2.25.2 |
18
17
16
15
14
|
postgresql-$v-timescaledb-tsl |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
el8.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
el9.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
el9.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
el10.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
MISS
|
el10.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
MISS
|
d12.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
d12.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
d13.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
MISS
|
d13.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
MISS
|
u22.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
u22.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
u24.x86_64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
u24.aarch64
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.25.2
|
PIGSTY 2.19.3
|
Source
pig build pkg timescaledb; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install timescaledb; # install via package name, for the active PG version
pig install timescaledb -v 18; # install for PG 18
pig install timescaledb -v 17; # install for PG 17
pig install timescaledb -v 16; # install for PG 16
pig install timescaledb -v 15; # install for PG 15Config this extension to shared_preload_libraries:
shared_preload_libraries = 'timescaledb';Create this extension with:
CREATE EXTENSION timescaledb;Usage
Create a table and turn it into hypertable
DROP TABLE IF EXISTS ts_test;
CREATE TABLE ts_test
(
ts TIMESTAMPTZ NOT NULL,
id BIGINT,
v INTEGER -- payload
);
SELECT create_hypertable('ts_test', by_range('ts'));
INSERT INTO ts_test
SELECT now() + (i || ' seconds')::INTERVAL, i, i % 100
FROM generate_series(1, 1000000) i;Continuous Agg Example:
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;
-- Add a refresh policy to keep the continuous aggregate up to date
SELECT add_continuous_aggregate_policy('ts_hourly',
start_offset => INTERVAL '3 hours',
end_offset => INTERVAL '1 hour',
schedule_interval => INTERVAL '1 hour');Job Scheduling Example:
SELECT add_job('SELECT 1','1h', initial_start => now()::timestamptz);Compression Example:
ALTER TABLE ts_test SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'id',
timescaledb.compress_orderby = 'ts'
);
-- Add a compression policy to compress chunks older than 1 day
SELECT add_compression_policy('ts_test', INTERVAL '1 day');Last updated on