liveBook · Manning

TimescaleDB

As explained in Just Use Postgres!

TimescaleDB is a PostgreSQL extension for storing and querying time-series data.

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

How Just Use Postgres! covers it

How deep it goes
Explains Docker setup, data loading, partitioning, and analysis, but does not detail specialized functions or production deployment.
Examples
Uses Docker commands, SQL schema and load scripts, device counts, and time-window heart-rate queries.
What it assumes
Assumes familiarity with PostgreSQL and Docker while introducing time-series storage and analysis through a smartwatch example.
What you can do after
Operate/configure a TimescaleDB container, load time-series data, verify the extension, and query measurements by device and time.
How it connects
Ties PostgreSQL to time-series data, database partitioning, columnar storage, data retention policies, and indexing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.