
Milan Jovanović · 8 min readDatabases
Outbox Pattern in Postgres: Concurrent Workers vs Reading the WAL
The article compares polling workers using FOR UPDATE SKIP LOCKED with reading PostgreSQL's WAL via logical replication for outbox message delivery, showing trade‑offs in latency, throughput, and reliability. It provides code examples and benchmarks to help choose the right approach for low‑latency or high‑throughput needs.
- WAL replication delivers messages sub‑millisecond latency, outperforming polling workers.
- FOR UPDATE SKIP LOCKED enables safe concurrent workers but adds up‑to‑second delays.
- Both methods require idempotent consumers due to possible duplicate deliveries.