DATABASES Signal 169
PostgreSQL 19 introduces WAIT FOR, a SQL command that blocks until WAL reaches a given LSN
PostgreSQL 19's new WAIT FOR command lets a session block until WAL has reached a specific position, providing read-your-writes consistency on asynchronous replicas without synchronous replication overhead.
For engineers running read replicas, WAIT FOR removes the need for application-side polling or synchronous replication to guarantee a read sees a recent write. It lets a read wait only as long as needed for the replica to catch up, and it exposes wait events for monitoring. However, it does not understand timelines, so after a promotion a success may refer to WAL from a different timeline.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
WAIT FOR blocks until the standby has replayed WAL up to a specified LSN, then the read proceeds.
It supports modes standby_replay, standby_flush, standby_write, and primary_flush, with TIMEOUT and NO_THROW options.
Unlike synchronous_commit=remote_apply, writes stay asynchronous; only reads that need the guarantee wait.
THE CLUSTER
↗