3 ms·
The two statements, as mentioned by gfody, are not equivalent. For the first statement, there can be any number of output rows based on the join condition. Fo
by dsp1234 10y ago
The two statements, as mentioned by gfody, are not equivalent. For the first statement, there can be any number of output rows based on the join condition. For the second statement, by definition, there can only be output row per input row in foo. That's a lot more information that the query planner can use to make optimizations.
- tyfon 10y agoThe table _does_ have a unique index on the combination of caseid and type, but I'm not sure if that is relevant.
- dsp1234 10y agoIt's possible, as the other commenters mentioned, it would come down to reviewing the query plan. I was just trying to address the two parts of your original comment, which were "is very baffeling" and "left join performance in sql server is very bad in some situations.". Hopefully my answer helped to un-baffel a little.