Hi @Sudip Bhatt ,
Covering index is a concept introduced in SQLServer2005. It could only be built on the basis of non-clustered index.
CREATE NONCLUSTERED INDEX {index_name}
ON {table_name}(column_name...)
INCLUDE(column_name...)
Generally, the index page of non-clustered index does not contain real data, and only stores pointers to data rows in data pages.
The covering index is to store data on the index page, so that when searching for the corresponding data, as long as the index page is found, the data can be accessed, and there is no need to query the data page, so this index is data "covered".
The clustered index is actually a covering index. In most cases, you can intuitively distinguish whether the current clustered index of the data table is useful, because the clustered index controls the order of the data rows according to the key value field.
By including frequently queried columns in nonclustered indexes, we can dramatically improve query performance by reducing I/O costs. Since the data pages for an nonclustered index are frequently readily available in memory, covering indexes are the usually the ultimate in query resolution.
Below is a simple example about best index creation approach.
Suppose we have a table with 4 columns like below:
create table tableT
(
id int IDENTITY(1,1) PRIMARY KEY,
[name] varchar(20),
code varchar(20),
date datetime
)
Insert thousands of data into this table.
We have a most used query like below:
SELECT * FROM tableT WHERE name='name1'
Create several indexes as below to improve the query performance.
--create NONCLUSTERED INDEX
create index name_index on tableT(name)
--create group index
create index name_index2 on tableT(name,code,[date])
--create covering index
create index name_index3 on tableT(name)include(id,code,[date])
You could refer more details from below link:
Using Covering Indexes to Improve Query Performance
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.