Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 4 min read Release mediumAdept

Enhancing Postgres to ClickHouse replication using PeerDB

PeerDB hardened its Postgres-to-ClickHouse CDC pipeline in four ways. It continuously drains the logical replication slot into an S3 stage, so WAL can't pile up when ClickHouse is down. It tunes ClickHouse memory settings (max_block_size, max_insert_block_size, max_threads, memory_overcommit_ratio_denominator, dial_timeout) to stop out-of-memory and overcommit-tracker failures on small clusters. It adds Lua row-level transformations for things like PII masking. On the security side, it uses short-lived IAM role credentials plus attribute-based access control on its multi-tenant S3 staging buckets.

Related posts

  • How Seemplicity scaled real-time security analytics with Postgres CDC and ClickHouse

    ClickHouse easyNovice

    Seemplicity, a security remediation platform aggregating findings from 150+ tools, outgrew a Postgres-only design as heavy upserts, table bloat and multi-table joins across ~16 per-tenant tables slowed customer dashboards. It kept Postgres as the transactional layer and streamed changes into ClickHouse via PeerDB (now ClickPipes), choosing it over a Debezium–Kafka pipeline to avoid extra failure points. A multi-region staging-then-per-tenant-schema layout and denormalized AggregatingMergeTree tables with materialized views removed query-time joins. Dashboards that once took minutes now return in seconds or milliseconds, and storage is roughly 10 TB, an estimated 5–6x smaller than Postgres, while handling tens of billions of updates per month.

  • Postgres CDC in ClickHouse, A year in review

    ClickHouse mediumAdept

    A year after PeerDB's acquisition, Postgres CDC into ClickHouse via ClickPipes has grown to 400+ companies replicating over 200 TB per month, driven by real-time customer-facing analytics and data warehousing workloads. Key engineering changes include keeping logical replication connections open, because reconnects re-read WAL from restart_lsn and spiked lag. CTID block-based partitioning cut initial-load partition generation from 7+ hours to under a second, and 50+ pre-flight checks plus bucketed user-facing alerts cut on-call load by orders of magnitude. The biggest remaining gap is data modeling overhead from ReplacingMergeTree's asynchronous deduplication, which ClickHouse plans to address with lightweight UPDATEs and unique indexes.

  • PostgreSQL + ClickHouse as the Open Source unified data stack

    ClickHouse easyNovice

    An open source stack pairs PostgreSQL as the transactional system of record with ClickHouse for analytics, connected by PeerDB for change data capture and the pg_clickhouse extension, which transparently offloads analytical queries from Postgres to ClickHouse. Two patterns are described: CDC replication for operational analytics on application data, and split-writes for high-volume logs, metrics and events that never need to live in Postgres. Adopting it involves creating a ClickHouse database, replicating via PeerDB, configuring pg_clickhouse and pointing queries at its tables, so application changes stay minimal. A managed version in ClickHouse Cloud swaps PeerDB for ClickPipes and preinstalls the extension.

  • ClickHouse Partnership, improved Postgres Replication, and Disk Management

    Supabase mediumAdept

    Supabase and ClickHouse are partnering around a Postgres-for-transactions, ClickHouse-for-analytics stack that is becoming common among AI companies. The Supabase ClickHouse foreign data wrapper now supports ClickHouse parameterized views, so query parameters can be passed from Postgres into ClickHouse. Thirteen Postgres replication and memory parameters, including max_slot_wal_keep_size and max_wal_size, are now configurable through the CLI. This targets PeerDB CDC pipelines, where the default 1GB WAL limit could cause data loss. Disk space can also be split between database and WAL, for example 6GB/2GB on the Pro plan.

  • Postgres Meets Analytics: CDC From Neon to ClickHouse Via PeerDB

    Neon mediumAdept

    Neon serverless Postgres can serve as the transactional system of record while ClickHouse handles real-time analytics, with PeerDB streaming changes between them via Postgres logical replication. Setup involves creating a replication-capable user and a publication in Neon, enabling logical replication (wal_level=logical), creating a destination database and a user with insert/alter grants in ClickHouse, then defining peers and a CDC mirror in PeerDB with an initial snapshot and table selection. PeerDB, now owned by ClickHouse, is slated to power the Postgres CDC connector in ClickPipes.

The quest for software engineering knowledge.

Look:
Layout: