5

What is the primary difference between a nested loop join and a hash join? I dont have any idea about this and all I know is that they appear on the execution plan of a query. Can anyone shed some light on this?

rvphx
  • 2,324
  • 6
  • 40
  • 69
  • possible duplicate of [What makes an SQL query optimiser decide between a nested loop and a hash join](http://stackoverflow.com/questions/1975623/what-makes-an-sql-query-optimiser-decide-between-a-nested-loop-and-a-hash-join) – Aaron Bertrand Apr 18 '12 at 16:47

1 Answers1

7

Here are some links. I agree with usr, the question is not very constructive, since to answer it we would just be repeating what has been written elsewhere. If you want to re-phrase your question in a much more specific way, e.g. show us a query and a plan which has one type where you might expect another or want to know why a specific type was chosen, then I think it would be a much more suitable question. The following links should help:

http://blog.tanelpoder.com/2010/10/06/a-the-most-fundamental-difference-between-hash-and-nested-loop-joins/

http://www.madeira.co.il/loop-hash-and-merge-join-types/

http://www.simple-talk.com/sql/performance/execution-plan-basics/

query optimizer operator choice - nested loops vs hash match (or merge)

Community
  • 1
  • 1
Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • This was asked on an interview that I just appeared for. Since I didnt know where to begin with, I thought of posting the question here. Thanks for the help. – rvphx Apr 18 '12 at 16:53