CS FundamentalsHardGATE CS (PYQ pattern)

Sort-merge join of R (200 pages) and S (100 pages) with 15 buffer pages: each relation is fully sorted by external merge sort (pass 0 makes 15-page runs, later passes merge 14 runs; every pass reads and writes every page), then the sorted files are read once each to join (result not written). What is the total number of page I/Os?

  1. A. 900
  2. B. 1200
  3. C. 1500
  4. D. 2100

Correct answer: C. 1500

R: ceil(200/15) = 14 runs -> one 14-way merge: 2 passes = 800 I/Os. S: 7 runs -> 1 merge: 2 passes = 400. Join reads 200 + 100 = 300. Total 1500. Forgetting the merge passes gives 900; leaving out the final join read gives 1200.

More DBMS and SQL questions

Exams that ask this topic