Skip to content
IT glossary
DatabasesUpdated December 3, 2026

Time-series database

Временные ряды в базе данных

This kind of database is built for timestamped readings. It makes it easy to retrieve data for a particular period or summarize it, for example by finding the highest temperature in each hour.

Also known as: TimescaleDB, InfluxDB

What makes data a time series?

Imagine a dashboard that shows how hot each server rack got overnight. A sensor reading has a timestamp, a value, and an identifier such as rack-12. Readings for the same sensor and metric form a time series. They don't have to arrive at regular intervals: a device might report only when a value changes, or upload several minutes of readings after reconnecting.

A time-series database (TSDB) is designed for workloads like this: lots of incoming measurements and frequent queries over time ranges. TimescaleDB adds time-series capabilities to PostgreSQL. InfluxDB is a separate database product. Both are examples of the category, not alternative names for it.

How it handles a growing history

  • Time partitioning: Store rows in chunks covering different time ranges. A query for the last hour can skip chunks that only contain older readings.
  • Time buckets: Group points into fixed intervals, such as five minutes, and compute a statistic for each interval. Frequently requested summaries can be precomputed so a dashboard doesn't scan raw readings on every refresh.
  • Retention and compression: Older data can be compressed or deleted according to a policy. You might keep raw readings for 30 days and hourly summaries for a year. The summaries save space but cannot reconstruct the original readings.

Example: find short temperature spikes

A five-minute average can hide a brief spike. This TimescaleDB query returns the highest recorded temperature per five-minute bucket for one sensor during the last hour:

SELECT time_bucket('5 minutes', measured_at) AS bucket,
       max(temp_c) AS peak_temp_c
FROM readings
WHERE sensor_id = 'rack-12'
  AND measured_at >= now() - interval '1 hour'
  AND measured_at < now()
GROUP BY 1
ORDER BY 1;

time_bucket labels each group with its start time. If no reading falls into a bucket, the query returns no row for it. Don't fill the gap with zero by default: a missing reading doesn't tell you what the temperature was.

When to use one and what to discuss in interviews

Common uses include service metrics, equipment telemetry, and market prices. A table with a timestamp doesn't automatically need a specialized database. For a modest workload, a PostgreSQL table with an index on (sensor_id, measured_at) may handle the queries without adding another system to operate.

In a system design interview, start with the expected write rate, the number of distinct series, the time ranges people query, and how much history they need at full resolution. Then explain how you'll handle late data. If a device uploads a reading at 10:15 that it took at 10:02, a dashboard based on measurement time should put it in the 10:00 bucket, even if that bucket's summary has already been computed.