Solved

MERGE (Transact-SQL) performance

Posted on 2010-09-24
3
503 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

632 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