Sort-Merge Join
Algorithm (for equi-join):
- Sort both R and S on the join attributes (this effectively “partitions” R and S)
- In a merge-like phase, scan R and S: for each partition of R, locate the corresponding partition of S and output tuples
Sorts are somewhat costly
- But may not be needed if file is already sorted, has a B+ tree index, etc.