Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

T-SQL: Why “It Depends” Expand / Collapse
Author
Message
Posted Tuesday, March 16, 2010 6:27 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 5:25 AM
Points: 9,928, Visits: 11,204
The Dixie Flatline (3/16/2010)
Paul: I will read over the article and see if Steve can make the changes. It's also been pointed out to me that a script to generate the sample data table really should have been included. Thanks, as always, for keeping me straight.

Thank you. I am as keen to try a recursive CTE as Joe is to try a MAX (PARTITION BY). Just for fun, y'know




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #883703
Posted Tuesday, March 16, 2010 6:38 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, December 4, 2014 12:55 PM
Points: 46, Visits: 343
Very nice work. Thank you for a well done article.
Post #883711
Posted Tuesday, March 16, 2010 6:45 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:48 AM
Points: 20,857, Visits: 32,877
Excellent article, Bob. It should be required reading for newbies so that the understand why we tell them "It Depends" so often.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #883716
Posted Tuesday, March 16, 2010 6:53 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:26 AM
Points: 10,381, Visits: 13,436
The Dixie Flatline (3/16/2010)
Thanks, guys.

Jack: You're right. This was written back in November. Things have been hectic since. When is the next SQL Saturday in Orlando? I need a vacation.


Well, Orlando is always in late September or early October, but Jacksonville is May 8th. I can't make that one. I am probably going to go to the Atlanta SQLSaturday on April 27th. Be great to see you there.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #883727
Posted Tuesday, March 16, 2010 6:56 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, September 15, 2014 2:35 AM
Points: 166, Visits: 1,056
Very useful article concept/theme - especially for the newbies, illustrative and effective example, great username (although I trust that you're not a construct )
Post #883729
Posted Tuesday, March 16, 2010 7:00 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 10:57 AM
Points: 2,178, Visits: 2,170
Great job with the article and an excellent example of how the same code will perform differently under various data loads.

Clearly, the answer "it depends" can be justified as you have so well done. If the answer is expanded on, as well as you have just done, it would be much more appreciated by T-SQL new comers.

Example:
___It depends, under conditions a... answer 1.

___Under conditions b... answer 2.

___...

This way the new comer will actually get the "best" answer they are looking for if one of the conditions and corresponding answer relates to their situation.

Dave
Post #883733
Posted Tuesday, March 16, 2010 7:02 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:12 AM
Points: 35,770, Visits: 32,434
The Dixie Flatline (3/16/2010)
Jeff: Simply thanks. I've told you before at length how much I owe you. It's good not to be savaged with a pork chop first thing in the morning.


BWAA-HAAA!!!! Well, "It Depends" on whether it's a smoked pork chop or not and whether there's a bit of apple-sauce to go with it. Mmmmmm... pork chops.... gaaahhhh....

It's difficult to convince new and even some intermediate users that SQL Server has a proverbial "mind of its own" called the "optimizer" and that what works very well for a thousand rows may actually not be "scalable". I think this article demonstrates that quite nicely. Very well done (and I'm not talking pork chops ), Bob.


--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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #883736
Posted Tuesday, March 16, 2010 7:11 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:58 AM
Points: 13,872, Visits: 9,600
Just to chime in, great article.

This kind of thing is why performance tuning isn't "one and done", but is an ongoing battle. Good illustration on that.


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #883743
Posted Tuesday, March 16, 2010 7:27 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Today @ 10:05 AM
Points: 677, Visits: 6,849
Well done.
Great layout of examples to test several scenarios to show why you want to test with some different volumes.
I can see this as being pointed to often.
Greg E

Post #883756
Posted Tuesday, March 16, 2010 7:35 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, November 21, 2014 6:34 AM
Points: 6,259, Visits: 2,031
I don't tend to praise a lot of articles, this one has my 5 stars!

Great Job.



* Noel
Post #883763
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse