The Importance of Database Indexes

The Importance of Database Indexes

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0
This article is from my book:

Tuning SQL Server (eBook)

Tuning SQL Server (Second Edition)

Table of Contents | Sample ChapterLearn More | Buy

Imagine that you have a large book and you are looking for a specific piece of information. If the book has 500 pages and has no index, you will have to go through page by page until to find the information you are looking for. The worst-case scenario would be to check all 500 pages. That would be a full “scan” of the book. However, if the book has an index, you will just go through the index list and find the page that contains the information you are looking for.

The same thing happens with databases. In the database world, seeking specific information in a frequently-used large table without using an index, could end-up scanning the entire table thus taking a considerable amount of time. However, when having an index, eventually the data retrieval time would be much faster as the operation will not have to search every row in the database table every time the database table is accessed.

Even though indexes are key data structures in databases, they bring the cost of additional writes and the use of more storage space to maintain the extra copy of data. In addition, they need to be frequently maintained in order to be as performant as possible. Nevertheless, the performance gain when using indexes is significant thus making the overheads of maintaining them negligible.

In order to have a healthy set of indexes you need to run frequent maintenance operations. Such operations include index fragmentation checks, reorganization and rebuild actions.

Learn more about SQL Server Performance Tuning!

The SQL Server and .NET Hub
Reference: The SQL Server and .NET Hub (http://www.sqlnethub.com)


What are your views on the subject? Have something to share? Feel free to leave your comment!


Recommended eBooks on SQL Server:

Developing with SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Developing SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Administering SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Administering SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Tuning SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Tuning SQL Server: eBook by SQL Server MVP Artemakis Artemiou
Artemakis Artemiou
Artemakis Artemiou is a Senior SQL Server Architect, Author, Software Developer and a Microsoft Data Platform MVP. He has over 15 years of experience in the IT industry in various roles. Among other, via his initiative SQLEBooks.com, Artemakis authors and publishes eBooks on different topics on SQL Server. Artemakis currently serves as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA). Additionally he is the founder of the SQLArtBits initiative that aims to provide the technical community with simple, yet powerful and high-quality SQL Server tools. Currently, the highlights of these tools are DBA Security Advisor and In-Memory OLTP Simulator. Artemakis's official website can be found at aartemiou.com. Artemakis's blogs can be found at: SQLNetHub.com and TechHowTos.com.