PostgreSQL 19 Ships WAIT FOR LSN for Read-Your-Writes on Standbys
PostgreSQL 19 has been released, roughly two months later than the usual September cadence; Simon Willison attributes the delay mainly to the volume of security issues the team had to handle from AI-reported vulnerabilities. His pick of the release is WAIT FOR LSN: a session on a standby can wait until that standby has replayed the write-ahead log (the write log replicas follow) up to a given log sequence number before running a query. In practice an app writes on the primary, records the current LSN (a value like 0/0306EE20, a signed cookie works), and on the next request issues WAIT FOR LSN with an optional timeout before reading from the replica; if the timeout expires before the replica catches up, the statement errors. This gives read-your-writes consistency for applications that send reads to standbys, a pattern Wikipedia's MediaWiki has hand-rolled on MySQL for years. The feature is documented in the PostgreSQL 19 manual and available now in the release.
Teams that offload reads to replicas can now get read-your-writes consistency without routing those reads back to the primary or building their own lag check. The work is on the application side: capture the LSN after each write, carry it to the next request, and decide what timeout to use, since an expired timeout surfaces as an error the app must handle.