Machine-translated by Google. Questions are authored in English.
Top

Discussion

An index in a DBMS is said to be dense if an index entry appears for every search-key value in the indexed file. Otherwise it is called a sparse index. Consider the following two statements.

S1: A hash index must be a dense index
S2: A \(B^{+}\) tree index can be a sparse index

Which one of the following options is correct?

  • A.Both S1 and S2 are true
  • B.Both S1 and S2 are false
  • C.S1 is true and S2 is false
  • D.S1 is false and S2 is true

Answer: A

Both S1 and S2 are true.

S1: A hash index scatters search keys across buckets by their hash values, with no ordering. A sparse index works only when the file is sorted on the key, so that an entry for one key also locates its neighbours. A hash index has no such order to exploit, so it must hold an entry for every search-key value: it must be dense.

S2: A B+ tree built on the sort key of a clustered (sorted) file can store just one entry per block, the first key in each block, and still locate any record by scanning within the block. So a B+ tree index can be sparse. It is dense when it is a secondary index on an unsorted attribute.

Since both statements hold, the options calling either one false are wrong.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.