Why do Hash joins usually perform better than Merge Joins?



Why do Hash joins usually perform better than Merge Joins?..

Answer / narayana

In MERGE join rows to be join must be present in same AMP.. If the rows to be joined are not on the same AMP, Teradata will either redistribute the data or duplicate the data in spool to make that happen based on row hash of the columns involved in the joins WHERE Clause.Hash join takes place if one or both of the tables on each can fit completely inside the AMP's memory.AMP chooses to hold small tables in its memory for joins happening on ROW hash.
Usually optimizer will first identify a smaller table, and then sort it by the join column row hash sequence. If the smaller table is really small and can fit in the memory, the performance will be best. Otherwise, the sorted smaller table will be duplicated to all the AMPs. Then the larger table is processed one row at a time by doing a binary search against the smaller table for matched record.
Where as in MERGE join Columns to be join is Non INDEXED column. teradata will redistribute the table rows into SPOOL memory and sort them by hash code.So that matching data lies on same amp, so the join can happen on redistributed data

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More Teradata Interview Questions

how can i answer for question like teradat architecture in interveiw

4 Answers   TCS,


What are types of partition primary index (ppi) in teradata?

0 Answers  


Explain the term 'tables' related to relational database management system?

0 Answers  


What are the frequently used data types in teradata?

0 Answers  


what do you mean by INMOD Routines and OUTMODE Routines ?

3 Answers  


How is Teradata in current market?

4 Answers  


What is the syntax for case when statement?

0 Answers  


What is the maximum number of dml can be coded in a multiload script?

0 Answers  


What is TPD?

0 Answers  


what is use of PI(primary index) AND SI(secondary index)

2 Answers   Wipro,


Frnds.... i have one doubt we have the num like this +913757575......i want to remove 91 and i want lo load remaining data to the target table.. whinch function we can use in teradata????? Plz let me know.. thanks in advance

2 Answers  


What is a pseudo key? What is its use???

2 Answers   Mphasis,


Categories