Back

PostgreSQL 19 Released With WAIT FOR LSN Consistency
SiTech AI Team2 min read

PostgreSQL 19 Released With WAIT FOR LSN Consistency

PostgreSQL 19 was released on 19 November 2026, two months later than usual. Its new WAIT FOR LSN command helps applications read data they just wrote when reads go to standbys.

PostgreSQL 19 was released on 19 November 2026, according to Simon Willison's link post. The release came about two months later than the usual September timing, mainly because the PostgreSQL team had to address many issues tied to the ongoing AI-reported vulnerability situation. Among its changes, PostgreSQL 19 adds read-your-writes consistency for applications that send reads to standbys through a new WAIT FOR LSN command.

Release timing

Most years PostgreSQL ships a new release in September. This year's release came two months later, mainly because of the many issues the PostgreSQL team needed to address as part of the ongoing AI-reported vulnerability apocalypse.

WAIT FOR LSN

For applications that send reads to standbys, PostgreSQL 19 adds read-your-writes consistency with the new WAIT FOR LSN command. A session on a standby can use WAIT FOR LSN to wait until the standby has replayed the write-ahead log up to a specific log sequence number before running a query, so the application can read data it just wrote on the primary.

In practice, an application can run UPDATE movie SET genre = 'Dramatic' WHERE genre = 'Drama'; then SELECT pg_current_wal_insert_lsn(); and store the returned value, such as 0/0306EE20. On a subsequent request it can run WAIT FOR LSN '0/0306EE20' WITH (TIMEOUT '0.1s'); followed by SELECT * FROM movie WHERE genre = 'Drama';. The timeout is optional, and if one is provided the application gets an error if the replica does not catch up within the specified time.

Earlier precedent

Simon Willison wrote that he first encountered this pattern in Wikipedia, which has a hand-rolled version of it built against MySQL replication. MediaWiki attempts to ensure that users see events occurring on the wiki in chronological order. A few seconds of lag can be tolerated, as long as the user sees a consistent picture from subsequent requests.

This is done by saving the primary binlog position in the session, then at the start of each request waiting for the replica to catch up to that position before doing any reads from it. The relevant MediaWiki code now uses MySQL's WAIT_FOR_EXECUTED_GTID_SET() function and falls back to SOURCE_POS_WAIT().

Sources: Simon Willison

SiTech

SiTech — AI-powered web development

We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.