Quote:
Originally Posted by db2girl
Can you explain why hash join cannot use indexes?
|
That's the way hashing algorithm works.
www.devx.com/assets/ibm/3145.pdf
From the doc:
"The inner table (called the build table) is scanned first, and the rows are copied into memory buffers. These buffers are divided into partitions based on a “hash code,” which is computed from the column(s) in the join predicate(s).
Then the outer table (called the probe table) is scanned. For each row in the probe table the same hash algorithm is applied to the join column(s). If the hash code obtained matches the hash code of an build row, the
actual join columns are compared."
There are many things that may influence optimizer's decision to choose a particular join method. Take a look at above mentioned pdf, I find it quite informative.