StreakPeaked· Practice

ExamsGATETechnical

Consider a join between relations $r(R)$ and $s(S)$ using the nested-loop method. There are 3 buffers, each of size equal to a disk block, out of which one buffer is reserved for intermediate results. Assuming $|r(R)| < |s(S)|$, the join will have fewer disk block accesses if

  1. relation $r(R)$ is in the outer loop.
  2. relation $s(S)$ is in the outer loop.
  3. join selection factor between $r(R)$ and $s(S)$ is more than 0.5.
  4. join selection factor between $r(R)$ and $s(S)$ is less than 0.5.

Correct answer: join selection factor between $r(R)$ and $s(S)$ is less than 0.5.

Solution

In nested-loop join with limited buffers, placing the smaller relation in the outer loop generally reduces repeated scans of the larger relation. The selection factor also affects the amount of intermediate output; when it is small, fewer result tuples are produced and fewer block accesses are needed overall. Hence the stated condition is the correct one.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →