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.
The database can be configured to do ordered indexing on $A_p$ or hashing on $A_p$. Which of the following statements is TRUE?
Useful link: http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes/Chapter11/node21.html
(C) Hashing works well on the 'equal' queries, while ordered indexing works well better on range queries too. For ex consider B+ Tree, once you have searched a key in B+ tree , you can find range of values via the block pointers pointing to another block of values on the leaf node level.
Have you mistakenly written the word "too" in the statement "Hashing works well on the 'equal' queries, while ordered indexing works well better on range queries too"
Hey Actually I am not getting the language
Hashing will outperform ordered indexing on Q1??
Here hashing will be work fine for same value data. while B+ tree works for sequential as well as duplicate data.
Hope it helps a bit.
If record are accessed for a particular value from table, hashing will do better.
If records are accessed in a range of values, ordered indexing will perform better.
it explains with the same example
@vijju532 Thanx !
Typically, ordered indexing is used unless it is known in advance that range queries will be infrequent, in which case hashing is used like Q2:πA1,…,Ap(σc1≤Ap≤c2(r)) . Hash organizations are particularly useful for temporary files created during query processing, if lookups on a key value are required and no ranges queries will be performed like Q1:πA1,…,Ap(σAp=c(r)).
c is correct
Hashing is generally better at retrieving records having a specified value of the key.
If range queries are common, ordered indices are to be preferred.
@Anmol 300 books will be dispatched this month...