Covering Index Performance Impact in SQL Server
This post can help you to understand the “Covering Index Performance Impact in SQL Server”. First we’ll understand the covering index basics and we’ll see the performance impact using T-SQL code.
Q. What is a covering Index?
Ans:
- A non-clustered index that is extended to include non-key columns in addition to the key columns is called as covering index.
- Non-Key columns are not considered by the Database Engine when calculating the number of index key columns or index key size.
- Need to use INCLUDE clause while creating index. This is mostly used to cover all columns in most frequently used queries in OLTP.
- Covering index covers a query that means this index contains all columns which are used in SELECT, JOIN, WHERE clause
- If you know that your application will be performing the same query over and over on the same table, consider creating a covering index on the table.
- A covering index Without INCLUDE clause is same as composite index.
Q. Why covering index is required?
Ans:
- Covering Index is used to remove KEY or RID Lookups. When we design a query in OLTP where the query usage frequency is very high and every time the query is issuing KEY/RID lookups then we can get benefit by creating covering index.
- A covering index, which is a form of a composite non clustered index, includes all of the columns referenced in SELECT, JOIN, and WHERE clauses of a query.
- Since the index is covering all columns from the query, the index contains the data you are looking for and SQL Server doesn’t have to look up the actual data in the table which reduce the logical and/or physical I/O, and boosting performance.
- Also when we need to bypass the index limitations in number or size we can use Covering Index