What is the difference among a primary index and a secondary index?
Primary Index: A primary index is an ordered file whose records are of fixed length along with two fields. The first field is the ordering key field-known as primary key-of the data file, and the second field is a pointer to a disk block. There is one index entry in the index file for every block in the data file. Each index entry has the value of the primary key field for the first record within a block and a pointer to in which block as its two field values. A major problem along with a primary index is insertion and deletion of records. If we attempt to insert a record in its right positioning the data file, we have to not only move records to make space for the latest record but also change a few index entries.
Secondary Index: A secondary index is also an ordered file along with two fields. The first field is non-ordering field of the data file in which is an indexing field. The second field is either a block pointer or a record pointer. A secondary index on a candidate key looks just such as a dense primary index, except in which the records pointed to through successive values in the index are not stored sequentially.