Primary Index! Something not to forget
Indexing in a database management system is the concept to make searching fasters. This is the biggest challenge to searching a record from lacs of records in the lowest time complexity.
Before discussing the primary index. Let’s see what is sparse and dense index is.
Sparse index: It has fewer index entries in the index file as compared to the data file.
Dense index: It has an equal number of index entries as the data file has.
To implement the primary index, we need to make sure that the primary key exists in the data file and data should be in sorted order in the data file according to the primary key.
If yes then primary indexing can be implemented. The primary index is a sparse index-based technique. As data is sorted, we can keep the first primary key from the data block as the key and value will be pointers to the target data block. Which is also known as an anchor record or block record. So comparatively we will have very less index entries in the index file.
For complete article, visit :
References:
Primary index image: https://codingexplained.com/wp-content/uploads/2012/05/primary-index1.jpg
Primary key image: https://www.clipartmax.com/png/middle/53-530961_key-png-6-buy-clip-art-primary-key-icon-png.png