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.
5 sources · cross-referenced
- 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.
- Dec 3, 2026 · Hugging Face
IBM time-series foundation models now run natively in Confluent’s streaming platform
Trust79 - Dec 3, 2026 · Hugging Face Blog
RadixArk releases DaisyRose-27B, a post-trained agent model with efficiency gains and open-source tooling
Trust79 - Dec 3, 2026 · Hugging Face
Hugging Face researchers propose ML model to predict fine-tuning job duration on shared GPU clusters
Trust79