CS FundamentalsVery hardGATE CS (PYQ pattern)
A Grace hash join partitions both inputs into B - 1 partitions using one input page per partition plus one input buffer; in the probe phase one partition of the SMALLER relation must fit in memory together with one page for the other relation's input and one for output (B - 2 pages for the hash table). The smaller relation has 400 pages. What is the minimum number of buffer pages B for which this two-phase algorithm works without recursive partitioning (assume perfectly even partitions)?
- A. 20
- B. 22
- C. 21
- D. 25
Correct answer: B. 22
Need ceil(400 / (B - 1)) <= B - 2. B = 21 gives ceil(400/20) = 20 > 19; B = 22 gives ceil(400/21) = 20 <= 20. The textbook shortcut sqrt(400) = 20 is too small because of the extra buffer pages.
More DBMS and SQL questions
- A table has 1,000,000 rows in 10,000 pages. An unclustered B+ tree index of height 3 costs 3 page reads to reach the first matching entry…
- A RAID 6 array has 10 disks, each sustaining 200 random I/Os per second. A small read costs 1 disk I/O and a small write costs 6 (read…
- Which of the following tuple-relational-calculus expressions are SAFE (guaranteed to return a finite result for every database)? I. { t |…
- R(A, B) = {(1,a), (1,b), (2,a), (3,c), (4,a), (5,b), (5,c)} and S(B) is EMPTY. Using the standard definition R ÷ S = πA(R) − πA((πA(R) ×…
- An ER design has three strong entity sets, one weak entity set (identified through one of them), one multivalued attribute on a strong…
- Which of the following statements about ARIES recovery are correct? I. It follows write-ahead logging: a log record must reach stable…