This is an archived course. A more recent version may be available at ocw.mit.edu.

Lecture 7: Join Algorithms

Lectures: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23

Overview

This lecture will cover join algorithms, focusing in particular on Hash join and Sort-Merge join and the relative tradeoffs of the two approaches.

Read the following paper:

  • Shapiro, L. D. "Join Processing in Database Systems with Large Main Memories." In Amazon logo Readings in Database Systems. San Fransisco, CA: Morgan Kaufmann, 1998. ISBN: 1558605231.

As you read, think about and come to class prepared to answer the following questions:

  • Under what circumstances is Sort-Merge join preferable to hash?
  • Both Hash join and Sort Merge join on unsorted inputs perform approximately the same number of I/Os. So why does one sometimes outperform the other?
  • Under what circumstances would index-nested loops join be preferable to hash or sort-merge join?