Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Merge - Pros and cons Expand / Collapse
Author
Message
Posted Saturday, November 23, 2013 5:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, July 25, 2014 5:46 AM
Points: 135, Visits: 373
Hi there,

Please any one help me out to understand what is MERGE ? and when to use it?

Also explain me the Pros and cons.

Thanks in Advance
Post #1517002
Posted Saturday, November 23, 2013 3:55 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:19 AM
Points: 4,320, Visits: 6,113
I gave a very good talk on MERGE that you can download here: http://sqlsaturday.com/217/schedule.aspx

Note you can View All Events and open the schedule page for every SQL Saturday that has ever happened. Anything you see of interest is freely available content. It is some of the best free learning on the web about SQL Server!!


Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1517045
Posted Tuesday, December 10, 2013 3:28 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:05 AM
Points: 2,036, Visits: 1,378
Can you not even be bothered to type "TSQL MERGE" into your favourite search engine? Jeez...
Post #1521436
Posted Tuesday, December 10, 2013 8:21 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 4:49 AM
Points: 556, Visits: 2,581
Dwain Camps posted a great article on Performance of the SQL MERGE vs. INSERT/UPDATE.

-- Alan Burstein



Read this article for best practices on asking questions.
Need to split a string? Try this (Jeff Moden)
Need a pattern-based string spitter? Try this (Dwain Camps)
My blog
Post #1521550
Posted Tuesday, December 10, 2013 8:49 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:19 AM
Points: 4,320, Visits: 6,113
Lempster (12/10/2013)
Can you not even be bothered to type "TSQL MERGE" into your favourite search engine? Jeez...


Which, or how many, of the 297000 returns that Google brings back would you suggest the OP read??


Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1521561
Posted Tuesday, December 10, 2013 2:17 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:05 AM
Points: 2,036, Visits: 1,378

Which, or how many, of the 297000 returns that Google brings back would you suggest the OP read??

How about number 1709? . The point I am making Kevin, as you well know, is that there is an expectation that posters at least try to do some basic research before posting.
Post #1521671
Posted Tuesday, December 10, 2013 10:32 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 4:04 AM
Points: 3,614, Visits: 5,228
Alan.B (12/10/2013)
Dwain Camps posted a great article on Performance of the SQL MERGE vs. INSERT/UPDATE.


If you read that, you should also look at the discussion thread where I ran some additional use cases using more memory, that sort of leveled the playing field.

http://www.sqlservercentral.com/Forums/Topic1508736-3122-1.aspx

This article may also be worth a look: A Hazard of Using the SQL Merge Statement



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1521737
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse