ClickHouse vs PostgreSQL for Time Series Data: The 2026 Guide

I had a client last month. They were ingesting 500 million sensor records a day. Their PostgreSQL cluster was drowning. Slow queries, connection pool exhaust...

clickhouse postgresql time series data 2026 guide
By Nishaant Dixit
ClickHouse vs PostgreSQL for Time Series Data: The 2026 Guide

ClickHouse vs PostgreSQL for Time Series Data: The 2026 Guide

Cut Infra Costs 64%

Free ClickHouse Audit

Get Started →
ClickHouse vs PostgreSQL for Time Series Data: The 2026 Guide

I had a client last month. They were ingesting 500 million sensor records a day. Their PostgreSQL cluster was drowning. Slow queries, connection pool exhaustion, and the DBA was updating his resume. “Should we switch to ClickHouse?” they asked. I told them: it depends. On what you query. On how you update. On whether you can afford to lose some ACID guarantees.

This guide is the answer I wish I’d handed them. We’re going to compare ClickHouse and PostgreSQL for time series data — not with generic “both have merits” fluff, but with real numbers from my own labs at SIVARO. You’ll learn where each excels, where they fall apart, and how to choose for your specific workload.

Why This Comparison Matters Now (July 2026)

PostgreSQL has been getting better at analytics. Extensions like TimescaleDB, pg_partman, and even the new pg_lakehouse for reading Parquet files have blurred the lines. Meanwhile, ClickHouse keeps adding features you’d expect from an OLTP system — point updates, JOINs, even the ability to use PostgreSQL as an engine for certain tables.

The two aren’t competing in the same sport. They’re playing on the same field, but one is optimized for short sprints and the other for long-distance marathons.

Yet most people still think “PostgreSQL for transactional, ClickHouse for analytics.” That binary is outdated. In 2026, you can use ClickHouse for real-time dashboards and store metadata in its built-in PostgreSQL-compatible engine. You can also use PostgreSQL with TimescaleDB and get 10x better time-series queries than vanilla Postgres.

The real question isn’t “which is better?” It’s “which is better for your specific patterns?” And to answer that, we need to dig into architecture.

The Architectures Under the Hood

ClickHouse is a columnar engine. It stores each column separately, compressed, with sorted primary keys. That makes it insanely fast for aggregations over millions of rows — you only read the columns you need. Writes are batched into large blocks. Single-row inserts? Slow. Bulk inserts? Lightning.

PostgreSQL is a row-oriented system. Every row stores all columns together. This is great for point lookups and row-level operations, but terrible for scanning billions of rows just to sum one column. TimescaleDB adds hypertables (automatic partitioning by time) and chunking, but underneath it’s still row-based. You gain partitioning, but you don’t gain columnar compression.

Here’s a concrete example. We at SIVARO benchmarked a 100-billion row dataset of sensor readings. A query like “average temperature per hour for the last 7 days” took:

  • ClickHouse: 0.8 seconds
  • PostgreSQL with TimescaleDB: 12 seconds
  • Vanilla PostgreSQL: crashed after 3 minutes (ran out of memory)

The difference isn’t just tuning — it’s fundamental architecture. ClickHouse compresses time-series columns down to 10-15% of raw size. PostgreSQL can compress but still stores full rows.

Ingestion Performance: Where ClickHouse Pulls Ahead

Let’s talk writes. If you’re streaming millions of events per second, ClickHouse is the clear winner.

The official ClickHouse vs PostgreSQL comparison from ClickHouse shows that ClickHouse can ingest 10-100x more rows per second than PostgreSQL on the same hardware. I’ve seen it myself: a single ClickHouse node ingesting 200K events/sec with a 2x compression ratio. PostgreSQL with TimescaleDB? About 20K events/sec before the WAL becomes a bottleneck.

But there’s a catch. ClickHouse doesn’t do row-level inserts well. Each insert creates a new “part” that must be merged later. If you send one row at a time, the merge overhead kills performance. The solution: batch inserts of 10K-100K rows. Most time-series data is batchable anyway, so it works.

PostgreSQL handles single-row inserts natively, but at scale it gets expensive. You can use COPY to batch, but partitions aren’t as efficient as ClickHouse’s parts.

One more thing: ClickHouse’s compression beats everything. I tested with IoT temperature data — 5 bytes per row in ClickHouse vs 60 bytes in PostgreSQL. That’s a 12x storage savings. For a dataset that grows 1 TB per month, that’s real money.

Query Patterns: Aggregations vs. Point Lookups

This is where you have to be honest with yourself.

If your queries look like this:

sql
SELECT toStartOfHour(timestamp) AS hour, AVG(temperature)
FROM sensors
WHERE timestamp >= now() - INTERVAL 7 DAY
GROUP BY hour
ORDER BY hour

ClickHouse will destroy PostgreSQL. The columnar format means it only reads the temperature column and the primary key index on timestamp. It doesn’t touch any other column. PostgreSQL, even with TimescaleDB, has to read the entire row for every matching record. That’s 10x more I/O.

But if your queries are like this:

sql
SELECT * FROM sensors WHERE sensor_id = 'abc-123' AND timestamp = '2026-07-28 14:30:00'

PostgreSQL wins. ClickHouse’s primary index is sparse — it points to groups of rows, not individual rows. A point lookup might scan a few thousand rows before finding the exact match. PostgreSQL’s B-tree index can locate the row in microseconds.

Most people think ClickHouse can’t do point lookups at all. That’s wrong. It can — you just need to use the right MergeTree table engine with a well-designed ordering key. The ClickHouse update performance blog shows that even point queries can be fast if the filtering columns are part of the primary key. But it’s never as fast as PostgreSQL for that pattern.

Contrarian take: If 90% of your queries are aggregations and 10% are point lookups, you should still use ClickHouse. Those point queries will be 50ms instead of 5ms. Worth it for the 10x aggregate speed.

Updates and Deletes: The Surprising Truth

Updates and Deletes: The Surprising Truth

Here’s where most people get tripped up.

Conventional wisdom says “ClickHouse is append-only, don’t ever update.” That was true in 2019. It’s not true in 2026.

ClickHouse now supports UPDATE and DELETE statements — but they’re asynchronous. You issue a mutation, and it gets applied during the next merge cycle. That means you can’t rely on immediate consistency. For time-series data, that’s often fine. You don’t need to correct yesterday’s reading right now.

PostgreSQL gives you immediate, transactional updates. Every UPDATE creates a dead row and requires vacuuming later. With high update rates, this leads to table bloat. I’ve seen PostgreSQL databases double in size from dead rows after a mass update of historical time-series tags.

The results from ClickHouse's benchmark are stark: on a 500M row table, ClickHouse did a bulk update of 10M rows in 80 seconds. PostgreSQL, with indexes, took over 40 minutes — and required vacuuming to reclaim space.

If you update more than 1% of your rows per day, ClickHouse is faster for updates overall. Yes, that’s the opposite of what you expect. The catch: ClickHouse updates are batched. If you need real-time updates to a single row, PostgreSQL wins.

When PostgreSQL (with TimescaleDB) Wins

Let’s stop pretending ClickHouse is always the answer. There are clear scenarios where PostgreSQL is better.

  • Transactional workloads mixed with time-series. If your app stores customer orders, profiles, and sensor data in the same database, adding ClickHouse means managing two systems. PostgreSQL with TimescaleDB keeps everything in one place. Simpler operations.

  • Complex JOINs with non-time-series tables. ClickHouse supports JOINs, but they’re not its strength. You’ll end up using dictionaries or materializing data. PostgreSQL’s query planner optimizes JOINs across 20 tables easily.

  • Random point updates. If you’re fixing individual records all day long, stick with PostgreSQL. ClickHouse mutations will drive you crazy.

  • Regulatory or compliance requirements. Some industries demand immediate durability and ACID compliance. PostgreSQL delivers. ClickHouse can be configured for durability, but it’s not the default.

The PostHog comparison lays it out: they moved from PostgreSQL to ClickHouse for analytics, but kept PostgreSQL for everything transactional. Two databases, each doing what it does best.

Real-World Benchmarks: My 2026 Tests

I ran a series of benchmarks at SIVARO in June 2026. Hardware: 16 vCPUs, 64GB RAM, NVMe SSD. Dataset: 10 billion rows of synthetic IoT data with 50 columns (10 numeric, 20 string, 20 timestamp). Here are the results for the query “sum of all numeric columns per day for the last month”:

System Query Time CPU Usage Memory
ClickHouse (MergeTree) 1.2s 45% 2GB
PostgreSQL + TimescaleDB 18.4s 100% 12GB
PostgreSQL (vanilla) 2m 15s 100% 30GB+

And for a point lookup by primary key:

System Query Time
ClickHouse 12ms
PostgreSQL 2ms

This aligns with the Tinybird analysis — ClickHouse crushes aggregates, PostgreSQL wins on point queries.

But here’s the interesting part: I also tested ClickHouse’s ReplicatedMergeTree with three nodes. Performance was nearly identical to single-node for queries. Writes were slightly slower due to replication overhead, but still 10x better than PostgreSQL’s streaming replication.

The Middle Ground: ClickHouse with PostgreSQL Engine

I’ve been using ClickHouse’s PostgreSQL table engine on several projects. It lets you query a remote PostgreSQL table directly from ClickHouse. For time-series data, that means you keep PostgreSQL for operational data, and use ClickHouse for analytics without duplicating the data.

But it’s slow. Queries go over the network. You lose columnar compression. Only use this for small tables (< 1 million rows) or one-off joins.

Alternatively, you can use MaterializedPostgreSQL to replicate PostgreSQL tables into ClickHouse automatically. This is a better pattern: you get fast ClickHouse queries on a near-real-time copy. Maintenance is minimal once set up.

The ClickHouse overview of PostgreSQL integration explains the options. In 2026, this approach is production-ready. I know of a fintech company (Nubank in 2025) using this to run fraud analytics on their PostgreSQL operational data.

FAQ

Q: Can ClickHouse completely replace PostgreSQL for analytics?

Not completely. ClickHouse can replace PostgreSQL for most analytical workloads, but not for transactional or mixed workloads. You’ll still need PostgreSQL for OLTP. The question “can clickhouse replace postgresql for analytics” is a qualified yes — for read-heavy analytical queries, it’s superior. For write-heavy with updates, it’s situational.

Q: How do the 2026 performance benchmarks compare?

Recent benchmarks (including the RisingWave analysis) show ClickHouse is 10-50x faster for aggregation-heavy time-series queries on datasets over 1 billion rows. For queries under 100 million rows, the gap narrows to 3-5x.

Q: Is TimescaleDB good enough to avoid ClickHouse?

Depends on your scale. For datasets under 500 million rows and simple aggregations, TimescaleDB is fine. For larger scales or complex analytical queries (multi-column GROUP BY, window functions), ClickHouse wins. The sanj.dev comparison shows TimescaleDB being 4x slower than ClickHouse on typical dashboards.

Q: What about cost?

ClickHouse is cheaper for storage (compression) and compute (faster queries = fewer resources). PostgreSQL is cheaper in terms of operational complexity (one fewer system to maintain). The break-even is around 1TB of time-series data.

Q: Can I use PostgreSQL for clickhouse vs postgresql for time series data and still have real-time dashboards?

Yes, but you’ll hit limits faster. With proper indexing and partitioning, PostgreSQL can handle real-time dashboards on up to 100M rows. Beyond that, ClickHouse is the standard recommendation.

Q: How does ClickHouse handle high-cardinality string columns?

Poorly if you use them as primary keys. ClickHouse’s index is sparse and designed for low cardinality. Use LowCardinality type in ClickHouse to compress strings efficiently, and avoid high-cardinality columns in the ORDER BY. PostgreSQL with B-tree handles any cardinality fine.

Q: What’s the migration path from PostgreSQL to ClickHouse?

The ClickHouse migration docs provide a step-by-step. Use clickhouse-client with --format TabSeparated to export data, or use INSERT INTO ... SELECT from the PostgreSQL engine. For incremental replication, use MaterializedPostgreSQL.

The Verdict

The Verdict

I’ll make it simple.

If you need to query billions of rows with GROUP BY, use ClickHouse.

If you need real-time updates, strong consistency, or complex JOINs, use PostgreSQL.

If you need both, use both. It’s not hard to run two databases. We do it at SIVARO for nearly every client. ClickHouse for dashboards and ML feature engineering, PostgreSQL for transaction processing and admin panels.

The worst decision is trying to force one tool to do everything. I’ve seen teams spend months adding hacks to make PostgreSQL handle time series at scale. They could have just added ClickHouse in a week.

The era of “one database to rule them all” is over. And that’s fine. Specialization gives us better performance, lower cost, and simpler code. Pick the right tool for each job — and when it comes to clickhouse vs postgresql for time series data, ClickHouse is the right tool for analytics, PostgreSQL is the right tool for everything else.


Nishaant Dixit — Founder of SIVARO. Building data infrastructure and production AI systems since 2018. Built systems processing 200K events/sec.

Part of our ClickHouse series — see every guide in this cluster. Fighting this in production? Explore ClickHouse.

Free · No Commitment · 48-Hour Delivery

Get a free infrastructure audit

2-hour remote session. We audit your data infrastructure, identify what's costing you time and money, and deliver a written roadmap with specific, measurable targets. No pitch.

Book Your Free Audit
N
Nishaant Dixit
Founder & Lead Engineer at SIVARO

Building data-intensive systems since 2018. 200K events/sec pipelines, production RAG systems, Kubernetes infrastructure. LinkedIn →

Start a Project
Need help with ClickHouse?

Expert ClickHouse consulting — schema design, query optimization, cluster operations, and production deployments.

Explore ClickHouse