Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2014
    Posts
    268

    Cte vs derived tables

    I've been working with databases for ~3 years and something I think I noticed but wanted to ask the community, mainly senior members. It seems some of my co workers prefer derived tables and other subqueries whereas I prefer using CTE's Unions etc. I know that both have their place but I like to build out my structures and then do my dirty work while a lot of other like to build them into one structure. Is this just me being a noob not being able to handle the spaghetti code? Just curious if this is just a preference in coding or if there is a deeper reason behind this. Such as learning style etc.....

  2. #2
    Join Date
    Oct 2016
    Posts
    10
    Sorry don't have better idea about this. Might someone will help you about this issue. Thanks!

  3. #3
    Join Date
    Oct 2007
    Posts
    48
    I think its more a preference thing. As in anything else one way may perform better this time than next time. Never discount other methods when looking for speed of processing.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    To me, more often than not, code clarity is the most important factor.

    On the occasions that performance is the most important things in the world and the CTE is a bottleneck, I will change the code appropriately... but likely add lots of comments!

    You very rarely win any points from your peers by writing code that's difficult to follow or understand!
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •