• dwilliscp (9/10/2012)


    Alexander Suprun (9/7/2012)


    dwilliscp (9/7/2012)


    To write new data using three outer joins or to use one outer join, and get most of the data, then use three updates to load the other three columns?

    Usually the 1st approach is faster.

    If any of these 3 columns have variable length (say varchar) then your update statement will cause a lot of page splits and therefore fragmentation.

    I did run some tests.. but the results were not steady.. there is a lot of activity on this box. The updates do tend to have less variation, thus it can take 5% longer or up to 20% less time.. depending on the test. Again due to the load on the box, I just do not put any faith in the tests.

    All the fields from the join are 50 - 200 varchar. So that could explain why this had the widest variation of run times. So since we have I/O pressure.. on this box and the production one this will get released too, I am going to go with the updates.

    Why not post the actual plan for both versions here?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden