Conversation

MERGE is most noticeable, but will we prefer it over INSERT … ON CONFLICT, given the fact that it lacks RETURNING and, most importantly, it will be failing with errors when multiple sessions target the same rows? Does it have good use cases except migration from ora/ms?
Quote Tweet
Pretty sure this is the feature everyone is most excited about with Postgres 15 - MERGE crunchydata.com/blog/a-look-at
3
5
Replying to
MERGE is a truly declarative statement for reconciling one table with another. It can use any available join strategy, which can make performance robust even as things like the underlying cardinality change (like any optimizable statement).
1
4
Arguably MERGE has race conditions, but context/expectations are important. Has race conditions relative to what? With what transaction isolation level, under what circumstances? You can have the same race conditions with multiple statements, too.
2
Replying to
And RETURNING :) Very often, I want to see the result. So far, it looks like ON CONFLICT will be the default choice for me -- but maybe I'll find some precise use case for MERGE at some point (beyond migrations).
2
4