Indexing
Indexing is used to optimise the performance of a database system.
It reduces the required number of disk accesses to a minimum when a query is executed.
There are 4 types of Indexing methods:
- Ordered Indices
- Primary Index
- Clustering Index
- Secondary Index
An index for a file in a database system works in the same way as the index in a textbook.
The index record contains two parts :
- Search-key value
- Pointer
Here, the search-key value is the input and the pointer is the output.
For a given search-key value the database system looks for the record, to which the pointer indicates.
Indices are categorized in two ways:
- Ordered Indices: Based on a sorted ordering of the values.
- Hash Indices: Based on a uniform distribution of values across a range of buckets.
The bucket to which a value is assigned is determined by a function, called a ‘hash function’.
A file may have several indices, based on the different search keys.
An index entry consists of a search-key value and the pointers to one or more records with that value as their search-key value.
Reference Link