# PostgreSQL + ClickHouse Recovery: Test the Whole Data Service

DevFeed: [PostgreSQL + ClickHouse Recovery: Test the Whole Data Service](<https://devfeed.tech/articles/postgresql-clickhouse-recovery-test-the-whole-data-service-132583.md>)

Original publisher: [Read original article](<https://severalnines.com/blog/postgresql-clickhouse-recovery-test-the-whole-data-service/>)

Author: Jessie Baynas

Published: 2026-11-13T11:47:17Z

Content type: tutorial

Language: en

Sources: [SeveralNines](<https://devfeed.tech/sources/severalnines.md>)

Topics: [Disaster Recovery](<https://devfeed.tech/topics/disaster-recovery.md>), [DataOps](<https://devfeed.tech/topics/dataops.md>), [Apache Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [Synthetic Data Generation](<https://devfeed.tech/topics/synthetic-data-generation.md>)

Tags: [acceptance](<https://devfeed.tech/tags/acceptance.md>), [analytics](<https://devfeed.tech/tags/analytics.md>), [application](<https://devfeed.tech/tags/application.md>), [backup](<https://devfeed.tech/tags/backup.md>), [backup-management](<https://devfeed.tech/tags/backup-management.md>), [change-data-capture](<https://devfeed.tech/tags/change-data-capture.md>), [clickhouse](<https://devfeed.tech/tags/clickhouse.md>), [clustercontrol](<https://devfeed.tech/tags/clustercontrol.md>), [data](<https://devfeed.tech/tags/data.md>), [debezium](<https://devfeed.tech/tags/debezium.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [modern-data-stack-operations](<https://devfeed.tech/tags/modern-data-stack-operations.md>), [offset](<https://devfeed.tech/tags/offset.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [reconciliation](<https://devfeed.tech/tags/reconciliation.md>), [recovery](<https://devfeed.tech/tags/recovery.md>), [restoration](<https://devfeed.tech/tags/restoration.md>), [restore](<https://devfeed.tech/tags/restore.md>), [service](<https://devfeed.tech/tags/service.md>), [test](<https://devfeed.tech/tags/test.md>), [updates](<https://devfeed.tech/tags/updates.md>)

## AI overview

A green restore and zero Kafka lag do not prove that ClickHouse analytics are correct. In this PostgreSQL-Debezium-Kafka-ClickHouse exercise, the team records the backup's last applied Kafka offset, rewinds the consumer group before restoring, then waits for a source-backed, stable recovery boundary. It reconciles PostgreSQL and ClickHouse against independently generated expected results, checking keys, values, updates, deletes, outage-window inserts, and the dashboard query. ReplacingMergeTree checks use FINAL or version-based selection and filter delete markers; LSN versions make replayed events idempotent. The walkthrough's negative test skips the rewind: ingestion resumes and lag reaches zero, yet pre-outage updates and a delete are missing. PostgreSQL can rebuild ClickHouse only while it retains all needed rows; purged history depends on ClickHouse backups and retained Kafka events. The lab timings are not production targets, and PostgreSQL loss, Kafka loss, node loss with on-node backups, and retained-history recovery are outside the tested sequence.

## Source excerpt

A successful restore does not prove that an analytics service is delivering correct data. This PostgreSQL + ClickHouse walkthrough uses Debezium and Kafka to test backup restoration, offset replay, updates, deletes, and application-level reconciliation--including a negative test that catches a seemingly healthy but incomplete recovery. The post PostgreSQL + ClickHouse Recovery: Test the Whole Data Service appeared first on Severalnines.