Database-Management-System
March 8, 2025BFS-and-DFS
March 8, 2025Database-Management-System
|
Question 16
|
Consider a relational table r with sufficient number of records, having attributes A1, A2,…, An and let 1≤p≤n. Two queries Q1 and Q2 are given below.
- Q1: πA1,…,Ap(σAp=c(r)) where c is a constant
Q2: πA1,…,Ap(σc1≤Ap≤c2(r)) where c1 and c2 is a constants
The database can be configured to do ordered indexing on Ap or hashing on Ap. Which of the following statements is TRUE?
|
Ordered indexing will always outperform hashing for both queries
|
|
|
Hashing will always outperform ordered indexing for both queries
|
|
|
Hashing will outperform ordered indexing on Q1, but not on Q2
|
|
|
Hashing will outperform ordered indexing on Q2, but not on Q1.
|
Question 16 Explanation:
Hashing works well on the “equal” queries, while ordered indexing works well better on range queries.
For example, consider B+ tree, once you have searched a key in B+; you can find range of values via the block pointers pointing to another block of values on the leaf node level.
For example, consider B+ tree, once you have searched a key in B+; you can find range of values via the block pointers pointing to another block of values on the leaf node level.
Correct Answer: C
Question 16 Explanation:
Hashing works well on the “equal” queries, while ordered indexing works well better on range queries.
For example, consider B+ tree, once you have searched a key in B+; you can find range of values via the block pointers pointing to another block of values on the leaf node level.
For example, consider B+ tree, once you have searched a key in B+; you can find range of values via the block pointers pointing to another block of values on the leaf node level.
