Time-Series Databases
Time-series databases are built for timestamped, append-heavy data, optimizing ingestion, time-range queries, retention, and downsampling.
A specialized shape of data
Time-series data, timestamped measurements arriving continuously, has an access pattern general databases handle poorly: writes are almost entirely appends of recent data, and reads are almost entirely range queries over a time window, often aggregated. A time-series database (TSDB) is designed around exactly this shape, trading general-purpose flexibility for ingestion speed and time-range efficiency.
What a TSDB optimizes
- High-rate append ingestion with minimal write amplification
- Fast queries over contiguous time ranges
- Built-in compression tuned to timestamps and slowly changing values
- Retention policies that expire old data automatically
- Downsampling that pre-aggregates history to coarser resolution
Time partitioning
A TSDB partitions data by time, storing each window (say an hour or a day) in its own segment. This makes range queries touch only the relevant segments and makes retention trivial: expiring old data means dropping whole old segments rather than deleting rows. Recent segments, which take almost all writes and reads, can be kept in memory while older ones live on disk.
Tags and series cardinality
Measurements are organized into series identified by tags, such as a sensor id and a location. Each unique tag combination is a distinct series. The number of series, the cardinality, is the dominant scaling factor: high cardinality (many unique tag combinations) strains the index far more than a high sample rate does. Designing tags to keep cardinality bounded is the central modeling discipline for a TSDB.
Retention and downsampling policies
Because time series accumulate forever, a TSDB manages the lifecycle automatically. A typical policy keeps full-resolution data for a recent window, then downsamples to progressively coarser aggregates for older data, then drops the oldest entirely. This matches how the data is queried, recent data in detail, old data as trends, and bounds storage without manual intervention. For monitoring instrumented physical systems, this lifecycle keeps live dashboards fast while preserving long-term history compactly. See time-series compression, real-time analytics, and partitioning.