ClickhouseProblem & solution
OLTP is expensive, you can ClickHouse it.
Summary
PostgreSQL’s ACID guarantees cause substantial write amplification: each write flushes WAL for durability, copies rows via MVCC for isolation, and updates every affected index, amplifying 100 bytes of row change into tens of kilobytes of I/O. Costs scale linearly with data size, and even sharded Postgres offers only linear scaling with added coordination overhead, so growing datasets drive rising bills. The post proposes offloading settled, rarely-changing data to ClickHouse, whose columnar compression shrinks datasets 10-30x and whose cloud offering costs about 5x less than comparable Postgres infrastructure while also reducing Postgres compute load through fewer indexes. ClickHouse builds indexes in background batches and runs aggregations at roughly 100x lower cost than Postgres. ClickHouse Cloud provides WalShadow for millisecond-latency CDC and pg_clickhouse FDW, enabling an application pattern that cuts the cost of serving settled data by an order of magnitude.
Context
PostgreSQL’s ACID compliance imposes significant write amplification through WAL flushes, MVCC row copying, and index maintenance. These costs scale linearly with data volume, making large datasets expensive to store and query even after they stop changing. The post contrasts this with ClickHouse’s columnar compression, background indexing, and efficient aggregation, and describes how ClickHouse Cloud’s managed Postgres and native CDC tools enable offloading settled data to reduce costs by an order of magnitude.
Approach / What changed
ClickHouse Cloud provides a managed Postgres with local NVMe storage and WalShadow, a native CDC tool that replicates data to ClickHouse within milliseconds. pg_clickhouse is a foreign data wrapper enabling Postgres-protocol queries on ClickHouse tables. The application pattern keeps active, transactional data in Postgres while offloading settled, read-heavy data to ClickHouse, achieving order-of-magnitude cost reduction.
Takeaways
Postgres’s ACID guarantees cause significant write amplification through WAL, MVCC, and index updates, making it costly to store data that has stopped changing.
ClickHouse’s columnar compression typically reduces dataset size by 10-30x, and its cloud offering costs roughly 5x less than comparable Postgres infrastructure for storage and compute.
ClickHouse Cloud provides WalShadow for millisecond-latency CDC and pg_clickhouse FDW, enabling transparent queries of historical data via the Postgres protocol.
FAQ
Why does Postgres become expensive as data grows?
Postgres writes amplify each change through WAL flushes, MVCC row copies, and index updates, turning small changes into tens of kilobytes of I/O. Storage costs also scale linearly because every row is stored uncompressed in 8 KB pages, making settled data as expensive to keep as actively updated rows.
How does ClickHouse reduce storage and query costs?
ClickHouse uses columnar compression to shrink datasets 10-30x, charges about 5x less than Postgres cloud offerings, and builds indexes in background batches rather than per-transaction. Analytical queries and aggregations cost roughly 100x less because of purpose-built index structures and simpler concurrency.
What tools integrate Postgres and ClickHouse in ClickHouse Cloud?
ClickHouse Cloud includes WalShadow for real-time CDC with millisecond latency and pg_clickhouse, a foreign data wrapper that lets applications query ClickHouse using the Postgres protocol. This enables transparent offloading of settled data without application rewrites.
Source and freshness
- Source
- clickhouse.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.