Question
Consider a relational table with sufficient number of records, having attributes and let . Two queries Q1 and Q2 are given below.
Q1: where is a constant
Q2: where and are constants
The database can be configured to do ordered indexing on or hashing on . Which of the following statements is TRUE?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2011 answer key
Solution
Compare hash indexing versus ordered (B-tree) indexing on equality and range predicates.
- Query Q1 involves point equality selection . Hash indexing computes the hash bucket directly in average time, outperforming ordered index traversals which take time.
- Query Q2 involves range selection . In an ordered index (such as a B+ tree), keys are stored in sorted order with linked leaf pages, enabling efficient range scans. In contrast, standard hashing distributes keys pseudo-randomly across buckets with no ordering, making range queries require scanning the entire table.
- Consequently, hashing outperforms ordered indexing on Q1, but not on Q2.
Final answer
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2011 Computer Science and Information Technology (CS)
- Question
- 39 of 65, printed as CS Q.39
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.