TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Postgres 15 Merge Command with Examples

145 pointsby winslettover 2 years ago

7 comments

ryantownsendover 2 years ago
This will make complex upserts so much more simple, fantastic addition.<p>I really hope `RETURNING` support gets added to `MERGE` asap though (I believe it&#x27;s been noted as a fairly trivial addition to come in future), then it&#x27;ll be super powerful for doing bulk upserts that require post-processing.
评论 #33239499 未加载
baqover 2 years ago
&gt; prior to Postgres 15, you could use the &quot;upsert&quot; method with the ON CONFLICTclause.<p>&gt; Now, MERGE can be used instead!<p>No mention of deadlocks in the article has me worried about thoroughness of the analysis.
评论 #33239801 未加载
alexchamberlainover 2 years ago
This sounds really cool; maybe slightly cleaner than an INSERT ... ON CONFLICT statement. However, is that the only advantage?
throw03172019over 2 years ago
Great to see!<p>My biggest gripe with ON CONFLICT upserts are the IDs (sequences) having gaps in them. Any good ways to prevent that?
评论 #33241828 未加载
评论 #33240766 未加载
评论 #33242215 未加载
评论 #33244590 未加载
albertopvover 2 years ago
In SqlServer you have to use MERGE with HOLDLOCK to avoid issues, is it possible in Postgres? Is it so by default?
ramraj07over 2 years ago
This is one of my favorite features in snowflake (I’m assuming they didn’t invent it) and am happy to see it in Postgres now.
datalopersover 2 years ago
Awesome. How the hell did it take 20 years to finally land?
评论 #33239609 未加载
评论 #33264576 未加载