Skip to content
Tools · Dec 3, 2026

PostgreSQL 19 adds WAIT FOR LSN for read-your-writes consistency on standbys

The new command lets applications ensure they read data they just wrote on the primary by waiting for a standby to replay the write-ahead log up to a specified LSN.

Trust79
HypeLow hype

5 sources · cross-referenced

ShareXLinkedInEmail
TL;DR
  • PostgreSQL 19 introduces the WAIT FOR LSN command to provide "read-your-writes" consistency for applications that read from standbys.
  • The feature lets a session on a standby wait until it has replayed the write-ahead log up to a specific log sequence number before executing a query.
  • Applications can store the LSN from pg_current_wal_insert_lsn() and later use WAIT FOR LSN with an optional timeout to ensure consistency.
  • The PostgreSQL team delayed the release by two months due to AI-reported vulnerabilities.

PostgreSQL 19, released on November 19, 2026, adds a new command called WAIT FOR LSN that provides "read-your-writes" consistency for applications that send reads to standbys. With this feature, a session on a standby can wait until the standby has replayed the write-ahead log (WAL) up to a specific log sequence number (LSN) before running a query, ensuring the application can read data it just wrote on the primary.

To use the feature, an application first executes an update on the primary and retrieves the current WAL insert LSN using pg_current_wal_insert_lsn(). For example, an UPDATE statement on a movie table returns an LSN like 0/0306EE20. The application stores this value (e.g., in a signed cookie) and, on a subsequent request, issues WAIT FOR LSN with the stored LSN and an optional timeout. If the standby catches up within the timeout, the query proceeds; otherwise, an error is raised.

The PostgreSQL team attributed the two-month delay in the release to addressing a surge of issues stemming from AI-reported vulnerabilities, underscoring the growing role of AI-assisted security research in shaping release timelines.

This capability mirrors a pattern previously implemented by Wikipedia, which built a hand-rolled solution for MySQL replication to ensure users see events in chronological order. Wikipedia's approach saved the primary binlog position in the session and waited for the replica to catch up before executing reads. PostgreSQL 19's WAIT FOR LSN command provides a standardized, built-in mechanism for this use case, reducing the need for custom database-specific workarounds.

Sources
  1. 01Simon Willison — everything — PostgreSQL 19 Released
  2. 02PostgreSQL Global Development Group — PostgreSQL 19 Released
  3. 03Robert Haas (PostgreSQL contributor) — Postgres 19 is late and it's AI's fault
  4. 04PostgreSQL Documentation — WAIT FOR LSN (PostgreSQL 19)
  5. 05PostgreSQL Documentation — Write-Ahead Log Internals (PostgreSQL 19)
Also on Tools

Stories may contain errors. Dispatch is assembled with AI assistance and curated by human editors; despite the trust-score filter, mistakes happen. We correct publicly — every article links to its revision history. Nothing here is financial, legal, or medical advice. Verify before relying on any claim.

© 2026 Dispatch. No ads. No sponsorships. No paid placement. Reader-supported via Ko-fi.

Built by a person who cares about honest AI news.