Cost of Sort-Merge Join
R is scanned once; each S group is scanned once per matching R tuple.
Cost: M log M + N log N + (M+N)
- The cost of scanning, M+N, could be M*N (unlikely!)
With 35, 100 or 300 buffer pages, both Person and Purchase can be sorted in 2 passes; total: 7500. (75 seconds).