Tuesday, April 7, 2009

SQL - Difference Between Hash Join & Merge Join

Difference Between Hash Join & Merge Join

Merge Join :Oracle performs a join between two sets of row data using the mergejoin algorithm. The inputs are two separate sets of row data. Output isthe results of the join. Oracle reads rows from both inputs in analternating fashion and merges together matching rows in order togenerate output. The two inputs are sorted on join column.

Hash Join :Oracle performs a join between two sets of row data using hash joinalgorithm. Input and Output same as Merge Join. Oracle reads all rowsfrom the second input and builds a hash structure (like has table injava), before reading each row from the first input one at a time. Foreach row from the first input, the hash structure is probed and matchingrows generate output.
SQL - Difference Between Hash Join & Merge Join
Blogged with the Flock Browser

No comments:

Post a Comment