GateAI
File Organization and Indexing

GATE CSE 2014 Set 2 · Q30

MCQ2 marksMedium

Time

Consider a join (relation algebra) between relations r (R)r\ (R) and s (S)s\ (S) using the nested loop method. There are 3 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 (A) relation r (R)r\ (R) is in the outer loop. (B) relation s (S)s\ (S) is in the outer loop. (C) join selection factor between r (R)r\ (R) and s (S)s\ (S) is more than 0.5. (D) join selection factor between r (R)r\ (R) and s (S)s\ (S) is less than 0.5.

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) relation r (R) is in the outer loop.

File Organization and Indexing

Let B(r)B(r) and B(s)B(s) be the number of disk blocks occupied by relations rr and ss, respectively.

We are given that 33 buffer blocks are available in total, with 11 buffer block reserved for the output/intermediate results. This leaves 22 buffer blocks for the input relations (i.e., 11 buffer block for the outer relation and 11 buffer block for the inner relation).

For a block nested-loop join:

  • If relation rr is the outer relation, the total number of block accesses is:

    Cost=B(r)+B(r)×B(s)\text{Cost} = B(r) + B(r) \times B(s)
  • If relation ss is the outer relation, the total number of block accesses is:

    Cost=B(s)+B(s)×B(r)\text{Cost} = B(s) + B(s) \times B(r)

Comparing the two costs:

[B(r)+B(r)×B(s)]−[B(s)+B(s)×B(r)]=B(r)−B(s)[B(r) + B(r) \times B(s)] - [B(s) + B(s) \times B(r)] = B(r) - B(s)

Since size(r(R))<size(s(S))\text{size}(r(R)) < \text{size}(s(S)), we have B(r)<B(s)B(r) < B(s), which means B(r)−B(s)<0B(r) - B(s) < 0.

Therefore, placing the smaller relation r(R)r(R) in the outer loop yields fewer disk block accesses. Hence, option (A) is correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This File Organization and Indexing previous year question is Q30 of the GATE CSE 2014 Set 2 paper. Find more GATE CSE PYQs on File Organization and Indexing in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related File Organization and Indexing PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

File Organization and Indexing in GATE CSE

File Organization and Indexing has 17 GATE CSE PYQs across 17 papers from 2011 to 2026. 3 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2014 Set 2.

How GATE tests File Organization and Indexing

More from GATE CSE 2014 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2014 Set 2 · Q30 · MCQ

Consider a join (relation algebra) between relations r (R) and s (S) using the nested loop method. There are 3 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)), the join will have fewer number of disk block accesses if (A) relation r (R) is in the outer loop. (B) relation s (S) is in the outer loop. (C) join selection factor between r (R) and s (S) is more than 0.5. (D) join selection factor between r (R) and s (S) is less than 0.5.

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.