Saturday, 21 November 2015

Primary index

Primary index / Primary indexing / Clustered index / Clustering index / index sequential file




An index whose order of the entries is same as the order of the records in the database table file is called as primary index. It can also be referred as clustering index, or clustered index.

Primary or clustering index’s search key is often the primary key of the table. It is not compulsory to have primary key attribute as the primary index’s search key. We can have other attributes as well.

Points to know about primary index:


  • A Primary Index forces a sequential file organization on the Data File;

  • Since a Data File can have just one order there can be just one Primary Index for Data File

  • The combination of a sequentially ordered file plus a clustering index is an index-sequential file


Primary index example:


In this example, the left side table is the index table, and the right side is the Students table. The search key or the ordering key field in the index table is the register number of students, which is the primary key of the students table. Observe from the picture given below the order of both index and the data file are the same.

Primary index (dense) example




A primary index (clustering index or clustered index or index on sequential files) can be one of two of the following types;


 


Go back

No comments:

Post a Comment

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...