Cost of Sorting
Suppose the relation’s size is N pages, and buffer pool as B pages.
After phase 0: we have N/B sorted runs of size B pages.
After phase 1: we have N/B(B-1) sorted runs of size B (B-1) pages.
After phase k: we have N/B(B-1)k sorted runs of size B (B-1)k.
We finish when B(B-1)k > N.