• I've been watching your posts for several days now. You good folks have the right idea to try to optimize all of the queris you've posted but I think you need some professional help. You've wanted to change some queries to APPLYs (and didn't know how nore that such a thing probably wouldn't help) and now they want you to try to get rid of LEFT OUTER JOINs based on some mistaken assumption that OUTER JOINs are automatically a performance problem. They might be, in this case, but they also might not be. The problem is that we don't have your data and we just can't tell and we certainly can't tell which part of the query is the performance culprit.

    Bearing no malice to you or the folks you work with, I strongly recommend that you folks get a tuning expert on temporary payroll. Gail or Kevin would make excellent choices in this area.

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

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)