Indexes When to Use and When to Avoid In SQL.

Improve the performance of your database by knowing the concept of indexes.

Vikram Gupta
Javarevisited

Indexing

Through this article, we’ll learn what are indexes, why to use them, how to create them, and when to avoid them. The concept of indexes is mostly asked in the interviews which are focused on SQL.

What Is an Index?

Indexes are a special kind of lookup table that is used by the database search engine to speed up data retrieval from the tables. Basically, an index is a pointer that points to the tuples of a table.

An index in a database is very similar to an index in the back of a book. It means when we want to jump to a specific topic from a book then we can first see the index of the book and then find the page number for that topic and then open that topic by going to that page number.

Another example can be, imagine we are looking to find a piece of information that is within a large table in the database. To get this information out of the table from the database, the search engine will look through every record until it finds it assuming the records of the table are unsorted. If the data we are looking for is towards the very end, this query would take a long time to run.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Vikram Gupta
Javarevisited

-: Empowering Developers to Ace Their Technical Interviews :- A Senior Engineer building Scalable, Reliable, and Containerized Cloud Applications. 5M+ views.