Skip to content
Related Articles

Related Articles

Improve Article

Primary Indexing in Databases

  • Last Updated : 29 Jun, 2020

Indexing is a way to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed. It is a data structure technique that is used to quickly locate and access the data in a database.

Types of Indexing :
There are two ways as following below.

1. Single-level Indexing –

  1. Primary indexing
  2. Clustering Indexing
  3. Secondary Indexing

2. Multilevel Indexing –

  1. B Trees
  2. B+ Trees

Primary indexing is defined mainly on the primary key of the data-file, in which the data-file is already ordered based on the primary key.

Primary Index is an ordered file whose records are of fixed length with two fields. The first field of the index replicates the primary key of the data file in an ordered manner, and the second field of the ordered file contains a pointer that points to the data-block where a record containing the key is available.

The first record of each block is called the Anchor record or Block anchor. There exists a record in the primary index file for every block of the data-file.

The average number of blocks using the Primary Index is = log2B + 1, where B is the number of index blocks.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :