T-SQL: Why “It Depends”

  • Paul White (3/16/2010)


    [font="Arial Black"]TEST IT?[/font]

    [font="Arial Black"]

    YES[/font]

    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

  • Test it? Isn't putting it into production the way to test things? :hehe:

  • Dave62 (3/17/2010)


    Test it? Isn't putting it into production the way to test things? :hehe:

    Much more fun that way, yes!

  • TheSQLGuru (3/16/2010)


    The optimizer is INCREDIBLY intelligent. Serious rocket science type of stuff. But it only has so much information to go on and (perforce) a limited amount of time/effort it can spend on each optimization required.

    BTW, as a consultant I would be happy to assist you in the from-scratch rewrite ... 😎

    Ah, but that would require a *budget*. I've heard of those magical beasts but in the last ten years I have yet to spot one in my neck of the woods. 🙂

    I was lucky to be able to get the company to spring for a single copy of SQL Server, much less consulting fees. Reading all these posts from people that actually can afford a *staff*... (laughing) I'm envious!

  • CirquedeSQLeil (3/16/2010)


    Jeff Moden (3/16/2010)


    ith the last couple of posts in mind, I hope everyone realizes that the big brother to "It Depends" is "Test it!". 😉

    I think this needs a little more emphasis. TEST IT!

    I'm not quite sure I understand what you are saying here. 😀

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • I always thought that's how things were done, if it worked its production else it was a test. 😛

  • I wasn't told there would be a TEST... :w00t: :w00t: :w00t:

    But I do recall writing at some point in the article.... 'testing, testing, testing'.

    I'm surprised (but pleased) to see that there is actually still some discussion going on over this topic. "It depends" is such a truism.

    I absolutely agree with Paul that the optimizer is serious rocket-science type stuff. The fact that execution plans may change or be less efficient at different volumes in no way implies that it is stupid. We just have to understand, work with, and forgive it's imperfections... even as it understands, works with and forgives ours. 😉

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • The Dixie Flatline (3/17/2010)


    I absolutely agree with Paul that the optimizer is serious rocket-science type stuff. The fact that execution plans may change or be less efficient at different volumes in no way implies that it is stupid. We just have to understand, work with, and forgive it's imperfections... even as it understands, works with and forgives ours. 😉

    That quote comes from 'The SQL Guru', not me. I do whole-heartedly agree with it, but that's not quite the same I guess 😉

  • roger.plowman (3/17/2010)


    TheSQLGuru (3/16/2010)


    The optimizer is INCREDIBLY intelligent. Serious rocket science type of stuff. But it only has so much information to go on and (perforce) a limited amount of time/effort it can spend on each optimization required.

    BTW, as a consultant I would be happy to assist you in the from-scratch rewrite ... 😎

    Ah, but that would require a *budget*. I've heard of those magical beasts but in the last ten years I have yet to spot one in my neck of the woods. 🙂

    I was lucky to be able to get the company to spring for a single copy of SQL Server, much less consulting fees. Reading all these posts from people that actually can afford a *staff*... (laughing) I'm envious!

    I've worked in an environment like that before and it really sucked. Worse than not having a budget is the company was always living on the edge. The positive side to that was I learned to wear a lot of hats. That is really how I became a DBA from being an engineer.

    I have to say that even in larger companies there are still issues getting "Budget" for everything you need. I'm glad that Dev Edition of SQL Server is only around $50.

    ---------------------------------------------------------------------
    Use Full Links:
    KB Article from Microsoft on how to ask a question on a Forum

  • Jeff Moden (3/16/2010)


    ith the last couple of posts in mind, I hope everyone realizes that the big brother to "It Depends" is "Test it!". 😉

    or the sequel? "Yes, but ..."



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Whups, my apologies to the Guru and to Paul both. I promise to come back when I have time to read through all this more carefully.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Excellent article that brings several things to mind.

    1. I remember in college in our ADT course in addition to coding different sort algorithms(Quick, Merge, Hash) we had to do an experiment with what we coded as well. Our hypothesis was based on our code and Big O notation. Multiple data sets were used and read into a list. What we found out was that not only did the data size matter but if the data set was sorted or not sorted and the sort order mattered as well.

    I am curious what other factors might affect the results.

    2. This might not be an example of real world since the data is in a controlled environment and in my experience end user and controlled environment can't go in the same sentence :-D.

    3. This is more of a warning but just because your query runs good in dev you need to test on a machine that is like production. Countless times a fast query in dev timed out in QA and prod because of a single processor in Dev versus multi core system in other environments.

    4. Forcing a plan is dangerous. I remember in an article somewhere Joe Celko mentioned that the difference between .NET and SQL developement is that .NET for the most part does not have mutable characteristics. Over time SQL data changes so the profiler will change how it chooses to do things based on these changes.

  • So, BOB, when is part II for this article coming out?

    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

  • Jason, I hadn't planned on a sequel. No pun intended. Right now I have another writing commitment to honor before I can do another article. When I get a chance I'll bounce a couple of topics off you.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • The Dixie Flatline (3/17/2010)


    Jason, I hadn't planned on a sequel. No pun intended. Right now I have another writing commitment to honor before I can do another article. When I get a chance I'll bounce a couple of topics off you.

    Writing commitment? If we may be nosy?

    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

Viewing 15 posts - 61 through 75 (of 98 total)

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