Index types 1

  • Thanks for the great question hugo. Got the first two, but the last one I was unsure of. Definitely learned something this morning.



    Everything is awesome!

  • Put me in the group of learners...

    Knew the first two. Have never played with either XML or SPATIAL data types as of yet (curious about them, haven't had a problem to solve with them), so my practical experience was missing.

    Ah well... one day.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Good question,

    I got it wrong over XML part.

    -------------------------------------------------------------
    "It takes 15 minutes to learn the game and a lifetime to master"
    "Share your knowledge. It's a way to achieve immortality."

  • Jack Corbett (8/6/2012)


    I over thought this one, and knew I was doing it, but still did it anyway. My thinking was that, while you do not have to define a clustered index as unique, SQL Server does add a uniqufier, thus I eliminated non-unique clustered index. See what I mean about over-thinking?

    I was wondering why, at the time I answered, 45% of respondents didn't think a non-unique clustered index was possible. I'll give them the benefit of the doubt, and chalk it up to them all thinking as much as you. ๐Ÿ™‚

    Since the clustered index is referenced by other indexes as the row identifier (since the b-tree is organized by the clustered index and therefore that would be the most efficient reference to use) a uniquifier is necessary on a "non-unique" clustered index. But since that uniquifier is not directly accessible through DML, the clustered index appears to the client as non-unique.

    Hugo, I can see why you didn't want the "choose 3" text there -- for many of us it takes a question with 31 possible answers (2^5 -1 since I believe choosing 0 answers is not an option in this system down to a choice of 3 (if you got the non-unique clustered index) or 6 (if you weren't sure of the non-unique clustered index.)

    But I for one am glad it was there, as I haven't done much with XML or Spatial data as yet, so I had to guess for the last one. I got it right and learned something today!

  • Nice. I found this link very helpful...

    http://msdn.microsoft.com/en-us/library/ms175049.aspx

    Cheers

  • sknox (8/6/2012)


    Hugo, I can see why you didn't want the "choose 3" text there -- for many of us it takes a question with 31 possible answers (2^5 -1 since I believe choosing 0 answers is not an option in this system down to a choice of 3 (if you got the non-unique clustered index) or 6 (if you weren't sure of the non-unique clustered index.)

    I prefer not to think of it as a single question with 31 possible answers, but as six simple yes/no questions (with the additional information that at least two of them need to have a "yes" answer).

    ((And for the pedantic among us, it's actually 57 possible answers (2^6 - 1 - 6) as I did provide the note about "multiple answers" being correct - so all six options with only one tick can be discarded, as can the option with no correct answer. And for the record, the QotD software forces the author to mark at least one answer as correct, and will automatically present the answer options as either radio buttons or tick marks depending on the number of correct options.))

    m mcdonald (8/6/2012)


    Nice. I found this link very helpful...

    http://msdn.microsoft.com/en-us/library/ms175049.aspx%5B/quote%5D

    I deliberately didn't include that link, as I think the information is presented there in a very confusing way. This has already resulted in two highly controversial QotD's. (One of them in fact was my inspiration for this question).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Hugo Kornelis (8/6/2012)


    sknox (8/6/2012)


    Hugo, I can see why you didn't want the "choose 3" text there -- for many of us it takes a question with 31 possible answers (2^5 -1 since I believe choosing 0 answers is not an option in this system down to a choice of 3 (if you got the non-unique clustered index) or 6 (if you weren't sure of the non-unique clustered index.)

    I prefer not to think of it as a single question with 31 possible answers, but as six simple yes/no questions (with the additional information that at least two of them need to have a "yes" answer).

    ((And for the pedantic among us, it's actually 57 possible answers (2^6 - 1 - 6) as I did provide the note about "multiple answers" being correct - so all six options with only one tick can be discarded, as can the option with no correct answer. And for the record, the QotD software forces the author to mark at least one answer as correct, and will automatically present the answer options as either radio buttons or tick marks depending on the number of correct options.))

    Actually by "for many of us" I was indicating the fact that the unique non-clustered option was pretty much a given (at this time 90% of respondents get this one correct.) That leaves 5 answers, of which at least one must be selected to make it a true multiple answer question -- that gives us the 2^5-1 = 31.

    But then I did mess up in the "choose 3" calculation. If you were correctly confident of the non-unique clustered index answer, then you'd have 2 and need one more out of 4. If you weren't confident of that one, you'd need 2 out of 5, of which there are 10 unique combinations.

  • Not so much the information on that "landing page" as much as the additional links to additional information regarding each index type.

    Worked for me this time ๐Ÿ˜€

    Cheers.

  • Hugo Kornelis (8/6/2012)


    m mcdonald (8/6/2012)


    Nice. I found this link very helpful...

    http://msdn.microsoft.com/en-us/library/ms175049.aspx%5B/quote%5D

    I deliberately didn't include that link, as I think the information is presented there in a very confusing way. This has already resulted in two highly controversial QotD's. (One of them in fact was my inspiration for this question).

    Well, I believe that I'm the author of one of those "highly controversial QotD's", and I just have to say... great question. It really makes one think. Especially with the newer index types (columnstore, and spatial (okay, 2008, but I've never used it or the XML ones yet)).

    Since the title is "Index types 1"... are there more coming?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS (8/7/2012)


    Hugo Kornelis (8/6/2012)


    m mcdonald (8/6/2012)


    Nice. I found this link very helpful...

    http://msdn.microsoft.com/en-us/library/ms175049.aspx%5B/quote%5D

    I deliberately didn't include that link, as I think the information is presented there in a very confusing way. This has already resulted in two highly controversial QotD's. (One of them in fact was my inspiration for this question).

    Well, I believe that I'm the author of one of those "highly controversial QotD's", and I just have to say... great question. It really makes one think. Especially with the newer index types (columnstore, and spatial (okay, 2008, but I've never used it or the XML ones yet)).

    Since the title is "Index types 1"... are there more coming?

    For the record, I don't blame the authors of those questions; I blame the confusing language in the BOL article, since it confuses types with attributes. For instance, if a unique index is a type and an index with included columns is a type, then what about a unique index with included columns? And why would an index on a computed column be a seperate type, but an index on a view not? (In fact, why not go the whole way and say that an index on three columns is a seperate type, or an index on a varchar column?)

    I think most people would agree that spatial, xml, and freetext are all seperate index types. For clustered/nonclustered, you'd get more debate. And for unique, computed columns, included columns and filtered indexes, I'd expect most people to not consider them as index types, but rather as index attributes.

    (As such, you might argue that my use of the word "types" in the question is not correct - but I think it is clear enough for all that my question focuses on which combinations are correct and which are not).

    And to answer your last question: yes, I submitted a second, similar question. I thought it was supposed to be published next week, but when I just double checked I noticed that the status is "Submitted, awaiting approval" so I have no idea when it will run.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Well I got it wrong, despite already using XML indexes.

    I suspect this is because the question made no mention of the date format set on the database ๐Ÿ˜‰

  • Nice question! Learned something new. Thanks Hugo!

  • Nice question and good explanation.

    But one niggle - either the explanation is wrong about NONCLUSTERED being a mandatory keyword for CREATE COLUMNSTORE INDEX, of BoL (the page you reference in the explanation) is wrong about it being an optional keyword - it's shown in option brackets in the BNF description of the statement syntax, so that it appears that although the index must be nonclustered it isn't neccessary to supply the keyword. I don't have SQL 2012 handy so can't check whether this is a BoL error or not.

    Tom

  • L' Eomot Inversรฉ (8/11/2012)


    But one niggle - either the explanation is wrong about NONCLUSTERED being a mandatory keyword for CREATE COLUMNSTORE INDEX, of BoL (the page you reference in the explanation) is wrong about it being an optional keyword - it's shown in option brackets in the BNF description of the statement syntax, so that it appears that although the index must be nonclustered it isn't neccessary to supply the keyword. I don't have SQL 2012 handy so can't check whether this is a BoL error or not.

    You are absolutely right, Tom. I made a mistake there. Luckily, the mistake doesn't affect the correctness of the answer. The keyword NONCLUSTERED is optional, but if you leave it out you still get a nonclustered columnstore index - and if you change it to clustered, you get an error message stating that clustered columnstore indexes are not supported.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Nice question! Had to dig a little to find out part of the XML index strategy but learned something new in the process. Thanks Hugo!

    Not all gray hairs are Dinosaurs!

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

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