The GATE Grind

GATE 2014 CS (CS2) – Question 40

Databases · File Organization and Indexing (B and B+ Trees) · 2 marks · Multiple choice

A nested-loop relational join of r(R) and s(S) uses three disk-block-sized buffers, one reserved for results. If size(r) < size(s), disk accesses are fewer when ______.

  1. r is the outer relation
  2. s is the outer relation
  3. join selection factor exceeds 0.5
  4. join selection factor is below 0.5

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) r is the outer relation

Explanation

With one buffer per input and one output buffer, a block nested-loop join costs b_outer+b_outer b_inner input reads. The product term is symmetric, so putting smaller r in the outer loop reduces the additive term. Hence **A**. The join selectivity does not change this full nested-loop scan cost.