TimescaleDB extends PostgreSQL for time-series workloads such as smartwatch heart-rate tracking. It supports scalable storage, specialized analysis, retention policies, and query optimization for measurements collected over time. section 9.0 section 9.2
Listing 9.1 Starting Postgres with TimescaleDB on Unix
docker volume create postgres-timescale-volume
docker run --name postgres-timescale \
-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password \
-p 5432:5432 \
-v postgres-timescale-volume:/var/lib/postgresql/data \
-d timescale/timescaledb:2.19.2-pg17
Start a development instance with Docker using the TimescaleDB 2.19.2 image, PostgreSQL 17, port 5432, and a persistent volume. section 9.2
Heart-rate measurements
Load a smartwatch dataset into the watch.heart_rate_measurements table, then query measurements by watch_id and time range. The sample contains 1,399,415 rows for three devices; a five-minute window returns six readings at one-minute intervals. section 9.3
Specialized functions support analysis of large time-series datasets while PostgreSQL partitioning helps store millions of measurements efficiently. section 9.5 section 9.3
