Consider a relational table \(r\) with sufficient number of records, having…

2011

Consider a relational table \(r\) with sufficient number of records, having attributes \(A_1, A_2, \dots ,A_n\) and let \(1 \leq p \leq n\). Two queries \(Q1\) and \(Q2\) are given below.

\(Q1: \pi_{A_1, \dots ,A_p} \left(\sigma_{A_p=c}\left(r\right)\right)\) where \(c\) is a constant

\(Q2: \pi_{A_1, \dots ,A_p} \left(\sigma_{c_1 \leq A_p \leq c_2}\left(r\right)\right)\) where \(c_1\) and \(c_2\) are constants.

The database can be configured to do ordered indexing on \(A_p\) or hashing on \(A_p\). Which of the following statements is TRUE?

  1. A.

    Ordered indexing will always outperform hashing for both queries

  2. B.

    Hashing will always outperform ordered indexing for both queries

  3. C.

    Hashing will outperform ordered indexing on \(Q1\), but not on \(Q2\)

  4. D.

    Hashing will outperform ordered indexing on \(Q2\), but not on \(Q1\)

Attempted by 126 students.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir