Solved

merge join

Posted on 2010-11-17
10
579 Views
Last Modified: 2013-11-10
merge join in distinctively SSIS, not TSQL, right? how does it differ than the other kinds of join (inner, left, self etc)

thanks
0
Comment
Question by:anushahanna
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 167 total points
Comment Utility
Its in both....but they are essentially the same idea.

Inner/Outer/Full joins are LOGICAL joins in the database engine.  Nested Loop/Merge/Hash joins are the physical representations of the logical joins.  Nested loop joins are two outputs, usually a large input and a small input and the small input loops into the large input.  Merge has to sort the two inputs and then merge them together to join them.  Works really well if the inputs are already sorted.  Hash is for the looping scenario OR for two large inputs that are not indexed.  

No, the merge in SSIS is similar to the merge join in the db engine in that it has to physically sort (preceeded by a sort task) before you can merge the results.

Clear as mud?  :)
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
Correction:
No, the merge in SSIS is similar to the merge join in the db engine in that it has to physically sort (preceeded by a sort task) before you can merge the results.

...missed the w on Now.
0
 
LVL 30

Expert Comment

by:Reza Rad
Comment Utility
as Champandew noted this is exactly like join types in t-sql.
there are these types there:
inner join --> like inner join in t-sql
full outer join--> like full outer join in t-sql
left outer join --> like let outer join in t-sql
there in no right outer join in merge join transform, but you can only change inputs and use left outer join to have right outer join .

0
 
LVL 30

Assisted Solution

by:Reza Rad
Reza Rad earned 166 total points
Comment Utility
And note that when you want to use Merge Join Transform in SSIS , your inputs should be SORTED.
0
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 83 total points
Comment Utility
As indicated, MERGE JOIN is the physical method that SQL Server's optimizer may select to implement some of its JOIN implementations.   SQL MERGER JOIN is the procedural implementation of the SQL JOINS, which are themselves the implementations of the relational JOIN.

In SSIS, though there are order prerequisites that do not exists in the TSQL engine.

Hope this helps...
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 6

Author Comment

by:anushahanna
Comment Utility
thanks-

merge join in SSIS- is it possible to say 'No thanks for physical sorting - just inner join the 2 OLEDB input and give it in any sort order"
0
 
LVL 6

Assisted Solution

by:subhashpunia
subhashpunia earned 84 total points
Comment Utility
Then use other type of joins: Either Nested Loop or HASH join.
0
 
LVL 30

Assisted Solution

by:Reza Rad
Reza Rad earned 166 total points
Comment Utility
NO,
if you want to use Merge Join Transformation , so you SHOULD sort inputs.
if you don't want to sort inputs, you can use Lookup transformation ( if your inputs are oledb, and you have only ONE joining field) or use t-sql joins in OLEDB Source command if your inputs are both from single server.
0
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 167 total points
Comment Utility
>>merge join in SSIS- is it possible to say 'No thanks for physical sorting - just inner join the 2 OLEDB input and give it in any sort order"

Nope, you can't do a "merge join" without sorted inputs.
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
Thanks for the help on understanding the merge..
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now