[prev] 25 [next]

Sort-Merge Join on Example (cont)

Case 2:   Join[id=stude](Student,Enrolled)

  • Student and Enrolled already sorted on id#
  • memory buffers N=4 (S input, 2 × E input, output)
  • 5% of the "runs" in E span two pages
  • there are no "runs" in S, since id# is a primary key
For the above, no re-scans of E runs are ever needed

Cost  =  2,000 + 1,000  =  3,000   (regardless of which relation is outer)