• Jeff Moden (10/12/2014)


    sqldriver (10/12/2014)


    Jeff Moden (10/12/2014)


    sqldriver (10/9/2014)


    They insisted something was wrong and that it was always faster. I told them to come back when they found it faster their way.

    That's kind of a big mistake on your part. Although you've demonstrated both sides, it doesn't sound like you've done it using THEIR data or THEIR code on a strictly in-situ. Work with them to capture their query performance in a profiler run. Rewrite THEIR query for them and then have them run both in-situ. Make sure that you capture CPU, Reads, Writes, Duration, and Rowcounts so that they can see for themselves because NOW it's being worked on THEIR turf.

    Yeah... I know... you shouldn't have to go through all of that... and, in the future, you probably won't (most of the time. There will be exceptions). You have to prove to them a couple of times that you actually do know what you're talking about. And I know you know this already but have to say it out loud just to feel better... Remember that they came to you and are now in disbelief (they insisted something was wrong). That's going to require the extra work this time and you need to be as nice/helpful as you can so the keep coming back instead of doing something silly that came for some self-proclaimed expert with a bad test on the internet.

    Since I will probably never again in my medium legged life get to say this: au contraire, Herr Moden!

    I skipped over the boring parts. The restoring 3.5tb of prod data to dev for them to work with. The way way way oversubscribing a VM to bring it closer to production specs, the initial feedback I gave them on their code which replaced 3 subquery columns with an outer apply, a nifty POC index for some averages they were calculating, and a half-stolen apply/values construct from Luis to help them pull out a text identifier.

    They came back to me an hour later with "this will always be faster", "this" referring to the ISNULL nonsense. I am always nice and helpful, and pretty good at restraining the twitches I regularly feel coming on (the same twitches I imagine you guys feel when I ask questions). If anything, the situation was opposite. They were on my lawn! I'm the only DBA, and, according to my boss, I'm not a developer (unless he needs some custom code to keep from having to pay a vendor to write it, of course.). I don't get to spend that much time with the devs. I do my monitoring and pass along a few recs to the senior developer, but it's not as much of my focus as I'd like.

    Heh... you didn't leave out the boring parts... you left out the important parts. 😉

    I stand corrected and I have to give you a very hearty "Well done". I wish more DBAs would take the time.

    So, let me get this straight though (because I'm insanely curious of the human element)... you went through all of this and THEN they came back with the ISNULL solution as being "faster" and you had to show them? What was the basis for them saying that? Did they show up with the test they had run or did they just make a statement?

    My best guess, from previous interactions, is that they read it somewhere, or someone told them it would be, and since their background is mostly not SQL, they just went with it. Something like that might be more faster in C#, but everything I know about C# could be a Rebus puzzle on a Mickey's bottle cap.

    Of course, in my mind, I'm thinking they found one of those Twilight Zone data sets where like a range scan was more efficient or something and somehow the ISNULL forced it. :blush: