Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MERGE (Transact-SQL) performance

Posted on 2010-09-24
3
Medium Priority
?
514 Views
Last Modified: 2012-06-22
Hello guys,

I'm going to use MERGE command for loads where some tables will have about 2milions records. and incoming tables to compare will have 2 millions as well.

Do you know about any performance evaluation of MERGE command for MSSQL 2008?
(documents, blog, article, presentation, any)

MERGE manual- TechNet


Thanks
0
Comment
Question by:BlueArgonaut
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 33755196
the only "thing" you have to know is that MERGE will result in a full table scan for both the input and the output table ...which makes it a "simple" coding tool, but most often ineffective for larger tables ...
0
 

Expert Comment

by:JohnJMA
ID: 35887871
Angellll, if you want to merge tables, lets say summing TableA (daily data) into TableB (summerized weekly data) how would you recommend to do it so that when the daily data comes into TableA that TableB gets built on a running basis for the week Sun-Sat, i.e. for each day during the week the totals for that day are added to the weekly table.

Thanks.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35888572
for those tasks I usually use 2 tables:
1 with the summarized data, and 1 listing the dates processed (+ 1 action/status field)
that way, my process will know which days to (re)process, and if the action is to UPDATE or to INSERT summary data.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question