Which statement correctly describes the difference between dense and sparse indexes in database systems?
Think about how many entries each index type contains relative to the data file.
Dense indexes contain an entry for every record in the data file, making lookups fast but requiring more space. Sparse indexes contain entries for only some records, typically one per data block, saving space but requiring extra steps to find records.
You have a large sorted data file stored on disk. Which type of index is generally more space-efficient and suitable for this data?
Consider how indexing fewer records affects space and search efficiency for sorted files.
Sparse indexes are more space-efficient for sorted files because they store entries only for some records, usually one per block. This reduces index size while still allowing efficient block-level searching.
Consider a database with a dense index and another with a sparse index on the same sorted data file. Which statement best explains the difference in search performance?
Think about how many steps are needed to find a record using each index type.
Dense indexes have an entry for every record, allowing direct access without extra block scanning. Sparse indexes have fewer entries, so after locating the block, a search within the block is needed, making it slightly slower.
In which scenario is a sparse index generally preferred over a dense index?
Consider the trade-off between space and access speed for sorted data.
Sparse indexes are preferred for sorted data files where saving space is important. They index fewer records, reducing index size, while still allowing efficient block-level searching.
How does increasing the block size of a sorted data file affect the number of entries in a sparse index built on it?
Think about how block size affects the total number of blocks and index entries.
Increasing block size means each block holds more records, so the total number of blocks decreases. Since sparse indexes have one entry per block, the number of index entries decreases.