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 –
- Primary indexing
- Clustering Indexing
- Secondary Indexing
2. Multilevel Indexing –
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. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Indexing in Databases | Set 1
- Primary key in MS SQL Server
- Difference between Primary key and Super key
- Difference between Primary and Candidate Key
- Difference between Primary key and Unique key
- Difference between Primary Key and Foreign Key
- Difference between Primary and Secondary Memory
- Difference between Primary and Secondary Data
- Indexing in MongoDB
- Types of Keys in Relational Model (Candidate, Super, Primary, Alternate and Foreign)
- Bitmap Indexing in DBMS
- Types of Databases
- Active Databases
- Denormalization in Databases
- Concept of indexing in Apache Cassandra
- Introduction to Graph Databases
- Concepts of Distributed databases
- Local Indexing and Materialized views in Cassandra 3.0
- How to Store and Extract XML Documents from Databases
- Horizontal and Vertical Scaling In Databases
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.