Quick Decision Rule: When Syncing millions of Postgres mutations—including hard `DELETE`s—to Elasticsearch and Kafka with sub-second latency and minimal DB CPU impact, choose Log-based Change Data Capture (Debezium reading Postgres WAL / MySQL binlog) capturing inserts, updates, and hard deletes with near-zero query overhead.
| Trigger Condition | Syncing millions of Postgres mutations—including hard `DELETE`s—to Elasticsearch and Kafka with sub-second latency and minimal DB CPU impact |
|---|---|
| Recommended Choice | Log-based Change Data Capture (Debezium reading Postgres WAL / MySQL binlog) capturing inserts, updates, and hard deletes with near-zero query overhead |
| Classic Trap | Polling `WHERE updated_at > ?` hammers primary DB indexes, misses hard `DELETE` rows completely, and drops concurrent in-flight transaction timestamps. |
| Verification | Audited on 2026-11-23 · Distributed Systems Core · 2026 |
30-SECOND DECISION TRAP CHECK · STORAGE
A sync worker polls PostgreSQL every 5 seconds (`SELECT * FROM products WHERE updated_at > $last`) to update Elasticsearch. Customers complain deleted products still appear in search forever and primary DB CPU spiked 35%. Best replacement?
Polling `updated_at` misses hard `DELETE`s entirely and taxes primary DB indexes; log-based CDC reads the WAL sequentially with near-zero query overhead.
Trap: Timestamp polling misses hard deletes and concurrent uncommitted transaction timestamps.