Open In App

Indexing in Databases – Set 1

Indexing improves database performance by minimizing the number of disc visits required to fulfill a query. It is a data structure technique used to locate and quickly access data in databases. Several database fields are used to generate indexes. The main key or candidate key of the table is duplicated in the first column, which is the Search key. To speed up data retrieval, the values are also kept in sorted order. It should be highlighted that sorting the data is not required. The second column is the Data Reference or Pointer which contains a set of pointers holding the address of the disk block where that particular key value can be found.

Structure of Index in Database

Attributes of Indexing

Structure of Index in Database

In general, there are two types of file organization mechanisms that are followed by the indexing methods to store the data:  



Sequential File Organization or Ordered Index File

In this, the indices are based on a sorted ordering of the values. These are generally fast and a more traditional type of storing mechanism. These Ordered or Sequential file organizations might store the data in a dense or sparse format.

Dense Index

Sparse Index

Hash File Organization

Indices are based on the values being distributed uniformly across a range of buckets. The buckets to which a value is assigned are determined by a function called a hash function. There are primarily three methods of indexing:  



Clustered Indexing

Non Clustered Indexing

Multilevel Indexing

Advantages of Indexing

Overall, indexing in databases provides significant benefits for improving query performance, efficient data access, optimized data sorting, consistent data performance, and enforced data integrity

Disadvantages of Indexing

Features of Indexing

Conclusion

Indexing is a very useful technique that helps in optimizing the search time in database queries. The table of database indexing consists of a search key and pointer. There are four types of indexing: Primary, Secondary Clustering, and Multivalued Indexing. Primary indexing is divided into two types, dense and sparse. Dense indexing is used when the index table contains records for every search key. Sparse indexing is used when the index table does not use a search key for every record. Multilevel indexing uses B+ Tree. The main purpose of indexing is to provide better performance for data retrieval. 

FAQs on Indexing

Q.1: What is Indexing in Databases?

Answer:

Indexing is basically a technique that helps in reducing the search time of a database query or it helps in faster accessing the database.

Q.2: What are the examples of Indexing Databases?

Answer:

Some common examples of Indexing Databases are the Web of Science, DOAJ( Directory of Open Access Journals)

For more details, you can refer to Introduction to B+ Tree and Types of Keys in the Database article.


Article Tags :