I am starting to learn execution plans and am confused about how exactly a hash match works and why it would be used in a simple join:
select Posts.Title, Users.DisplayName
From Posts JOIN Users on
Posts.OwnerUserId = Users.Id
OPTION (MAXDOP 1)

As I understand it the results of the Top index scan become the hash able and each row in the bottom Index clustered scan is looked up. I understand how hash tables work to at least some degree, but I am confused about which values exactly get hashed in an example like this.
What would make sense me is the the common field between them, the id, is hashed -- but if this is the case, why hash a number?
OPTION (FAST n)hint, where n is the rough number of rows you expect. What this will do is bias the optimizer towards nested loops rather than hash joins when n is low. The reason is that hash joins are fast for large joins but have a high startup cost. Nested loops are expensive per-row, but can get started very cheaply. So it's a matter of fine tuning based on your actual data and access pattern. – Gaius Mar 28 '11 at 11:42