Database Index - Covering Index

Covering Index

In most cases, an index is used to quickly locate the data record(s) from which the required data is read. In other words, the index is only used to locate data records in the table and not to return data.

A covering index is a special case where the index itself contains the required data field(s) and can return the data.

Consider the following table (other fields omitted):

ID Name Other Fields
12 Plug ...
13 Lamp ...
14 Fuse ...

To find the Name for ID 13, an index on (ID) will be useful, but the record must still be read to get the Name. However, an index on (ID, Name) contains the required data field and eliminates the need to look up the record.

A covering index can dramatically speed up data retrieval but may itself be large due to the additional keys, which slow down data insertion & update. To reduce such index size, some systems allow non-key fields to be included in the index. Non-key fields are not themselves part of the index ordering but only included at the leaf level, allowing for a covering index with less overall index size.

Read more about this topic:  Database Index

Famous quotes containing the words covering and/or index:

    Three forms I see on stretchers lying, brought out there untended
    lying,
    Over each the blanket spread, ample brownish woolen blanket,
    Gray and heavy blanket, folding, covering all.
    Walt Whitman (1819–1892)

    Exile as a mode of genius no longer exists; in place of Joyce we have the fragments of work appearing in Index on Censorship.
    Nadine Gordimer (b. 1923)