|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 33,113,
Visits: 27,041
|
|
kevriley (12/1/2008) Jeff- sorry the title didn't meet expectations - I was just trying to make it more exciting!
Absolutely no problem... like I said, good article and it does stress the importance of not overlooking something not so obvious to some. The devil's in the details and your good article brought that to light. Thanks again for taking the time to write it.
--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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 33,113,
Visits: 27,041
|
|
Ninja's_RGR'us (12/1/2008)
Steve Jones - Editor (12/1/2008)
Jeff, it's not often someone is going to teach you something about T-SQL.Still rolling on the floor on that one... can't be more true than that!!!
Heh... thanks for the vote of confidence, but I learn something new about T-SQL everyday even if it's how to NOT do something. :D
--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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 33,113,
Visits: 27,041
|
|
G Bryant McClellan (12/1/2008)
Jeff Moden (12/1/2008) Good article... but, because of the title, I was actually expecting to see something about a problem or technique with CTE's that couldn't be done using other forms of code. The article is really about how an index can help any query be it a CTE, Derived Table, View, etc.Jeff, I was also thrown by the title although 'deception' gave me a clue. On the other hand, thanks to Kev for pointing out what should have been obvious...the use of indexes on columns commonly used in WHERE and ORDER BY clauses. I must admit that it gave me ideas on some inherited problem code that is built with CTE for no reason I can discern. The CTE is (to me) no gain over standard SQL but potentially a gauze curtain covering up an underlying indexing issue. And I would venture that it was authored by a procedural programmer...
For me, the only gain that usually comes from a CTE (one or more) is that it makes the programming read a little better in a "Top Down" fashion instead of having to read "Bottom Up" with derived tables. Some like the ability to use recurrsive CTE's, but I've found that those are as bad or worse than cursors.
--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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 5:09 AM
Points: 31,526,
Visits: 13,864
|
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 5:09 AM
Points: 31,526,
Visits: 13,864
|
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Yesterday @ 8:44 PM
Points: 21,376,
Visits: 9,585
|
|
Steve Jones - Editor (12/1/2008)
Heh... thanks for the vote of confidence, but I learn something new about T-SQL everyday even if it's how to NOT do something. :D I'd bet it's more often how not to do something than the other way around. Hopefully we'll get you up there at PASS next year doing some of the teaching.
I second... let me go muy my tickets now!!!
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 33,113,
Visits: 27,041
|
|
Ninja's_RGR'us (12/1/2008)
Steve Jones - Editor (12/1/2008)
Heh... thanks for the vote of confidence, but I learn something new about T-SQL everyday even if it's how to NOT do something. :D I'd bet it's more often how not to do something than the other way around. Hopefully we'll get you up there at PASS next year doing some of the teaching. I second... let me go muy my tickets now!!!
Awesome compliment's guys... I'm humbled. Thanks. I'd have to think of something I haven't already beat to death on the forums, though... heh... not much left.
--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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Yesterday @ 8:44 PM
Points: 21,376,
Visits: 9,585
|
|
| If it's worth beating to death on the forums, it means that th ecommunity needs to hear it... people wanting to hear what you have to say or needing to hear it will attend... you don't have to try to please everybody out there, it's not possible (God knows I tried that one!).
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Wednesday, February 24, 2010 4:10 AM
Points: 1,553,
Visits: 2,232
|
|
Good point Steve, I was asking just yesterday about the left join vs NOT Exists, and well Gail gave me a very good visible answer and well ... like you say just cause it looks good doesn't mean it is good
---------------------------------------------- Try to learn something about everything and everything about something. - Thomas Henry Huxley
 Posting Best Practices Numbers / Tally Tables
SQL-4-Life
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 5:01 AM
Points: 4,815,
Visits: 1,343
|
|
|
|
|