What I learned from a month with WalShadow on ClickHouse Managed Postgres
WalShadow, which decodes physical Postgres WAL outside the database and writes blocks directly to ClickHouse, held median replication latency near 0.4 s from 1 to 200,000 rows/s on a 16 vCPU source. ClickPipes, which uses logical replication, tracked its Sync interval (about 31 s median at the 60 s default) and saturated around 50,000–55,000 rows/s regardless of interval or pipe compute size. Data matched exactly across source and both destinations, and schema changes, restarts, resizes and destination stops needed no manual action. Caveats include temporary cross-table inconsistency from parallel per-table writes, fixed `_commit_ts`/`_lsn` on initially loaded rows that can break TTLs, materialized views seeing raw row versions, and commit-ordered delays behind large transactions.
Related posts
- Introducing WalShadow: Sub-second Postgres replication to ClickHouse from physical WAL
ClickHouse mediumAdept
WalShadow is an open-source engine that replicates Postgres to ClickHouse by decoding the physical WAL stream outside the source database, instead of using logical replication slots. It replays catalog records into a schema-only shadow Postgres to track schema changes, decodes heap records in parallel with Rust workers, batches rows into ClickHouse-native blocks and inserts them concurrently. Out-of-order arrival is handled by tagging rows with the source LSN, with barriers for schema changes and truncations. In a single-table benchmark on c8i.2xlarge instances it reached about 200 ms commit-to-visible latency and 289K rows/sec, versus about 10 s and 120K rows/sec for the logical-replication-based PeerDB.
- Postgres at Open House NYC
ClickHouse easyNovice
ClickHouse used its Open House NYC keynote to launch WalShadow, an open-source engine that replicates Postgres into ClickHouse from the physical WAL instead of logical replication. It decodes WAL outside the source and uses a schema-only shadow Postgres to track DDL, effectively making ClickHouse an analytical physical standby. On 8-vCPU instances it showed about 200 ms commit-to-visible latency and 300K rows/s, versus about 10 s and 120K rows/s for PeerDB. The keynote also opened a Google Cloud private preview of ClickHouse Managed Postgres and released a chdb Postgres extension that extends COPY to import from S3, GCS and Azure and outperformed DuckDB-based extensions on the NYC Taxi import benchmark.
- 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.
- How Infinitas Learning uses ClickHouse Managed Postgres to process billions of events for 1.6M unique learners
ClickHouse mediumAdept
Infinitas Learning runs transactional learner-result processing on Postgres, with PL/pgSQL functions serving as the API in place of an earlier Kafka/Flink event-sourced pipeline, and customer-facing analytics on ClickHouse. Migrating Postgres from Neon to ClickHouse Managed Postgres took two days: 750 GB copied in 16 hours and a zero-downtime cutover via logical replication. P50 fell to double-digit microseconds. On the analytics side, tail latency spikes of up to 13 s came from cache misses on a high-cardinality UUID primary key combined with continuous inserts. The team self-hosted ClickHouse, returned to Cloud after merge and read tuning with support, and then used distributed cache prewarming to bring P99 to 410 ms against a 500 ms SLA.
- Change Data Capture (CDC) with PostgreSQL and ClickHouse - Part 1
ClickHouse mediumAdept
Postgres-to-ClickHouse CDC can be built by streaming row changes from Postgres logical decoding (pgoutput plugin, replication slots, LSN ordering) through Debezium and Kafka, then applying them in ClickHouse with the ReplacingMergeTree engine. Updates and deletes become immutable inserts carrying a version column and a deleted flag, and background merges collapse duplicates. Correct results before a merge require FINAL at query time. Consumers must tolerate duplicate events after restarts, and deleted rows are only purged when clean_deleted_rows is set to Always, a setting with a known bug as of 23.5. The post also compares pull-based and push-based CDC and explains why a Kafka queue protects the Postgres WAL from growing when ClickHouse is unavailable.