r/PostgreSQL 13d ago

Feature Read your writes: WAIT FOR in PostgreSQL 19

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

15 comments sorted by

View all comments

Show parent comments

u/rThoro 12d 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

u/znpy 12d 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 ?

u/rThoro 11d ago

yep, that's it!

u/znpy 11d ago

thank you!