IoT Time Series Databases

IoT devices produce readings that carry a timestamp: temperature at 10:00, temperature at 10:01, temperature at 10:02. This stream of values over time is called time series data. A time series database stores and searches such data far faster than a general-purpose database.

What Time Series Data Looks Like

TimestampDeviceTemperature (C)Humidity (%)
10:00:00sensor-0124.152
10:01:00sensor-0124.352
10:02:00sensor-0124.651

Every row adds to the end of the history, and rows rarely change after writing.

Why Normal Databases Struggle

A hundred thousand sensors sending a reading every second create 8.6 billion rows per day. General databases slow down under constant writes and heavy time-based questions. Time series databases organize data by time, compress it tightly, and answer range queries quickly.

Core Features

Fast Writes

The system accepts thousands of readings per second without delay.

Compression

Neighboring values look similar, so the database stores the small differences and saves up to ninety percent of disk space.

Time-Based Queries

Users ask questions such as the average temperature each hour last week, and the database returns results quickly.

Retention Policies

Rules delete or summarize old data automatically. Raw data stays for 30 days, and hourly averages stay for 2 years.

How Data Flows

[Sensors] ──► [MQTT broker] ──► [Ingest service] ──► [Time series DB]
                                                          │
                                         ┌────────────────┼────────────────┐
                                         ▼                ▼                ▼
                                   [Dashboard]      [Alert rules]    [Reports]

Popular Choices

DatabaseNotes
InfluxDBPurpose-built for metrics and sensor data
TimescaleDBTime series features on top of PostgreSQL
PrometheusMetrics collection and alerting for systems
Cloud servicesManaged options from major cloud providers

Downsampling Explained

Downsampling turns many detailed readings into fewer summary values. One thousand readings per hour become one average, one minimum, and one maximum.

Raw:        24.1 24.3 24.6 24.2 24.0 24.4 ...  (3600 values per hour)
                         │
                         ▼
Summary:    avg 24.3   min 24.0   max 24.6      (1 row per hour)

Everyday Comparison

A diary holds every moment of a day, while a yearbook keeps highlights. Downsampling creates the yearbook and saves storage.

Design Tips

  • Use tags such as device ID and location to filter data fast.
  • Keep field names short and consistent.
  • Store one measurement per field and avoid packing text blobs.
  • Choose time zones carefully, and store timestamps in UTC.
  • Test queries with realistic data volume before launch.

Sample Query Idea

Show the average temperature
for sensor-01
for each hour
during the last 24 hours

The database scans only the needed time window and skips older data.

Real Scenario: Cold Storage Monitoring

A warehouse runs fifty freezers, and each freezer reports temperature every ten seconds. The system receives 432,000 readings per day. The team stores raw data for 14 days, creates one-minute averages for 6 months, and keeps hourly summaries for five years. Compliance officers request a temperature report for any freezer and any week, and the database answers in a second. Alerts fire when a freezer stays above the limit for five minutes.

Questions That Time Series Databases Answer Well

  • What was the highest temperature of freezer 12 yesterday?
  • Which devices stopped reporting in the last hour?
  • How does this week's energy use compare with last week's?

Planning Storage Size

Multiply devices by readings per day by bytes per reading, and apply the compression ratio. A rough estimate during design prevents expensive surprises later.

Key Takeaway

Time series databases match the shape of IoT data: endless streams stamped with time. Choose one early, define retention rules, and your system stays fast as the device count grows.