The GATE Grind

GATE 2011 CS (CS1) – Question 49

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

A large relation r has attributes A₁,…,Aₙ. Q₁ projects A₁,…,Aₙ after selecting Aₚ=c. Q₂ projects them after selecting c₁≤Aₚ≤c₂. Compare ordered indexing and hashing on Aₚ.

  1. Ordered indexing always wins for both
  2. Hashing always wins for both
  3. Hashing wins on Q₁ but not Q₂
  4. Hashing wins on Q₂ but not Q₁

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) Hashing wins on Q₁ but not Q₂

Explanation

Hashing directly locates equality buckets, suiting Q₁. A range query requires ordered traversal across adjacent keys, which an ordered index supports and hashing does not. Thus C is the conventional access-pattern comparison. Actual selectivity and cache state can affect measured performance; the source asks the structural indexing advantage.

More File Organization and Indexing (B and B+ Trees) questions

All File Organization and Indexing (B and B+ Trees) questions →