Module 4 Indexing
Module 4 Indexing
Module -4
Indexing
Dense indices:
1. If the deleted record was the only record with its particular
search-key value, then the system deletes the corresponding
index entry from the index.
2. Otherwise the following actions are taken:
a) If the index entry stores pointers to all records with the same
search key value, the system deletes the pointer to the deleted
record from the index entry.
b) Otherwise, the index entry stores a pointer to only the first
record with the search-key value. In this case, if the deleted
record was the first record with the search-key value, the system
updates the index entry to point to the next record.
Sparse indices:
1. If the index does not contain an index entry with the
search-key value of the deleted record, nothing needs to
be done to the index.
2. Otherwise the system takes the following actions:
a) If the deleted record was the only record with its search
key, the system replaces the corresponding index record
with an index record for the next search-key value (in
search-key order). If the next search-key value already has
an index entry, the entry is deleted instead of being
replaced.
b) Otherwise, if the index entry for the search-key value
points to the record being deleted, the system updates the
index entry to point to the next record with the same
search-key value.
Secondary Indices
Secondary indices must be dense, with an index entry for every
search-key value, and a pointer to every record in the file.
A secondary index on a candidate key looks just like a dense
clustering index, except that the records pointed to by successive
values in the index are not stored sequentially
If the search key of a secondary index is not a candidate key, it is not
enough to point to just the first record with each search-key value.
The remaining records with the same search-key value could be
anywhere in the file, since the records are ordered by the search key
of the clustering index, rather than by the search key of the
secondary index.
An extra level of indirection is used to implement secondary indices
on search keys that are not candidate keys.
The pointers in such a secondary index do not point directly to the
file. Instead, each points to a bucket that contains pointers to the
file.
Any Queries?