Contents
Figure 1: Best Time Series Databases for ML Pipelines: InfluxDB vs TimescaleDB and More — six products, one question that actually decides model quality
Every "best database" post ends with a winner and a benchmark chart. This one has neither, and I will say why up front: there is no Docker daemon on this machine and no server instance anywhere, so InfluxDB, TimescaleDB, QuestDB, ClickHouse and VictoriaMetrics are reviewed from their documentation, not measured. Nothing here is an ingest benchmark.
What I did run is the piece that matters more than any logo: the point-in-time join, in SQLite, DuckDB 2.0.0 and pandas 3.0.6. Those three install with pip and need no server, and one of them (DuckDB) is a real as-of join engine. That experiment changed how I would read the vendor pages.
What an ML Pipeline Actually Asks of a Database
Forget ingest records for a moment. A training pipeline usually needs five things:
- Resampling: turn irregular readings into evenly spaced buckets, with a rule for gaps.
- Point-in-time joins: for each label, attach the latest feature value known at that moment.
- A route into Python: a way to get DataFrames out.
- Storage that scales and expires: retention, compression, history.
- A license you can live with.
I checked what each vendor's pages documented for these. One caution for the whole article: "n/s" below means the page I read did not say, not that the feature does not exist.
InfluxDB 3 Core
The docs call InfluxDB 3 Core "the InfluxDB 3 open source release", with Parquet file persistence on local disk or object storage, an embedded Python VM for plugins and triggers, and a SQL reference built on DataFusion [1].
The feature split is the part ML teams should read twice. The same page lists what Enterprise adds: "Historical query capability and single series indexing", high availability, read replicas, row-level deletes and an admin UI [1]. So long-history queries are framed as an Enterprise capability, and model training usually wants long history.
On licensing, the repository shows "Apache-2.0, MIT licenses found" [1]. The pages I read did not document as-of joins or gap-filling in Core, and I did not run it, so treat those as n/s.
TimescaleDB
The README calls it "a PostgreSQL extension for high-performance real-time analytics on time-series and event data" [2]. It partitions data into time-based chunks, writes to a columnstore with "90%+ compression typical", and supports continuous aggregates that are materialized incrementally rather than rebuilt from scratch [2]. Bucketing is time_bucket() [2].
The pitch for ML teams is obvious: it is Postgres, so your existing SQL tools, drivers and habits carry over. The repository is labelled Apache-2.0, though the README does not explain how the license files apply to individual features [2].
I did not see a dedicated as-of join documented on that page, and the performance claims come with no benchmark method. Treat 90% compression as a vendor number until you measure it on your own data.
QuestDB
This was the best-documented one for my needs. Its SQL reference states that "ASOF JOIN matches each row in a time-series table with the most recent row in another time-series table whose timestamp is at or before the left row's timestamp", with an optional TOLERANCE clause that "rejects matches older than the given interval" [3].
The same reference covers SAMPLE BY with FILL(NONE, NULL, PREV, LINEAR, or constant) for evenly spaced buckets, and LATEST ON for the most recent row per key [3]. That is three of my five requirements documented in one place, which is why it wins the documentation contest rather than a benchmark.
What the pages did not settle: the license, and the Python client. I am not going to guess at either.
ClickHouse
ClickHouse documents toStartOfInterval(t, INTERVAL x unit) as the general form of its toStartOf* bucketing functions, and ORDER BY ... WITH FILL ... STEP for filling missing rows [4]. That is resampling and gap fill, both documented.
The page I read does not cover as-of joins, which tells you about the page, not the product. It is a general analytics database that handles time series well, but my reading was thin, so I will not rank it.
VictoriaMetrics
Its README labels the repository Apache-2.0 and says it "supports both PromQL and the more performant MetricsQL", as a single small binary with no dependencies [4]. That is a monitoring-shaped query language, not SQL.
No SQL is mentioned, which matters if your feature code is SQL-first. My read: a strong source of operational metrics, a less natural home for feature engineering, and not something I tested.
DuckDB (Honourable Mention)
DuckDB is not a server and does not claim to be a time series database, but it has the one operator this article is about, and unlike the others I could actually run it. I loaded 2,979 irregular readings and 500 events and joined them with ASOF JOIN ... ON ev.ts >= rd.ts.
It returned exactly the same values as pandas merge_asof(direction="backward") on all 500 events, maximum absolute difference 0.00e+00 [5]. For a single-file analytical store that is a serious answer for offline training.
The Thing That Actually Breaks Pipelines: The Join
Here is the code I ran. I generated 2,979 irregular sensor readings over 1,000 time units (mean gap 0.336) and 500 events, then attached a reading to each event three ways.
| Method | Result |
|---|---|
SQLite correlated subquery (WHERE r.ts <= e.ts ORDER BY r.ts DESC LIMIT 1) |
matched pandas backward on all 500 events (max diff 0.0) |
DuckDB ASOF JOIN ... ON ev.ts >= rd.ts |
matched pandas backward on all 500 events (max diff 0.0) |
pandas merge_asof(direction="nearest") |
picked a post-event reading on 49.0% of events |
Then I predicted each event's label from the joined reading with a linear model under 5-fold cross-validation:
| Joined feature | MAE |
|---|---|
| Backward (at or before the event) | 0.442 |
| Nearest (either side) | 0.399 |
Nearest looks better, and it is cheating: it borrows the future. Half of those rows contain a reading that had not happened yet when the label was created. In a pipeline that shows up as a model which validates beautifully and fails live.
I also tried a tolerance of 0.5 time units, the way QuestDB's TOLERANCE works. 124 of the 500 events then got no value at all, because no reading fell inside the window. That is the right behaviour: stale data should be missing, not silently reused.
Timing, for what it is worth on a table this small: pandas merge_asof 1.6 ms, the SQLite correlated subquery 1 ms, DuckDB ASOF JOIN 9 ms. That is one run of one query, not a benchmark, and the ordering would change with table size and indexing.
What the Coverage Table Does and Does Not Say
On the pages I read:
| Requirement | Documented where |
|---|---|
| As-of join | QuestDB [3], DuckDB (ran it myself) |
| Bucketing or gap fill | TimescaleDB [2], QuestDB [3], ClickHouse [4] |
| Long history | InfluxDB 3 Core lists it as an Enterprise feature [1] |
| License stated | InfluxDB (MIT/Apache-2.0 label) [1], TimescaleDB [2], VictoriaMetrics [4] |
| Python / DataFrame route | none of them, on the pages I read |
That last row says more about my sources than about the products. All of these have Python access in practice; I just could not confirm it from the pages I read.
How I Would Choose (Judgment, Not Evidence)
- Already on Postgres? Try TimescaleDB first, and verify the point-in-time join yourself.
- Need as-of joins and gap fill in SQL? QuestDB documents both, plus
LATEST ON. - Mostly operational metrics? VictoriaMetrics, accepting PromQL instead of SQL.
- Large analytic history with a dedicated cluster? Evaluate ClickHouse against your own queries.
- Small data and offline training? Parquet plus pandas or DuckDB may beat any server.
Common Pitfalls
- Choosing on ingest speed. Model quality is decided by the join, the gap rule and the history window.
- Using a nearest join because it scores better. It scored 0.399 against 0.442 and 49.0% of its rows were from the future.
- Silently reusing stale values. A tolerance turned 124 of 500 events into honest nulls.
- Assuming as-of joins exist because the product is a time series database. Only two of the pages I read documented one.
- Reading "open source" as a licence. One repository labels itself MIT and Apache-2.0 without explaining which parts apply.
- Treating a compression percentage as a benchmark. "90%+ typical" has no method attached.
- Skipping the Python route check. None of the pages I read documented it, so verify it before you commit.
Best Book to Read
| Cover | Book | Description | Get it |
|---|---|---|---|
![]() |
Time Series Databases: New Ways to Store and Access Data | a short, opinionated book on how time series storage differs from ordinary tables, which is the background that makes the as-of join argument obvious. | View on Amazon |
As an Amazon Associate I earn from qualifying purchases. Links on this page are affiliate links, and I may earn a commission at no extra cost to you.
Wrapping Up
The honest ranking of "best time series database for ML" does not exist without your data, your queries and a benchmark you run yourself. What I can say is where to look: point-in-time joins, gap handling and historical access matter more to model quality than ingest speed.
In my own run, SQLite and DuckDB reproduced the backward join exactly, and a nearest join bought a 0.043 MAE improvement by reading the future on 49.0% of rows. That is the whole argument in one table.
Take your most important feature query, write it as a backward as-of join, and run it on two candidates with a month of your own data. The one where that query is easiest to get right, and to keep right, is your answer.
Frequently Asked Questions
Which time series database is best for ML feature pipelines?
There is no single winner, and I did not benchmark the servers. The thing that decides model quality is whether the database can do a backward as-of join and handle gaps, and on the pages I read QuestDB documented both most explicitly, with ASOF JOIN, TOLERANCE and SAMPLE BY with FILL options. TimescaleDB and ClickHouse documented bucketing; DuckDB documented the as-of join and I ran it.
Can I do point-in-time joins in TimescaleDB?
It is Postgres, so you can express a backward as-of join in SQL, but the TimescaleDB README I read does not document a dedicated as-of join operator. That is a statement about the page, not the product. Test your own feature query on your own data before committing.
Why is a nearest-neighbour join dangerous when building training data?
Because it borrows the future. In my test a nearest join picked a reading that came after the event on 49.0% of the 500 events, and it produced a lower error (MAE 0.399 against 0.442 for the backward join) precisely because it was reading the future. A model trained on that looks excellent offline and fails live.
Do I need a time series database at all?
Not always. For a few million rows and offline training, Parquet files plus pandas or DuckDB will often beat running a server, and DuckDB ran the same as-of join in 9 milliseconds on my 2,979-reading table. Reach for a server when you need concurrent writers, retention policies and long history.
What should I test before choosing one?
Write your most important feature query as a backward as-of join, run it on two candidates with a month of your own data, and check how missing readings behave. Stale data should come back missing, not silently reused: with a tolerance of 0.5 time units, 124 of my 500 events correctly got no value.
Sources
[1]InfluxData, InfluxDB 3 Core documentation — the "open source release" description, Parquet persistence, the embedded Python VM, the Enterprise-only list including "Historical query capability and single series indexing", and the SQL reference: docs.influxdata.com/influxdb3/core. The licence label comes from the repository: github.com/influxdata/influxdb ("Apache-2.0, MIT licenses found").[2]Timescale, timescaledb README — the "PostgreSQL extension for high-performance real-time analytics" description, time-based chunks, "90%+ compression typical" in the columnstore, continuous aggregates that materialize incrementally, andtime_bucket(): github.com/timescale/timescaledb[3]QuestDB, SQL reference: ASOF JOIN — the at-or-before match definition and theTOLERANCEclause, with the sibling pages forSAMPLE BY(FILL(NONE, NULL, PREV, LINEAR, constant)) andLATEST ON: questdb.com/docs/reference/sql/asof-join[4]ClickHouse, Date and time functions (toStartOfInterval) and ORDER BY ... WITH FILL ... STEP: clickhouse.com/docs/sql-reference/functions/date-time-functions, clickhouse.com/docs/sql-reference/statements/select/order-by. VictoriaMetrics README for the Apache-2.0 label and "PromQL and the more performant MetricsQL": github.com/VictoriaMetrics/VictoriaMetrics[5]DuckDB, ASOF join guide — theASOF JOIN ... ON ... >=form I ran in DuckDB 2.0.0 against pandasmerge_asof: duckdb.org/docs/stable/guides/sql_features/asof_join
