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?
- A. 900
- B. 1200
- C. 1500
- 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
- Under the deferred database modification scheme with a log, a crash occurs. The log holds <T1 start>, <T1,A,5>, <T1 commit>, <T2 start>…
- Under strict 2PL, T1 and T2 both hold S(A) and each now requests X(A) (a lock upgrade). T3 holds S(B) and requests X(A). T4 holds X(C) and…
- An ER diagram has a supertype PERSON(pid, name) with disjoint, total specialisation into STUDENT(gpa) and TEACHER(salary). Using the 'one…
- Relations R(A, B, C) with key A and S(C, D) with key C, where R.C is a foreign key to S. A row of S that is referenced by some R rows is…
- PA(id, k): (1,1), (2,2), (3,2), (4,3), (5,NULL), (6,4). PB(k, z): (1,9), (2,9), (2,8), (NULL,7). Let p = rows of SELECT FROM PA LEFT JOIN…
- GB(id, v): (1,5), (2,12), (3,18), (4,25), (5,31), (6,39), (7,NULL). The query SELECT v / 10, COUNT() FROM GB GROUP BY v / 10 uses integer…