What are the types of Indexes in dbms - Anna University Multiple Choice Questions

What are the types of Indexes in dbms

INDEX STRUCTURES FOR FILES :

TYPES OF INDEXES :

Different types of single-level ordered indexes are,
  • Primary index
  • Secondary index
  • Clustering index

Primary Index : 

  • Primary index is an ordered file whose records are of fixed length with two fields.The first field is of the same data type as the ordering key field called 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 eavh block in th data file.Each index entry has the value of the primary key field for the first record in a block and a pointer to that block as its two field values.
  • An index entry i will be referred using two field values (ie)<(K(i).P(i)>.
  • The first record in each block of the data file is called the anchor record of the block.
  • Indexes can also be characterized as
  1. Dense Index
  2. Sparse Index
1. Dense Index : It has an index entry for each search key value in the data file.
2. Sparse Index or Non-dense IndexIt has index outries for only some of the search values.A primary index is hence a non-dense index,since it includes an entry for each disk block of the data file rather than for every search value.

Secondary Index :

  • It is also an ordered file with two fields.The first field is of the same type as some non-ordering field of the data file that is an indexing field.The second field is either a block pointer or a record pointer.
  • Secondary index usually needs more storage space and longer search time than does a primary index.This is because of its large number of entries.

Clustering index :

  • It records of a file are physically ordered on a non-key field which does not have a distinct value for each record that field is called clustering field.
  • Clustering index is to speed up retrieval of records that have the same value for the clustering field.
  • This differs from the primary index,which requires that ordering field is of the data file have a distinct value for each record.
  • A clustering index is also an ordered file with two fields;The first field is of the same type as the clustering field of the data file,and the second field is is a block pointer.


No comments:

Post a Comment