RC RANDOM CHAOS

PostgreSQL 19 Adds Read-Your-Writes Consistency

· via Simon Willison

Original source

PostgreSQL 19 Released

Simon Willison →

PostgreSQL 19 arrived two months behind schedule due to a backlog of vulnerability fixes. The marquee feature addresses a core challenge in read-heavy distributed systems: applications reading from replicas need visibility into recently committed writes on the primary.

The WAIT FOR LSN command pauses replica queries until the standby has applied transaction log entries up to a specific point. After a write on the primary, the application captures the log sequence number and passes it to subsequent requests. The replica waits to replay that far before answering queries, guaranteeing read-after-write consistency. An optional timeout lets applications fail fast if replication lags too long.

This solves a problem Wikipedia already handles through custom MySQL replication logic. PostgreSQL’s native support removes the need to implement this in application code, simplifying architectures where reading from replicas is essential for scaling.

Read the full article

Continue reading at Simon Willison →

This is an AI-generated summary. Read the original for the full story.