I work on Oracle systems where I two type of indices exists in any table:
- Unique index (Based on any search key which is unique key).
- Normal index (Index made on any search key which is not candidate or primary key).
But now I came to know about two new type of indices from a university documentation:
- Primary index
- Secondary index
How are primary and secondary indices different from each other? Are they the same as unique and normal index respectively in Oracle?
I also want to know about below two indices:
- Dense index
- Sparse index
Can we consider dense and sparse indices as type of primary and secondary indices?
Best Answer
Primary index
A primary index is an index on a set of fields that includes the unique primary key for the field and is guaranteed not to contain duplicates. Also Called a Clustered index. eg. Employee ID can be Example of it.
Secondary index
A Secondary index is an index that is not a primary index and may have duplicates. eg. Employee name can be example of it. Because Employee name can have similar values.
Dense Index
Index record appears for every search key value in the file. Dense indexes point directly to individual records.
Sparse index
contains index records for only some search key values. Applicable when records are sequentially ordered on search key. Just as with book indexes, sparse database indexes don’t point to individual records, but to ‘pages'