GATE CS 2011 · Question 39 · Databases · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer
Consider a relational table r with sufficient number of records, having attributes A₁, A₂, …, Aₙ and let 1 ≤ p ≤ n. Two queries Q1 and Q2 are given below.
Q1: π_(A₁,…,Aₚ)(σ_(Aₚ=c)(r)) where c is a constant
Q2: π_(A₁,…,Aₚ)(σ_(c₁ ≤ Aₚ ≤ c₂)(r)) where c₁ and c₂ are constants
The database can be configured to do ordered indexing on Aₚ or hashing on Aₚ. Which of the following statements is TRUE ?
- (A) Ordered indexing will always outperform hashing for both queries
- (B) Hashing will always outperform ordered indexing for both queries
- (C) Hashing will outperform ordered indexing on Q1, but not on Q2
- (D) Hashing will outperform ordered indexing on Q2, but not on Q1
Answer
Answer (C)
Answer from the official GATE CS 2011 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes