Time Series Database
Also known as:
TSDB
Time Series DB
Definition
A time series database, or TSDB, is a database built to store and query data that is always stamped with a time: metrics, IoT readings, ticks, and events. Writes are almost always appends of new points, and queries almost always start with a time range. The engine partitions data by time, compresses each series heavily, and drops or downsamples old points so recent windows stay fast.
Popular reads
View All
Payment System Design: Ledger, Idempotency, and Settlement
Jul 18, 2026
The Complete HTMX Guide: From Zero to Production
Dec 22, 2025
Transactional Outbox Pattern: Never Lose an Event Again
Apr 07, 2026
Cursor Skills: How to Create and Use Agent Skills
Jun 23, 2026
X Algorithm Explained: How the Open Source Recommendation System Works
Jan 22, 2026
How Google manages billions of lines of code in one monorepo
Sep 04, 2026
Key Takeaways
- Time is the primary axis. You append new points and query ranges like ‘the last hour’, not rows by arbitrary primary key.
- Compression and time partitioning are the product. Similar timestamps and slowly changing values often shrink to 1 to 2 bytes per sample.
- Cardinality (unique metric-plus-tag combinations) is the usual outage. Unbounded labels like user ids blow up the in-memory index.
- Retention and downsampling are first-class. A TSDB that never expires data is just a disk that grows.
How It Works
- New points go into an in-memory buffer and a write-ahead log for durability.
- Completed windows flush as immutable time chunks or blocks, often in a compressed columnar layout.
- A query first prunes chunks outside the time range, then uses an inverted index of names and tags to pick series.
- A TTL or chunk-drop job removes raw data after a retention window. Rollups keep a coarser copy for longer.
Where It Is Used
- Prometheus stores scrape samples in two-hour blocks and is the default metrics store for Kubernetes.
- TimescaleDB adds hypertables and compression on top of PostgreSQL so you keep SQL and joins.
- InfluxDB and Amazon Timestream ingest IoT and application metrics as a purpose-built or managed TSDB.