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

u/forurspam 13d ago

It’s gonna be legendary 

u/BarfingOnMyFace 13d ago

Hell yeah

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

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 11d 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!

u/[deleted] 12d ago edited 12d ago

[removed] — view removed comment

u/rThoro 12d ago

as explained here: https://www.reddit.com/r/PostgreSQL/s/j2mPkZOa4v

it's not about enforcing durability

u/Inkbot_dev 6d ago

I've been waiting for this feature since it was first discussed on the mailing list well over a decade ago. So freaking happy it's finally in.

u/AutoModerator 13d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.