Sql Server Indexes All Notes

HKN MZ
8 min readApr 15, 2024

Indexes in SQL Server are data structures that improve the speed of data retrieval operations on tables by providing quick access paths to the data. They help speed up SELECT, UPDATE, DELETE, and MERGE statements by reducing the number of data pages that need to be read.

Types of Indexes:

Clustered Index: Determines the physical order of data in the table. Each table can have only one clustered index, and it’s usually created on the primary key column(s).
Non-clustered Index: Contains a sorted list of key values and pointers to the actual data rows. Multiple non-clustered indexes can be created on a table.

Key Considerations:

Column Selection: Choose columns for indexing based on the queries most frequently executed against the table. Indexing columns used in WHERE, JOIN, ORDER BY, and GROUP BY clauses is often beneficial.
Index Maintenance: Regularly monitor and maintain indexes to ensure optimal performance. This includes rebuilding or reorganizing indexes to reduce fragmentation and updating index statistics.
Index Size: Be mindful of the size of indexes, as they consume disk space. Over-indexing can lead to increased storage requirements and slower performance during data modification operations.
Index Fragmentation: Fragmentation occurs when data pages become out of order, leading to…

--

--

HKN MZ

I am writing about Sql Server, Elasticsearch and Python. İ am an Database Administrator on SQL Server and Elasticsearch more than 5+ years.