296 views
0 votes
0 votes
doubt1:what is the nature of clustering index whether it is dense on sparse?

doubt2:what is the nature of secondary index whether it is dense on sparse?

1 Answer

0 votes
0 votes

Clustered Indexing

Clustered indexing can be both dense and sparse. Let's see how

Quick recap: clustered indexing is done on non key attributes and it is sorted according to that attribute. The idea behind clustered indexing is to have one entry per unique value, as once we have a pointer to that location we can find other entry for the value as it is sorted. 

Case 1: non key attribute has a unique value

It will be dense indexing as we have to give every value entry in the index table 

Case 2: non key attributes isn't unique 

In this case, we can have just one entry for every unique value in the index table. 

Secondary Indexing

Secondary indices must be dense, with an index entry for every search-key value, and a pointer to every record in the file.

In primary indexing, its main file is sorted according to candidate keys (making values unique) so we can simply have a pointer one entry per block in the main file. We can simply go to that block and get the required data. We don't have this luxury in secondary indexing as the main file is unsorted and we may have done sorting according to key or non key attribute.

Source: http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes/Chapter11/node8.html

No related questions found