Covering Index

  • Who is we?

    Thank you very much and have a nice day.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Lynn Pettis - Thursday, March 16, 2017 8:15 AM

    Welsh Corgi - Wednesday, March 15, 2017 5:47 PM

    Lynn Pettis - Wednesday, March 15, 2017 5:28 PM

    ScottPletcher - Wednesday, March 15, 2017 3:43 PM

    A covering index is an index that has all the columns needed to satisfy, or "cover", a given query.

    For example, say I have a table with 20 columns, col1 thru col20.  
    clustered on col1 (ix1)
    nonclustered index on ( col2 ) (ix2)

    If I write this query:
    SELECT col2, col1
    FROM table_name
    ORDER BY col2
    Index ix2 is a perfect covering index, because it has all the columns needed to satisfy the query (the clus column(s) are always included in every index, so col1 is present also).

    If you wrote this query:
    SELECT col2, col1, col3
    FROM table_name
    ORDER BY col2
    Only the clustering index covers this query, so SQL would have to scan the whole table.

    If you modified IX2 to be:
    nonclustered index on ( col2 ) include ( col3) 
    Then ix2 would again cover the query.

    Scott, I wasn't asking you, that question was for the OP.  I wanted to see if he understood what a covering index was.

    Is this a test? lol

    Yes, it is.  It is based on the years that Welsh Corgi has been on this site and the questions and responses given in the past.  Several of us wonder if there are different people all sharing a single account over time.

    ok I looked it up and found an answer.

    Why do you feel the need to determine I know what a covering index is?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Welsh Corgi - Thursday, March 16, 2017 10:16 AM

    Lynn Pettis - Thursday, March 16, 2017 8:15 AM

    Welsh Corgi - Wednesday, March 15, 2017 5:47 PM

    Lynn Pettis - Wednesday, March 15, 2017 5:28 PM

    ScottPletcher - Wednesday, March 15, 2017 3:43 PM

    A covering index is an index that has all the columns needed to satisfy, or "cover", a given query.

    For example, say I have a table with 20 columns, col1 thru col20.  
    clustered on col1 (ix1)
    nonclustered index on ( col2 ) (ix2)

    If I write this query:
    SELECT col2, col1
    FROM table_name
    ORDER BY col2
    Index ix2 is a perfect covering index, because it has all the columns needed to satisfy the query (the clus column(s) are always included in every index, so col1 is present also).

    If you wrote this query:
    SELECT col2, col1, col3
    FROM table_name
    ORDER BY col2
    Only the clustering index covers this query, so SQL would have to scan the whole table.

    If you modified IX2 to be:
    nonclustered index on ( col2 ) include ( col3) 
    Then ix2 would again cover the query.

    Scott, I wasn't asking you, that question was for the OP.  I wanted to see if he understood what a covering index was.

    Is this a test? lol

    Yes, it is.  It is based on the years that Welsh Corgi has been on this site and the questions and responses given in the past.  Several of us wonder if there are different people all sharing a single account over time.

    ok I looked it up and found an answer.

    Why do you feel the need to determine I know what a covering index is?

    Simple, past experience.  Only measure of future performance we have at the moment.

  • Welsh Corgi - Wednesday, March 15, 2017 10:02 PM

    What makes you think I am a he not a she?

    Welsh Corgi
    Full name: Not provided
    Gender: Not provided

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Who is us?

    Don't be so positive.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Eric M Russell - Thursday, March 16, 2017 10:46 AM

    Welsh Corgi - Wednesday, March 15, 2017 10:02 PM

    What makes you think I am a he not a she?

    Welsh Corgi
    Full name: Not provided
    Gender: Not provided

    Who provides their full name and gender?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Welsh Corgi - Thursday, March 16, 2017 11:45 AM

    Eric M Russell - Thursday, March 16, 2017 10:46 AM

    Welsh Corgi - Wednesday, March 15, 2017 10:02 PM

    What makes you think I am a he not a she?

    Welsh Corgi
    Full name: Not provided
    Gender: Not provided

    Who provides their full name and gender?

    Who is providing that information? I check the profiles and I see nothing. Update your profiles.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Lynn Pettis - Thursday, March 16, 2017 10:32 AM

    Welsh Corgi - Thursday, March 16, 2017 10:16 AM

    Lynn Pettis - Thursday, March 16, 2017 8:15 AM

    Welsh Corgi - Wednesday, March 15, 2017 5:47 PM

    Lynn Pettis - Wednesday, March 15, 2017 5:28 PM

    ScottPletcher - Wednesday, March 15, 2017 3:43 PM

    A covering index is an index that has all the columns needed to satisfy, or "cover", a given query.

    For example, say I have a table with 20 columns, col1 thru col20.  
    clustered on col1 (ix1)
    nonclustered index on ( col2 ) (ix2)

    If I write this query:
    SELECT col2, col1
    FROM table_name
    ORDER BY col2
    Index ix2 is a perfect covering index, because it has all the columns needed to satisfy the query (the clus column(s) are always included in every index, so col1 is present also).

    If you wrote this query:
    SELECT col2, col1, col3
    FROM table_name
    ORDER BY col2
    Only the clustering index covers this query, so SQL would have to scan the whole table.

    If you modified IX2 to be:
    nonclustered index on ( col2 ) include ( col3) 
    Then ix2 would again cover the query.

    Scott, I wasn't asking you, that question was for the OP.  I wanted to see if he understood what a covering index was.

    Is this a test? lol

    Yes, it is.  It is based on the years that Welsh Corgi has been on this site and the questions and responses given in the past.  Several of us wonder if there are different people all sharing a single account over time.

    ok I looked it up and found an answer.

    Why do you feel the need to determine I know what a covering index is?

    Simple, past experience.  Only measure of future performance we have at the moment.

    ok thanks provide your information

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Welsh Corgi - Thursday, March 16, 2017 11:50 AM

    Welsh Corgi - Thursday, March 16, 2017 11:45 AM

    Eric M Russell - Thursday, March 16, 2017 10:46 AM

    Welsh Corgi - Wednesday, March 15, 2017 10:02 PM

    What makes you think I am a he not a she?

    Welsh Corgi
    Full name: Not provided
    Gender: Not provided

    Who provides their full name and gender?

    Who is providing that information? I check the profiles and I see nothing. Update your profiles.

    I don't need to update my profile, my name is already know to anyone who reads one of my posts.  Only thing I will put in my profile is my general location.

  • I think we've all been on edge for the past year. I'm looking forward to the weekend.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Welsh Corgi - Wednesday, March 15, 2017 5:39 PM

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Lynn,

    I know what a covering index is.

    I wanted to make sure all bases are covered.

    You want to make sure I know what a covering index is? lol

    If you know the answer to the question you posted, what is the purpose of your post? I think you are being unfair to Lynn, who has selflessly helped you many times over the years - often with extremely vague questions. 
    Most of the folks here will attempt to gauge the experience of the OP in order to perch their responses at the same level of understanding of the subject, often including links to information to fill in perceived shortages. In your case Welsh Corgi, this has been quite difficult because your posted questions vary from day one beginner to five years experience. This has prompted regular posters to suggest that several people are behind your login.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • ChrisM@home - Thursday, March 16, 2017 3:19 PM

    Welsh Corgi - Wednesday, March 15, 2017 5:39 PM

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Lynn,

    I know what a covering index is.

    I wanted to make sure all bases are covered.

    You want to make sure I know what a covering index is? lol

    If you know the answer to the question you posted, what is the purpose of your post? I think you are being unfair to Lynn, who has selflessly helped you many times over the years - often with extremely vague questions. 
    Most of the folks here will attempt to gauge the experience of the OP in order to perch their responses at the same level of understanding of the subject, often including links to information to fill in perceived shortages. In your case Welsh Corgi, this has been quite difficult because your posted questions vary from day one beginner to five years experience. This has prompted regular posters to suggest that several people are behind your login.

    I thought I knew the answer but I just wanted to make sure I had it right.

    Thank you.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Welsh Corgi - Thursday, March 16, 2017 4:08 PM

    ChrisM@home - Thursday, March 16, 2017 3:19 PM

    Welsh Corgi - Wednesday, March 15, 2017 5:39 PM

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Welsh Corgi - Wednesday, March 15, 2017 4:03 PM

    Welsh Corgi - Wednesday, March 15, 2017 3:13 PM

    Is there anything different about scripting out a coverard index?

    That is what I thought.

    Make sure the scriptoption is set to true

    You can easily script theindex  by using Object Explorer ->Databases -> Database -> Tables - > Indexes -> right-click on index- > Create Script

    Thanks.

    Lynn,

    I know what a covering index is.

    I wanted to make sure all bases are covered.

    You want to make sure I know what a covering index is? lol

    If you know the answer to the question you posted, what is the purpose of your post? I think you are being unfair to Lynn, who has selflessly helped you many times over the years - often with extremely vague questions. 
    Most of the folks here will attempt to gauge the experience of the OP in order to perch their responses at the same level of understanding of the subject, often including links to information to fill in perceived shortages. In your case Welsh Corgi, this has been quite difficult because your posted questions vary from day one beginner to five years experience. This has prompted regular posters to suggest that several people are behind your login.

    I thought I knew the answer but I just wanted to make sure I had it right.

    Thank you.

    Then a better way to post the question is tell us what you think is the answer and ask for clarification if you are off in some way or other.  Then we have a better understanding of what you are looking for and can provide a better answer than if we have to guess at the purpose or intent of your question.

  • agreed, please accept my Apology.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 14 posts - 16 through 28 (of 28 total)

You must be logged in to reply to this topic. Login to reply