• thomashohner (10/4/2014)


    I just did that and I am currently running a 50-55 second query vs 8+ minutes. I just don't understand why such a small thing made such a huge difference. I really do need to start learning the execution plans better.

    Thanks for your help Eric!

    No worries Thomas, my pleasure;-)

    In (very) simple terms, what's happening in the query is that there is a set A which is evaluated against two sets, B1 and B2. In this case the server uses a nested loop for the matching, passing in every row from A and for each of those rows, evaluates it against the produce of B1 and B2. This is in order of few magnitudes more costly than evaluating A-B1 and A-B2 separately.

    Hope this makes sense.

    😎