Skip to content

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

ClickHouse 4 min read Announcement mediumAdept

TimescaleDB to ClickHouse replication: Use cases, features, and how we built it

ClickPipes' Postgres CDC connector, built on PeerDB, now replicates TimescaleDB hypertables into ClickHouse for one-time migrations, staged migrations, or running both databases side by side. Hypertables do not support publish_via_partition_root, so the connector looks up each chunk's parent hypertable itself. It captures new chunks by adding the _timescaledb_internal schema to the Postgres publication. Compressed hypertables reject ctid-based parallel snapshotting, so the connector detects this case and falls back to a single-threaded load that uses cursors and Avro+Zstd.

Assumes: Postgres logical replicationchange data capturetable partitioning

Related posts

  • 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.

  • Change Data Capture (CDC) with PostgreSQL and ClickHouse - Part 2

    ClickHouse mediumAdept

    A Postgres-to-ClickHouse CDC pipeline is built with Debezium, Kafka Connect and a ClickHouse materialized view, keeping a ReplacingMergeTree table in sync with the 28M-row UK property price dataset under a mix of inserts, updates and deletes. Key configuration choices include REPLICA IDENTITY FULL (required for delete support), the pgoutput logical decoding plugin, per-row ordering via a single or hash-partitioned Kafka topic, and version/deleted columns in the ReplacingMergeTree engine. The ORDER BY is chosen for analytical access patterns, with the Postgres id appended last for uniqueness. The initial load uses the postgresql table function via INSERT INTO SELECT, which loads all 28M rows in about 80 seconds without tuning but requires pausing writes; Debezium's consistent snapshot is the alternative.

  • 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.

  • Streamkap: An out-of-the-box CDC solution for ClickHouse

    ClickHouse mediumAdept

    Streamkap's ClickHouse connector streams change data capture from PostgreSQL, MySQL, SQL Server, Oracle and MongoDB into ClickHouse using Kafka, Debezium and Flink. It maps Kafka Connect types, including nested structs and arrays, to ClickHouse types such as Tuple and Array, and adds metadata columns like op type, source timestamp and delete flag to every row. Append mode writes every change to MergeTree tables, while the default upsert mode uses ReplacingMergeTree keyed on the event timestamp and a delete flag, so queries need FINAL to get deduplicated results. The post also covers handling inconsistent semi-structured source data and choosing between blocking and incremental snapshots for the initial load.

The quest for software engineering knowledge.

Look:
Layout: