Included Indexes

  • Comments posted to this topic are about the item Included Indexes

  • Typo alert!

    Option 4 "I can include deterministic computed columns. "

    Explanation of why this is wrong "The computed columns that are deterministic can be included."

    Oops :blush:

  • Nice question.

    The last answer is also correct though (but it's not a restriction).

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I guess the fourth option is missing the word "not" 🙂 - or maybe it was intended to say what it is and the explanation is wrong (in which case the correct explanation would be "...this is not a restriction, it's something allowed").

    Nice question despite that.

    As usual when multiple answers are required, some people have ignored that - 2 required out of 4, but the percentages of selections add up to 195%, ie 5% short, which is more than can be accounted by rounding down since there are only 4 options.

    Tom

  • As all above me highlighted so i would leave it as is it.

    beside that excellent question. Thanks for sharing Steve.

  • I don't understand why non-clustered is required. While not a best practice, why couldn't you include the non-key columns in the definition of the clustered index?

  • tom.w.brannon (12/16/2015)


    I don't understand why non-clustered is required. While not a best practice, why couldn't you include the non-key columns in the definition of the clustered index?

    I'm thinking that clustered indexes by definition include all the non key columns 🙂

  • Toreador (12/16/2015)


    Typo alert!

    Option 4 "I can include deterministic computed columns. "

    Explanation of why this is wrong "The computed columns that are deterministic can be included."

    Oops :blush:

    Yeah I picked that one because I thought including deterministic computed columns would work! But no big deal for me, I don't get many questions right here :hehe:

  • patrickmcginnis59 10839 (12/16/2015)


    tom.w.brannon (12/16/2015)


    I don't understand why non-clustered is required. While not a best practice, why couldn't you include the non-key columns in the definition of the clustered index?

    I'm thinking that clustered indexes by definition include all the non key columns 🙂

    Thanks!

  • I was thinking that since a clustered index includes all non-key columns and you want to include some non-key columns, you wouldn't need it to be a nonclustered index...


    [font="Tahoma"]Personal blog relating fishing to database administration:[/font]

    [font="Comic Sans MS"]https://davegugg.wordpress.com[/url]/[/font]

  • Last answer updated. I was thinking it wasn't a restriction, but I can see why this created confusion. I'll award back points to this time.

  • patrickmcginnis59 10839 (12/16/2015)


    tom.w.brannon (12/16/2015)


    I don't understand why non-clustered is required. While not a best practice, why couldn't you include the non-key columns in the definition of the clustered index?

    I'm thinking that clustered indexes by definition include all the non key columns 🙂

    Yeah, option 1 really is NOT correct. You can include non-key columns in a clustered index -- in fact, you have no choice but to include non-key columns.

    If the question had said that you want to include some but not all columns in the index, then the index could not be clustered.

  • #1 is correct.

    If I have a table and do this:

    CREATE CLUSTERED INDEX ix_mybigtable ON dbo.mybigtable (id, largechar) INCLUDE (largechar2)

    I get this:

    Msg 10601, Level 16, State 1, Line 1

    Cannot specify included columns for a clustered index.

    The questions is on included columns. However I can see the phrasing being poor, so I've altered this to say INCLUDE specifically.

  • I thought it was an excellent question. Then again, I think indexing is always a good topic. By the time I got to it, it was worded well.

  • Thanks for the question.

Viewing 15 posts - 1 through 15 (of 16 total)

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