SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Included Column Vs Covering Index


Included Column Vs Covering Index

Author
Message
SQL-DBA-01
SQL-DBA-01
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10947 Visits: 3669
Hi Team,

I have created one index sometime that includes one column (non primary) and the other column as Included column. It was working good. But later after 2 weeks I started seeing some time outs from the procedure again. While Investigation and to check further I added another index covering both the columns. So currently I have two indexes :

1. One column and other as included
2. Two columns as covering index. Initially this index had one column, I just added the other column which was included to other index

TEchnically are not both the indexes same?
I am little hesitant to delete either of the one as after creating the covering indexes the time out is stopped.

Please suggest with your opinion.

Thanks.
Ed Wagner
Ed Wagner
SSC Guru
SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)

Group: General Forum Members
Points: 70264 Visits: 10984
SQL-DBA-01 - Sunday, August 13, 2017 7:38 AM
Hi Team,

I have created one index sometime that includes one column (non primary) and the other column as Included column. It was working good. But later after 2 weeks I started seeing some time outs from the procedure again. While Investigation and to check further I added another index covering both the columns. So currently I have two indexes :

1. One column and other as included
2. Two columns as covering index. Initially this index had one column, I just added the other column which was included to other index

TEchnically are not both the indexes same?
I am little hesitant to delete either of the one as after creating the covering indexes the time out is stopped.

Please suggest with your opinion.

From the information you've given us, there's no way of knowing if they're the same index or not. If they have the same key columns and the same included columns, then they're the same. If not, then they aren't.
The SQL for the creation of the indexes would be the clearest way to be able to answer your question.

The real question is about the statistics on them. You said you created "one index sometime" but that doesn't say when. If the NCI was created, then SQL Server created statistics for it. As the data in the table changes, the statistics get to be out of date. SQL Server uses the statistics to determine how to best execute the query. If the statistics are out of date, then the plan for running the query might not be optimal. Next time, check the statistics before creating more NCIs.



Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
GilaMonster
GilaMonster
SSC Guru
SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)SSC Guru (299K reputation)

Group: General Forum Members
Points: 299381 Visits: 46697
SQL-DBA-01 - Sunday, August 13, 2017 7:38 AM
So currently I have two indexes :

1. One column and other as included
2. Two columns as covering index. Initially this index had one column, I just added the other column which was included to other index

.

A covering index is one that contains all the columns needed for a query (it's covering for that query). The columns can be in the key, or in the include.
Could you be a little clearer about what indexes you have?


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search