FizzBuzz

  • Jeff Moden (4/6/2010)


    Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    I agree... in fact, after I got done testing his UNPIVOT method, I changed my table-less cteTally generators to use it that day.

    Well done, Gianluca!

    That is quite a compliment.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    No complaints, and I'm not complaining, but you did specify that the one with most votes on March 31st would get the $25 Amazon gift card. His was a unique entry and performs well and deserves the award.

  • Steve Jones - Editor (4/6/2010)


    Sorry, my fault. I'll go review the entries this week and award something soon. Likely by Monday

    Is that last Monday or next? You have to be specific now that we have this new DBCC feature you know.

    Anyway, I used that new feature to discover what will have had happened (aren't English tenses awful) and I am (or will I mean "was", or "will be"? [or should that be "have meant" instead of "mean"]) very happy with your decision.

    The new method came out of the blue fairly late in the day and is really super. Congratulations to Gianluca for showing us something really interesting and new.

    Tom

  • Lynn Pettis (4/6/2010)


    Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    No complaints, and I'm not complaining, but you did specify that the one with most votes on March 31st would get the $25 Amazon gift card. His was a unique entry and performs well and deserves the award.

    Dunno if it's possible, Steve, but I think both Gianluca and the one with the most votes by March 31st should be thrown the proverbial bone.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (4/6/2010)


    Dunno if it's possible, Steve, but I think both Gianluca and the one with the most votes by March 31st should be thrown the proverbial bone.

    I can do that. It didn't seem like many people voted at all. Lynn got 4, one of Gianluca's, not the fastest in my testing, got 3. I'll award them both $25, timewarped as of Apr 1.

    Look for your Apr 1 Monopoly money in the mail 🙂

  • Thank you Steve and everybody. 🙂

    I was away for some days and I came back today with tons of new things in my "fix-it-right-away" list (I'm sure you have one), so sorry for responding so late.

    Congrats Lynn! It wouldn't have ben fair if you didn't get your prize, as your entry is the most upvoted one. Not that I'm unhappy with this decision, but it would have been changing the rules.

    Great! So... I suppose I will raise my carbon footprint and order a new SQL book from Auckland!:-P

    -- Gianluca Sartori

  • CirquedeSQLeil (4/6/2010)


    Jeff Moden (4/6/2010)


    Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    I agree... in fact, after I got done testing his UNPIVOT method, I changed my table-less cteTally generators to use it that day.

    Well done, Gianluca!

    That is quite a compliment.

    It is, indeed.

    Undeserved, but it is.

    Thanks, Jeff.

    -- Gianluca Sartori

  • Gianluca Sartori (4/7/2010)


    Thank you Steve and everybody. 🙂

    I was away for some days and I came back today with tons of new things in my "fix-it-right-away" list (I'm sure you have one), so sorry for responding so late.

    Congrats Lynn! It wouldn't have ben fair if you didn't get your prize, as your entry is the most upvoted one. Not that I'm unhappy with this decision, but it would have been changing the rules.

    Great! So... I suppose I will raise my carbon footprint and order a new SQL book from Auckland!:-P

    Your solution was unique and works quite well. I'm not sure what made you think of it, not something I would have thought of trying.

    I haven't modified any of my tableless cte tally table routines as of yet, but ones I write in the future will probably make use of your enhancement.

    I had to agree with Steve on his decision, but felt compelled to mention the original rules he had posted in case some one else complained. I appreciate his also giving me the prize as well.

  • Steve Jones - Editor (4/7/2010)


    Jeff Moden (4/6/2010)


    Dunno if it's possible, Steve, but I think both Gianluca and the one with the most votes by March 31st should be thrown the proverbial bone.

    I can do that. It didn't seem like many people voted at all. Lynn got 4, one of Gianluca's, not the fastest in my testing, got 3. I'll award them both $25, timewarped as of Apr 1.

    Look for your Apr 1 Monopoly money in the mail 🙂

    Very cool. Both are well deserved.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Gianluca Sartori (4/7/2010)


    CirquedeSQLeil (4/6/2010)


    Jeff Moden (4/6/2010)


    Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    I agree... in fact, after I got done testing his UNPIVOT method, I changed my table-less cteTally generators to use it that day.

    Well done, Gianluca!

    That is quite a compliment.

    It is, indeed.

    Undeserved, but it is.

    Thanks, Jeff.

    Almost everything "new" in T-SQL has actually been done before. It's not often when a truely new use for something makes it's way to the surface and actually makes a positive impact. I'm not sure what made you think of it but it's a beautiful and very simple enhancement. Thanks for posting your idea.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (4/7/2010)


    Gianluca Sartori (4/7/2010)


    CirquedeSQLeil (4/6/2010)


    Jeff Moden (4/6/2010)


    Steve Jones - Editor (4/6/2010)


    Unless someone has a great argument, I am going to choose Gianluca's entry here: http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/4631#4631

    It seemed to perform the fastest on my machine.

    I agree... in fact, after I got done testing his UNPIVOT method, I changed my table-less cteTally generators to use it that day.

    Well done, Gianluca!

    That is quite a compliment.

    It is, indeed.

    Undeserved, but it is.

    Thanks, Jeff.

    Almost everything "new" in T-SQL has actually been done before. It's not often when a truely new use for something makes it's way to the surface and actually makes a positive impact. I'm not sure what made you think of it but it's a beautiful and very simple enhancement. Thanks for posting your idea.

    You know, it is article worthy. I would like to see an article on what made you decide to implement that method and performance factors etc.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CirquedeSQLeil (4/7/2010)


    You know, it is article worthy. I would like to see an article on what made you decide to implement that method and performance factors etc.

    I believe that I'd leave that honor to the person who first came up with the method.

    What do you think, Gianluca? Any chance of you writing an article about not only performance, etc, but also on the real life story of the process you went through to figure out "Hey... what if?"

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (4/7/2010)


    CirquedeSQLeil (4/7/2010)


    You know, it is article worthy. I would like to see an article on what made you decide to implement that method and performance factors etc.

    I believe that I'd leave that honor to the person who first came up with the method.

    What do you think, Gianluca? Any chance of you writing an article about not only performance, etc, but also on the real life story of the process you went through to figure out "Hey... what if?"

    Yeah, that was kinda confusing. I meant that statement for Gianluca. I would like to read the article.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Jeff Moden (4/7/2010)


    CirquedeSQLeil (4/7/2010)


    You know, it is article worthy. I would like to see an article on what made you decide to implement that method and performance factors etc.

    I believe that I'd leave that honor to the person who first came up with the method.

    What do you think, Gianluca? Any chance of you writing an article about not only performance, etc, but also on the real life story of the process you went through to figure out "Hey... what if?"

    There's not much to say technically, mainly because I don't know WHY it's faster than concatenating with UNIONs. I just tried and compared the execution times, that's all. Looking at the execution plans, it should not be faster.

    The idea came out thinking of all possible ways to generate a table output without reading from a table. I thought of XML first, but it was slow, then I tried with UNPIVOT and then with the row constructor, that had similar exec times. It just got lucky, my only credit was trying methods that looked absurd at a first glance. I learned this from Peso (Peter Larsson) throughout the SQL competitions we both participated. His ability in coming out with unusual solutions is astounding.

    If you're eager to read an article on the subject I could put it together, but don't expect it to be technically more than this post. Maybe it could focus on all possible methods to create tabular data without I/O. What do you think?

    -- Gianluca Sartori

  • Gianluca Sartori (4/8/2010)


    If you're eager to read an article on the subject I could put it together, but don't expect it to be technically more than this post. Maybe it could focus on all possible methods to create tabular data without I/O. What do you think?

    Well, if you produce that article I will certainly want to read it. I think it would be a great article to have.

    Tom

Viewing 15 posts - 301 through 315 (of 363 total)

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