CS FundamentalsVery hardGATE CS (PYQ pattern)

Sort-merge join of R (1000 pages) and S (400 pages) with 20 buffer pages. Each relation is fully sorted by external merge sort (pass 0 makes runs of 20 pages, later passes merge 19 runs at a time; each pass reads and writes every page), then the two sorted files are merged and joined by reading each once (the result is not written). How many page I/Os?

  1. A. 8,400
  2. B. 11,200
  3. C. 9,800
  4. D. 4,200

Correct answer: C. 9,800

R: 50 runs -> 3 runs -> 1: 3 passes, 2 x 1000 x 3 = 6000. S: 20 runs -> 2 -> 1: 3 passes, 2 x 400 x 3 = 2400. Merge phase reads 1400. Total 9,800.

More DBMS and SQL questions

Exams that ask this topic