Home Forums Programming General Question regarding the difference between two different ways to populate a new table in TSQL RE: Question regarding the difference between two different ways to populate a new table in TSQL

  • ChrisM@Work (8/22/2014)


    Cathy DePaolo (8/22/2014)


    I checked the execution plans of each, and they are the same. I am of the opinion that the subquery is not going to improve performance of the query, and the execution plans seem to prove me correct. I prefer the straight "select into" version because it is less code and, in my opinion, is a cleaner version.

    I was wondering if anyone in the community knows why I would be told, by a database architect, that the subquery version of this query would be better performing. I was forced to change all of my queries to use the subquery version, rather than a straight select into. I was not given a reason that satisfied me, so I am hoping someone in this community can tell me why I would be directed in this manner.

    Thank you for your time.

    Your architect is incorrect as others have pointed out and the time you spent changing all of your relevant queries was pointlessly wasted.

    The exercise isn't a complete waste of time however - you're hopefully encouraged by the responses here to ask the next self-appointed expert who comes along to prove their crazy-*** theory before you waste good company time implementing it. You might also question what significant opportunities for improvement this particular database architect was failing to see.

    +1000

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2