We can fully utilize our B buffer pagesPNLJ]] where one for R, one for S and one for the output buffer. We want to reserve as many pages as possible, that is, read B−2 pagespages]] of S. for each block of B−2 pages Br in R:for each page ps in S:for each record ri in Br:for each record sj in ps:if θ(ri,sj):yield <ri,sj> COST= [R]+⌈B−2[R]⌉[S]