Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q30 — Normal Forms

Explain with AI

Consider a join (relation algebra) between relations r(R)r(R) and s(S)s(S) using the nested loop method. There are 33 buffers each of size equal to disk block size, out of which one buffer is reserved for intermediate results. Assuming size(r(R))<size(s(S)),\text{size}(r(R))<\text{size}(s(S)), the join will have fewer number of disk block accesses if

Choose one option
View worked solution

Answer: A

To perform a block-nested loop join with 33 available buffers where 11 buffer is reserved for the output (intermediate results), we have 3−1=23 - 1 = 2 buffers remaining for the relations.

With 22 buffers available for the join:

  • 11 buffer is allocated to hold a block of the outer relation.
  • 11 buffer is allocated to scan the blocks of the inner relation.

Let BrB_r and BsB_s be the number of disk blocks occupied by relations r(R)r(R) and s(S)s(S) respectively. Since size(r(R))<size(s(S))\text{size}(r(R)) < \text{size}(s(S)), we have Br<BsB_r < B_s.

Let's compare the total disk block accesses for both configurations:

  1. Case 1: r(R)r(R) is in the outer loop

    Each block of r(R)r(R) is read once, and for each of these blocks, the entire relation s(S)s(S) is scanned.

    Total Accesses1=Br+(Br×Bs)\text{Total Accesses}_1 = B_r + (B_r \times B_s)
  2. Case 2: s(S)s(S) is in the outer loop

    Each block of s(S)s(S) is read once, and for each of these blocks, the entire relation r(R)r(R) is scanned.

    Total Accesses2=Bs+(Bs×Br)\text{Total Accesses}_2 = B_s + (B_s \times B_r)

Comparing the two costs:

Total Accesses1−Total Accesses2=(Br+BrBs)−(Bs+BsBr)=Br−Bs\text{Total Accesses}_1 - \text{Total Accesses}_2 = (B_r + B_r B_s) - (B_s + B_s B_r) = B_r - B_s

Since Br<BsB_r < B_s, we have:

Br−Bs<0  ⟹  Total Accesses1<Total Accesses2B_r - B_s < 0 \implies \text{Total Accesses}_1 < \text{Total Accesses}_2

Thus, the join will require fewer disk block accesses if the smaller relation r(R)r(R) is kept in the outer loop.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Normal Forms questions