Sep 6, 2026 · 17 min · 9 segments
In this episode of Scaling Postgres, we see examples of using WAIT FOR in PG 19 for handling read after write, local NVME vs block store, new system views and the ambiguity of NULL. To get the show…
Creston JamisonHost
This is from BoringSQL.com. And he starts off talking about the issue of where you've written something to the database, but yet maybe your front end is reading off the replica, and a lot of times you could see a latency from data appearing there.

And people try to get around this issue if they encounter it by pinning reads to the primary.

which means you're using your replicas less, or they add sleep delays, or maybe you set flags in Redis to determine what should be displayed.

But Postgres 19 looks like it's going to be releasing this wait for command, wait for a particular LSN before you read from it.

This is actually, you have the wall on the replica, but you now need to replay it into the database files.

So unfortunately, it's just going to take time and you can have things like maybe a bulk import or index maintenance going on that can slow things down.

And a final factor in the lag is how much activity is actually on the replicas.

because he looked at a case where load was applied to a replica, and when you had no load, the replay lag was 5 milliseconds.

I'm assuming this is a primary and a replica on the same machine that he's measuring, but the replay lag was 5 milliseconds.

When you applied pgbench with 8 clients, the replay lag increased to 25 milliseconds, and then when he added 48 clients, it increased to over 1 second.

He's using two containers on one host, a primary and an asynchronous streaming replica.

So he had eight concurrent workers and did a process of writes and reads a thousand times.

When you read from the primary, Of course, you're going to have zero stale reads.

This is from BoringSQL.com. And he starts off talking about the issue of where you've written something to the database, but yet maybe your front end is reading off the replica, and a lot of times you could see a latency from data appearing there.

And people try to get around this issue if they encounter it by pinning reads to the primary.

which means you're using your replicas less, or they add sleep delays, or maybe you set flags in Redis to determine what should be displayed.

But Postgres 19 looks like it's going to be releasing this wait for command, wait for a particular LSN before you read from it.

This is actually, you have the wall on the replica, but you now need to replay it into the database files.

So unfortunately, it's just going to take time and you can have things like maybe a bulk import or index maintenance going on that can slow things down.

And a final factor in the lag is how much activity is actually on the replicas.

because he looked at a case where load was applied to a replica, and when you had no load, the replay lag was 5 milliseconds.

I'm assuming this is a primary and a replica on the same machine that he's measuring, but the replay lag was 5 milliseconds.

When you applied pgbench with 8 clients, the replay lag increased to 25 milliseconds, and then when he added 48 clients, it increased to over 1 second.

He's using two containers on one host, a primary and an asynchronous streaming replica.

So he had eight concurrent workers and did a process of writes and reads a thousand times.

When you read from the primary, Of course, you're going to have zero stale reads.
The rest of this transcript — segmented and speaker-labeled, so you land on the exact moment something was said
Search every transcript — by keyword, by phrase, or by meaning, across every show Radar indexes
Trends — what is surging across podcasts, measured against its own baseline
Alerts — when a name you follow appears in a newly indexed episode
No account is needed to search Radar.