hash semi join and join selectivity
384305Dec 10 2008 — edited Dec 14 2008Hi,
I'm looking for an explanation of the rule-of-thumb that hash joins are more efficient for high selectivity joins.
If I have a query with two tables, semi-joined together using an EXISTS clause, why would a hash join be better for a high selectivity join as opposed to a low selectivity join?
To clarify, my definition of selectivity is:
selectivity = # of rows returned / # of rows processed
Or in more database specific terms:
selectivity = num_rows/cardinality
Selectivity is a value between 0 and 1, so by high selectivity, I mean a selectivity value closer to 1.
Thanks for any input.
- KR