4 ms·
> I miss the simplicity of postgres' upsert capabilities. T-SQL has MERGE, which is vastly more complicated and verbose. I get that it is quite powerful and fle
by petergeoghegan 9y ago
> I miss the simplicity of postgres' upsert capabilities. T-SQL has MERGE, which is vastly more complicated and verbose. I get that it is quite powerful and flexible, but I've never personally needed more than upsert semantics, and the design of MERGE means that I pay (in esoteric syntax) for features that I don't use.
I believe that SQL Server's MERGE does not actually support what you might call UPSERT semantics: http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Ra...
- pianoben 9y agoOh, I've never seen that before! We've never encountered this kind of MERGE-related race condition before, but I'm not sure that we'd recognize it if we did. Probably it would surface as a failed transaction, but our merges are pretty low-volume so it hasn't happened yet. Thanks for the link!
- philliphaydon 9y agoWe were using merge for a year before load increased and we ended up having deadlocks. After finding this blog and a couple of others, we removed the merge statements, deadlocks went away. I have no faith in merge anymore. :(