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?
- A. 8,400
- B. 11,200
- C. 9,800
- 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
- The owner O of a table issues, in this order (with GRANT OPTION each time): 1) O grants SELECT to A; 2) O grants SELECT to B; 3) A grants…
- ACC(id, bal): (1,100), (2,200), (3,300), (4,400). A row-level trigger AFTER UPDATE ON ACC FOR EACH ROW WHEN NEW.bal > 250 inserts (NEW.id…
- K(a UNIQUE, b CHECK (b > 0)) is empty. These rows are inserted one by one, ignoring any row that violates a constraint: (1,5), (1,6)…
- G(g, x): (a,5), (a,7), (b,4), (b,4), (b,4), (c,20), (d,NULL), (d,1). How many groups does SELECT g FROM G GROUP BY g HAVING SUM(x) >…
- SALE(r, q, amt): (n,1,10), (n,2,30), (s,1,5), (s,2,5), (s,3,5), (e,1,50). View V is SELECT r, SUM(amt) AS tot, COUNT() AS c FROM SALE…
- A Grace hash join partitions both inputs into B - 1 partitions using one input page per partition plus one input buffer; in the probe…