CS FundamentalsHardGATE CS
R occupies 1000 blocks and S 500 blocks; 50 buffer blocks are available. Ignoring the cost of writing the result, what does a Grace hash join of R and S cost in block I/Os?
- A. 4500
- B. 1500
- C. 7500
- D. 3000
Correct answer: A. 4500
Partitioning reads and writes both relations (2 × 1500) and the probe phase reads them once more (1500): 3(M + N) = 4500. 50 buffers are enough since each S partition must fit in memory (about √500 ≈ 23). 7500 is a sort-merge join with one merge pass per relation.
More DBMS and SQL questions
- A table has 1,000,000 rows stored 20 per block. An unclustered B+ tree index fetches each matching row with one random block read (ignore…
- R(A, B) = {(1, x), (2, y), (3, z)} and S(B, C) = {(x, 5), (x, 6), (w, 7)}. How many tuples are in the natural full outer join of R and S?
- Customer(cid, city) LEFT OUTER JOIN Orders(oid, cid, amt) on cid is followed by the selection amt > 100. An optimiser wants to push this…
- An ER diagram has Student (key roll, multivalued attribute phone), Course (key cid) and Faculty (key fid). Enrols is many-to-many between…
- R has 2000 tuples with 100 distinct values of attribute b; S has 5000 tuples with 250 distinct values of b. Assuming uniform values and…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…