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

In BTEQ, how are the session-mode parameters being set?

0 Answers  


I want to write one query How to get Matched records and unmatched records in table?

4 Answers   TCS,


How is MLOAD Client System restarted after execution?

0 Answers  


what is identity column in TD?

2 Answers   Wipro,


What are default access rights in teradata? What explicit right can be given to a user?

0 Answers  






If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?

0 Answers  


How to find duplicates in a table?

0 Answers  


What is differnce between Error code and Error Level in Bteq

6 Answers   IBM,


how many modules are there in telecome domain?how to explain the architecture?

0 Answers  


What are normalization, first normal form, second normal form and third normal form?

0 Answers  


What is the difference between global temporary tables and volatile temporary tables?

0 Answers  


Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Question is howcan we retrive the first number from two rows. Can any one help thanks in advance

5 Answers   IBM,


Categories