Time Series Databases
Updated June 3, 2026Imagine you're building the infrastructure for a fleet of 100,000 smart electric vehicles. Every single second, each car sends its current speed, battery level, and GPS coordinates to your servers.
That is 100,000 data points per second. That's 8.6 billion records a day.
If you try to shove this into a traditional Postgres or MySQL database, a few things will happen:
- The constant barrage of
INSERTstatements will lock up the disk and crash the database. - Your disk will run out of space in a matter of days.
- If a dashboard tries to query "What was the average battery level across all cars over the last month?", the database will take hours to scan billions of rows, only to time out.
When your data is essentially an endless river of measurements plotted against time, you need a Time Series Database (TSDB).
What is a Time Series Database?
A Time Series Database is specifically optimized for measuring how things change over time. In a TSDB, time isn't just another column in a table; it is the absolute core organizing principle of the database.
Every single record is fundamentally defined by its timestamp. The workload of a TSDB is unique:
- 99% Writes: Data is relentlessly appended. Updates (
UPDATE) and deletions (DELETE) of past records are incredibly rare. You don't change the temperature that was recorded yesterday; it already happened. - Range Reads: Queries almost always look at chunks of time (e.g., "between 1:00 PM and 2:00 PM") rather than searching for specific primary keys.
What is the fundamental characteristic that distinguishes a Time Series Database from a traditional relational database?
The Analogy: The Ticker Tape
A traditional database is like an address book. You go in, cross out old phone numbers, write in new ones, and move pages around.
A TSDB is like an old-school stock market ticker tape. It is a continuous, endless strip of paper. The machine just keeps printing the stock price and the time it happened, row after row, pushing the tape forward. You never go back and erase a printed price from two hours ago. You just look at the long strip of paper to see the trend.
In Time Series Databases, UPDATE operations on historical records are common and well-optimized.
How do TSDBs handle massive scale?
Time Series Databases (like InfluxDB, Prometheus, or TimescaleDB) use several clever tricks to survive the firehose of data.
1. Columnar Compression
Because time-series data is highly repetitive (e.g., a thermostat might report 72°, 72°, 72°, 73°, 73°), TSDBs use extreme compression algorithms. Instead of saving "72" a thousand times, it might compress it to "72 x 1000". This allows TSDBs to store massive amounts of data on disk with a tiny footprint compared to relational databases.
Why do Time Series Databases achieve much higher compression ratios than relational databases?
2. Time-Partitioning
TSDBs automatically chunk data into "time buckets" under the hood. For example, it might create a hidden table for "Data_Jan1" and another for "Data_Jan2". When you query for Jan 1st data, the database completely ignores the rest of the year, making queries lightning fast.
3. Continuous Aggregation & Downsampling
Nobody wants to query a billion data points to render a one-month graph. Your browser would crash trying to draw the chart. TSDBs can run background tasks that automatically average out historical data.
- Raw Data: Kept for the last 7 days (1 point per second).
- Downsampled: After 7 days, it averages it to 1 point per minute.
- Archived: After 30 days, it averages it to 1 point per hour. This process, called retention policies, keeps the database small and fast automatically.
What does "downsampling" accomplish in a Time Series Database's retention policy?
Real-World Examples
- DevOps Monitoring (Prometheus/Grafana): Tracking CPU usage, memory, and network latency across thousands of microservices. If CPU spikes, alerts fire.
- Financial Trading: High-frequency trading firms use specialized TSDBs (like kdb+) to track millisecond-level stock market ticks to run algorithmic trading models.
- IoT (Internet of Things): Smart home devices, industrial factory sensors, and weather stations constantly stream telemetry data that must be graphed and analyzed.
Trade-offs
- Terrible for Relationships: TSDBs are awful at tracking relationships. Don't use a TSDB to store user accounts, passwords, or e-commerce orders.
- Immutable History: They are heavily optimized for
INSERToperations. Running anUPDATEquery to fix a typo in a past event is computationally expensive and discouraged. - Specialized Query Languages: While TimescaleDB lets you use standard SQL, many others like InfluxDB (Flux) or Prometheus (PromQL) require you to learn completely new, specialized query languages focused on time-based mathematics.
A Time Series Database is a good choice for storing user account profiles and e-commerce order histories.
Summary
When your system is bombarded with millions of events, metrics, or measurements, traditional databases buckle under the write pressure. Time Series Databases are purpose-built to ingest a firehose of timestamped data, compress it highly, and query it rapidly over time windows. They are the backbone of modern monitoring, IoT analytics, and financial graphing.
How helpful was this content?
Comments
Sign in to join the discussion
Saved on this device only
Sign in to sync progress across devices