← Lessons

quiz vs the machine

Silver1050

Databases

Time Series Database Design

How databases built for timestamped metrics differ from general purpose stores.

4 min read · intro · beat Silver to climb

Time Series Database Design

A time series database or TSDB stores measurements stamped with a time, such as CPU load every second or a stock price every trade. The defining trait of this workload is that writes are almost always appends of recent data, and reads usually scan a window of time for one or many series.

What makes it special

General databases assume updates and random access. A TSDB instead optimizes for:

  • Append heavy writes ordered by time, so new rows land at the end.
  • Time range queries that read a contiguous block rather than scattered rows.
  • High compression, because adjacent points often differ only slightly and timestamps rise steadily.

Series and tags

Each unique combination of a metric name and a set of tags, such as host and region, forms one series. Points within a series are sorted by time so the engine can store them together and compress them as a tight column.

Key idea

A time series database trades general update power for fast ordered appends, tight compression, and quick reads over a window of time.

Check yourself

Answer to earn rating on the learn ladder.

1. What write pattern dominates a time series database?

2. What defines a single series in a TSDB?