---
title: "Indexes in SQL Server"  
description: "Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quicker.  Indexes are of two types.  Clustered index"  
author: "Amit Singh"  
published: 2011-01-01  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/85/indexes-in-sql-server  
category: "database"  
tags: ["database"]  
reading_time: 2 minutes  

---

# Indexes in SQL Server

Indexes in [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) are similar to the indexes in books. They help SQL Server retrieve the data quicker.

\

##### Indexes are of two types.

\

· Clustered indexes

· Non-clustered indexes.

When you create a [clustered index](https://www.mindstick.com/blog/337/clustered-non-clustered-indexing-in-sql-server) on a table, all the rows in the table are stored in the order of the clustered index key. So, there can be only one clustered index per table. Non-clustered indexes have their own storage separate from the table [data storage](https://www.mindstick.com/interview/2601/what-are-different-data-storage-options-are-available-in-android). Non-clustered indexes are stored as B-tree structures (so do clustered indexes), with the leaf level nodes having the index key and it's row locater. The row located could be the RID or the Clustered index key, depending up on the absence or presence of clustered index on the table.

\
If you create an index on each column of a table, it improves the [query performance](https://www.mindstick.com/forum/160277/how-execution-plan-can-help-identify-query-performance-issues), as the [query optimizer](https://www.mindstick.com/forum/160282/how-does-the-sql-server-query-optimizer-determine-the-optimal-query-plan-for-a-given-query) can choose from all the existing indexes to come up with an efficient [execution plan](https://www.mindstick.com/forum/160276/what-is-an-execution-plan-in-sql-server). At the same time, data modification [operations](https://www.mindstick.com/blog/304985/how-does-devops-bridge-the-gap-between-development-and-operations-teams-like-git) (such as INSERT, UPDATE, DELETE) will [become slow](https://answers.mindstick.com/qa/95573/does-an-iphone-become-slow-when-you-have-a-number-of-safari-browser-tabs-open), as every time data changes in the table, all the indexes need to be updated. Another disadvantage is that, indexes need [disk space](https://answers.mindstick.com/qa/109058/why-does-my-computer-keep-showing-low-disk-space), the more indexes you have, more disk space is used.

\

##### Advantage of indexes

· Searching for records

· Sorting records

· Grouping records

· Maintain unique coloumn

---

Original Source: https://www.mindstick.com/blog/85/indexes-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
