GUIDE
Capture every change from your PostgreSQL database in real-time. This tutorial shows how to set up CDC from PostgreSQL to RisingWave, create streaming materialized views on live data, and serve fresh results instantly.
How It Works
PostgreSQL Change Data Capture works by reading the database's write-ahead log (WAL). Every INSERT, UPDATE, and DELETE is first written to the WAL before being applied to tables. CDC readers consume this log stream to capture a complete, ordered record of every change — without polling, triggers, or timestamp columns.
| Approach | Write Overhead | Latency | Coverage | Integration |
|---|---|---|---|---|
| WAL-Based (RisingWave) | Zero | Sub-second | Every change | Native |
| Trigger-Based | 2x writes | Low | Every change | Fragile |
| Poll-Based | Read load | Minutes | Misses deletes | Requires timestamp cols |
| Log-Based (Debezium) | Zero | Sub-second | Every change | Requires Kafka Connect |
Use Cases
PostgreSQL CDC streams unlock a wide range of real-time use cases that were previously impossible or prohibitively complex with batch ETL. By streaming changes from your operational database into RisingWave, you can build real-time dashboards, search indexes, cache layers, audit systems, and cross-service data products — all driven by SQL.
Create materialized views that aggregate order counts, revenue, and metrics. Dashboards query RisingWave instead of hitting the production database.
Sink CDC changes to Elasticsearch or OpenSearch. Keep search indexes in sync with your database automatically, replacing fragile dual-write patterns.
Join CDC streams from multiple PostgreSQL databases into unified materialized views. Build cross-service data products without tight coupling.
Capture every change with before/after values. Build immutable audit logs and compliance reports that track who changed what and when.
Step-by-Step
Setting up PostgreSQL CDC with RisingWave requires three steps: enable logical replication on your PostgreSQL instance, create a CDC source in RisingWave pointing to your database, and define materialized views over the CDC stream. The entire process takes minutes and uses standard SQL throughout.
Start capturing database changes with SQL in minutes.
Start Streaming PostgreSQL Changes