menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Databases

>

How indexe...
source image

Dev

1M

read

282

img
dot

Image Credit: Dev

How indexes power your database

  • Indexes are used in databases to retrieve information as fast as possible by providing an additional data structure that provides references to data in disk
  • The typical implementation of indexes use variations of the B-Tree data structure to store references to the pages
  • The binary search has logarithmic time complexity and is generally faster than linear complexity
  • Creating an index for a table means creating a separate table that includes mapped column data
  • The database would scan this index table rather than every row of the original table when a user tries to search for a specific column's value
  • In this article, we explored how indexes can power our databases and speed-up reading operations
  • We saw that indexes uses binary search instead of sequential access in full table scan, which increases its efficiency
  • Through the practical example, we understood how the database plans the query execution on tables with and without indexes
  • It is important to understand how to optimize our queries to retrieve information as fast as possible
  • This is crucial for databases with large datasets to avoid the traversal millions of rows when searching for a single user, etc

Read Full Article

like

17 Likes

For uninterrupted reading, download the app