index with include column

  • hi,

    from the index recommendation scripts i ran, the indexes to be created are:

    1. on column A

    2. on column A include (B,C)

    if i only created the second index: A include (B,C)

    and my query does not include columns B and C in its select or where clause,

    will the query still use this index?

    i only want to create one index against column A and i'm trying to understand which index is the superset of which.

    thank you

  • sage8 (8/7/2012)


    hi,

    from the index recommendation scripts i ran, the indexes to be created are:

    1. on column A

    2. on column A include (B,C)

    if i only created the second index: A include (B,C)

    and my query does not include columns B and C in its select or where clause,

    will the query still use this index?

    i only want to create one index against column A and i'm trying to understand which index is the superset of which.

    thank you

    If you only created index 2 a query that only needed column A would be covered, i.e. creating both would be redundant and index 2 would be the superset (sic).

    PS corner case disclaimer: just keep in mind index 2 will be larger than index 1 so in rare cases having both could be beneficial to select performance

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

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