Sort-Merge Join (R S)
Sort R and S on the join column, then scan them to do a ``merge’’ on the join column.
- Advance scan of R until current R-tuple >= current S tuple, then advance scan of S until current S-tuple >= current R tuple; do this until current R tuple = current S tuple.
- At this point, all R tuples with same value and all S tuples with same value match; output <r, s> for all pairs of such tuples.
- Then resume scanning R and S.