Join
--------------------
R join S =
For each tuple r in R
For each tuple s in S
if r join s, then output
Suppose M = 2
1 block of R, read all of S one page at a time, join and output
repeat this for every block of R
Cost of this: PAGES(R) + PAGES(R) * PAGES(S)
R join S and S join R may have different costs (join ordering)
Suppose M >> 2
Allocate M-1 blocks to reading R and 1 block to reading S
Cost = PAGES(R) [read R once] + PAGES(S) * ceil(PAGES(R)/(M-1))