The difference between a sparse index and a dense index

I am very confused to understand the difference between a sparse index and a dense index. Can you explain the difference between the two?

+6
source share
2 answers

Dense index

In a dense index, there is an index entry for each value of the search key in the database. This speeds up the search, but requires more storage space for the index entries themselves. Index entries contain the value of the search key and a pointer to the actual record on the disk.

enter image description here

Rare index

In a sparse index, index entries are not created for each search key. The index record contains the search key and the actual pointer to the data on the disk. To search for a record, first go to the index record and reach the actual location of the data. If the data we are looking for is not where we directly reach by following the index, the system starts a sequential search until the required data is found.

enter image description here

+18
source

In the Dense Index, an index entry appears for each search key, while for the Sparse index, an index entry appears only for some values โ€‹โ€‹of the search key.

0
source

All Articles