← Lessons

quiz vs the machine

Gold1420

System Design

The Time Series Database for Metrics

Why metrics need a storage engine built for timestamped numeric data at huge scale.

5 min read · core · beat Gold to climb

A specialized store

Metrics are streams of timestamped numbers tagged with labels. A time series database, or TSDB, is built specifically for this shape and vastly outperforms a general database for it.

What a series is

A single series is the unique combination of a metric name and its label set, for example request count for one service and one status code. Each series holds an ordered list of timestamp and value points.

Why a TSDB is efficient

  • Append mostly writes arrive in time order, so storage is optimized for sequential appends rather than random updates.
  • Compression is strong because timestamps are regular and values change slowly, so delta and bit packing shrink data dramatically.
  • Downsampling rolls old high resolution data into coarser summaries to control long term cost.
  • Retention policies automatically expire old points.

Querying

Queries select series by label matchers and a time range, then apply functions like rate, average, or quantile over windows. The label index makes finding matching series fast.

Key idea

A time series database stores label tagged numeric points in time order, using compression, downsampling, and retention to scale metrics affordably.

Check yourself

Answer to earn rating on the learn ladder.

1. What uniquely identifies a single time series?

2. Why does a TSDB compress so well?

3. What does downsampling achieve?