Difference between sparse index and dense index

Dense Index

An index record is created for every row of the table.

  • Records can be located directly as each record of the index holds the search key value and the pointer to the actual record.

Visualisation of Index Record as a two column table, first column has name of the cities and second column has a direct pointer to the actual row of the cities table

Sparse Index

Index records are created only for some of the records. To locate a record:

  • find the index record with the largest search key value <= the search key value we are looking for
  • start at that record pointed to by this index record and proceed along the pointers in the file (that is, sequentially) until we find
    the desired record

Visualisation of Index Record as a two column table, first column has name of the cities and second column has a direct pointer to the actual row of the cities table but not all entries in index table correspond to the main table

While Dense Indexes are great for search and select operations they are more expensive to maintain when compared to Sparse indexes.

Reference Notes

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)