Dev tools

Time Series Database: What It Is and When to Use One

A time series database stores data points indexed by time, like metrics and sensor readings. How it works, when to use one, and the main options compared.

By OmniAI Editorial · Nov 22, 2026 · 10 min read

A time series database (TSDB) is a database built for data points that are each stamped with a time, such as server metrics every ten seconds, sensor readings every minute, or stock prices every millisecond. It's optimized for writing huge numbers of new points quickly, compressing them well, and answering questions over time ranges, like "average CPU per hour over the last week". You need one when time-stamped data arrives constantly and your main queries are about trends over time; for ordinary business records, a regular relational database is usually enough.

This guide explains what makes time series data different, how a time series database works, when to use one (and when not to), how a time series database vs relational database compares, and the best time series database options, including how TimescaleDB vs InfluxDB differ.

What Is Time Series Data?

Time series data is a sequence of measurements of the same thing over time. Each data point usually has:

  • A timestamp: when the measurement was taken.
  • One or more values: the measurement itself (temperature 21.4, CPU 63%, price 102.15).
  • Labels or tags: what was measured (sensor ID, server name, region, stock symbol).

Common examples:

AreaTime series data
Infrastructure monitoringCPU, memory, request rates and latency for every server and container
Application monitoringErrors, response times, queue lengths
Internet of thingsTemperature, pressure, location and energy use from devices
FinancePrices, trades and order book changes
Business analyticsSign-ups, revenue and usage per hour or day
AI and LLM appsToken usage, latency and cost per request

Time series data has a recognizable pattern: it's written constantly, almost never updated, usually read in time ranges, and becomes less valuable as it gets older. A time series database is designed around exactly those habits.

How a Time Series Database Works

Most time series databases share a few design choices:

  • Fast appends: new points are written to memory and a write-ahead log, then flushed to disk in batches. Prometheus, for example, groups incoming samples into two-hour blocks.
  • Organized by time: data is partitioned into time chunks, so a query for "the last 24 hours" only reads the chunks for those hours.
  • Heavy compression: consecutive values from the same series are similar, so compression techniques for timestamps and values shrink storage dramatically compared with storing each row separately.
  • Time functions: built-in functions group data into time buckets (per minute, hour or day), fill gaps, and calculate rates and moving averages.
  • Downsampling and retention: older data can be rolled up into averages (keep per-second data for a week, per-hour data for a year) and deleted automatically after a set period.
  • High-cardinality handling: each unique combination of labels is a separate series; good TSDBs index labels so queries can filter millions of series quickly.

Here's what this looks like in TimescaleDB, which adds time series features to PostgreSQL. The table is created as a hypertable, and the query uses time_bucket to compute hourly averages (both from TimescaleDB's own documentation):

CREATE TABLE sensor_data (
  time TIMESTAMPTZ NOT NULL,
  sensor_id TEXT NOT NULL,
  temperature DOUBLE PRECISION
) WITH (tsdb.hypertable);

SELECT time_bucket('1 hour', time) AS hour,
       sensor_id,
       AVG(temperature) AS avg_temp
FROM sensor_data
WHERE time > NOW() - INTERVAL '24 hours'
GROUP BY hour, sensor_id
ORDER BY hour DESC;
Six tall blocks in a row above an ink arrow pointing right, alternating light and grey, with the last block orange.
Time series data is stored in time chunks, so recent queries only touch the newest blocks.

Time Series Database vs Relational Database

A regular relational database such as PostgreSQL or MySQL can store time-stamped rows perfectly well. The difference shows up at scale:

Relational databaseTime series database
Built forRecords that are created, updated and joinedMeasurements appended over time
Typical writesMixed inserts and updatesConstant high-volume inserts, rarely updated
Typical readsLook up and join individual recordsAggregate ranges of time across many series
StorageRow by row; less compressionColumnar or time-chunked with heavy compression
Data lifecycleKeep everything unless deletedBuilt-in retention policies and downsampling
Time functionsPossible with SQL, but manualBuilt in (time buckets, rates, gap filling)
Best forOrders, users, invoices, application stateMetrics, events, sensor and market data

The time series database vs relational database choice isn't all-or-nothing. If you already run PostgreSQL and your time series data is modest, a well-indexed table may be enough. If you're writing millions of points a minute or need months of history to stay fast and cheap, a TSDB pays off. Extensions like TimescaleDB sit in between: they keep PostgreSQL and its SQL, joins and tools, and add time series storage. Our comparison of Postgres vs MySQL covers the relational side.

Two database cylinders: a grey one with horizontal ink lines and a light one with vertical ink lines and a small orange dot on its top.
Row-by-row storage versus column-style storage built for time ranges.

When to Use a Time Series Database

If you're wondering when to use time series database software instead of your existing database, use one when most of these are true:

  • Data arrives continuously, from many sources, at high volume.
  • Nearly every query filters or groups by time.
  • You need dashboards and alerts on recent data with fast responses.
  • Old data can be summarized or deleted after a while.
  • Storage costs matter and compression would help.

Stick with your existing relational database when:

  • Data volume is small (thousands of points per minute, not millions).
  • You need frequent updates, transactions across tables, or complex joins with business data.
  • Time is just one column among many in records that represent things (orders, users), not measurements.

Best Time Series Database Options

There's no single best time series database; the right one depends on your workload, your team's skills and whether you want to manage it yourself. The main options:

DatabaseTypeQuery languageStrengthsWatch out for
InfluxDB 3 CorePurpose-built TSDB, open sourceSQL and InfluxQLReal-time ingest, Parquet files, object storage support, fast queries on recent dataHistorical querying, high availability and read replicas are Enterprise features
TimescaleDB (Tiger Data)PostgreSQL extensionFull PostgreSQL SQLJoins with business data, Postgres tools and ecosystem, hypertables and columnstoreSome features use the Timescale License rather than Apache 2.0
PrometheusMetrics system with built-in TSDBPromQLStandard for Kubernetes and infrastructure monitoring, alertingLocal storage is meant for recent data; long-term storage needs a remote backend
ClickHouseColumnar analytics databaseSQLVery fast aggregations on huge data, also handles logs and eventsGeneral-purpose analytics engine rather than a dedicated TSDB
QuestDBPurpose-built TSDB, open sourceSQL with time extensionsHigh ingest speed, finance and market dataSmaller ecosystem
VictoriaMetricsPrometheus-compatible TSDBPromQL-compatibleEfficient long-term storage for Prometheus metricsFocused on metrics monitoring
Cloud services (Amazon Timestream and others)ManagedVariesNo servers to runVendor lock-in, costs grow with volume

According to InfluxData's documentation, InfluxDB 3 Core is the open-source release of InfluxDB 3, with a diskless architecture that can use object storage, Parquet file persistence, an embedded Python engine for plugins, and query times under 10 ms for last-value queries. Prometheus's documentation describes its local storage as a time series database that can optionally integrate with remote storage systems for longer retention.

TimescaleDB vs InfluxDB

TimescaleDB vs InfluxDB is the most common head-to-head:

  • Pick TimescaleDB if you already use PostgreSQL, want to join time series with relational data (users, devices, accounts) in plain SQL, and value Postgres tools, backups and extensions.
  • Pick InfluxDB if you want a dedicated time series engine with its own ecosystem (such as the Telegraf collection agent), object-storage-based architecture, and a focus on real-time ingest and dashboards.

Both handle typical monitoring and IoT workloads well; the deciding factor is usually whether your team wants to stay inside PostgreSQL.

Open Source Time Series Database Choices

If you want an open source time series database you can self-host, InfluxDB 3 Core, TimescaleDB, Prometheus, QuestDB and VictoriaMetrics all have open-source editions, and ClickHouse is open source as well. Check each license before you build a commercial product on top: some projects use permissive licenses (Apache 2.0, MIT), while others keep certain features under source-available licenses or in paid editions.

For a small setup, such as monitoring a home lab or a few servers, Prometheus with Grafana is the most common starting point. For an app that already runs on PostgreSQL, adding TimescaleDB avoids running a second database.

Time Series Data in AI Applications

AI products generate a lot of time series data: tokens per request, latency, cost per user, error rates and GPU utilization. Storing these metrics over time is how you spot cost spikes, slow models and regressions after a prompt change. Many LLM observability tools use time series storage behind their dashboards; our guide to LLM observability explains which signals to track.

Time series also feed machine learning directly: forecasting demand, detecting anomalies in sensor data, and predicting failures all start from well-organized time-stamped history. And when you need similarity search over embeddings rather than ranges over time, that's a different specialized store; our explainer on vector databases covers it.

How to Choose: A Short Checklist

  • Volume: how many points per second, and how many unique series (label combinations)?
  • Queries: mostly recent dashboards, long-range analytics, or both?
  • Joins: do you need to combine measurements with business data?
  • Retention: how long must raw data stay, and can older data be summarized?
  • Operations: will you run it yourself, or pay for a managed service?
  • Ecosystem: does it work with your collectors, dashboards and alerting tools?
  • License: is the license compatible with how you'll use it?

FAQ

What is a time series database used for?

It's used to store and analyze measurements taken over time, such as server metrics, application performance data, IoT sensor readings, financial prices and usage statistics. It powers monitoring dashboards, alerts, forecasting and trend analysis.

What is the best time series database?

It depends on the job. Prometheus is the standard for infrastructure metrics, TimescaleDB suits teams already using PostgreSQL, InfluxDB is a popular dedicated option for real-time data, and ClickHouse or QuestDB fit very large analytical or financial workloads.

Can PostgreSQL be used as a time series database?

Yes. Plain PostgreSQL handles moderate time series data with good indexing, and the TimescaleDB extension adds time-based partitioning, compression and time functions so it performs like a dedicated time series database at larger scale.

Is a time series database a NoSQL database?

Some are and some aren't. Several purpose-built TSDBs use their own storage engines and query languages, while others, like TimescaleDB, are built on relational databases and use SQL. Many modern TSDBs, including InfluxDB 3 and QuestDB, support SQL queries.

What is the difference between a time series database and a data warehouse?

A time series database is optimized for continuous, high-volume writes and fast queries over recent time ranges, such as live dashboards. A data warehouse is built for broad analytical queries across many kinds of business data, usually loaded in batches. Many companies use both.

All articles

Read next

Language

EnglishEnglish · en TürkçeTurkish · tr DeutschGerman · de العربيةArabic · ar

Account

Enter your email. We’ll send you a sign-in link and a 6-digit code. No password needed.

Sign in

Theme

Language

Show our email address

To keep spam out of our inbox, please confirm your own email first. We will send you a 6-digit code.

We send codes only to these providers: gmail.com, googlemail.com, outlook.com, hotmail.com, live.com, msn.com, proton.me, protonmail.com, pm.me, icloud.com, me.com, mac.com, yahoo.com, aol.com, gmx.de, gmx.net, web.de, t-online.de, yandex.com, omniai.blog