# The transactional outbox is the canonical fix for dual writes

Canonical URL: <https://datadriven.io/problems/the-transactional-outbox-is-the-canonical-fix-for-dual-write-dfb13ece>

Domain: Pipeline Design · Difficulty: medium

## Problem

The transactional outbox is the canonical fix for dual writes. The application writes only to the database; the same transaction that writes the business row also inserts an outbox row. A separate publisher drains the outbox to the broker. Either both rows commit or neither does. The section names two publisher implementations: a polling publisher that selects unpublished rows and updates published_at, and a CDC-driven publisher that reads the WAL via Debezium. Build the outbox by adding the outbox table, replacing the dual-write handler with one that writes both rows in one transaction, and adding a publisher whose name states which implementation it uses.

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/the-transactional-outbox-is-the-canonical-fix-for-dual-write-dfb13ece)
- [System Design Interview Questions](https://datadriven.io/data-engineering-system-design)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.