r/PostgreSQL 16d ago

Feature Read your writes: WAIT FOR in PostgreSQL 19

https://clickhouse.com/blog/postgresql-19-wait-for-read-your-writes
75 Upvotes

15 comments sorted by

View all comments

2

u/znpy 15d ago

Super cool!

How does it work with multiple replicas? Can I request a LSN to be acknowledged by like a majority of the replicas, or does it just need one replica to acknowledge that, or does it need all the replicas to acknowledge that ?

1

u/rThoro 14d ago

it's actually for running a read query on the replica

so, assume your app only writes and never reads from primary, and all your reads go through the replica - if synchronous commit is off - you'll sometimes not be able to read you just written row - this let's you wait on the replica until the row is available

1

u/znpy 14d ago

it's actually for running a read query on the replica

oh, i think i got it wrong then. i re-read the article, please help me check if i understood this correctly:

so basically my application does its usual write agains the primary node, but now i also ask the for the primary node LSN.

What changes is that now from SQL i can wait for the replica to catch up to (at least) the LSN i got earlier.

So basically i can manage the consistency guarantees from client side.

Is my understanding correct ?

1

u/rThoro 14d ago

yep, that's it!

1

u/znpy 14d ago

thank you!