Hash join是数据库实现join操作的一种算法。

  • First prepare a hash table of the smaller relation. The hash table entries consist of the join attribute and its row.
  • Once the hash table is built, scan the larger relation and find the relevant rows from the smaller relation by looking in the hash table.

3种基本的join实现算法:

Three fundamental algorithms for performing a join operation exist: nested loop join, sort-merge join and hash join.

Nested loop join就是两个简单粗暴的for loop。