SQL Server IN vs. EXISTS Performance

前端 未结 9 915
醉酒成梦
醉酒成梦 2020-11-22 05:37

I\'m curious which of the following below would be more efficient?

I\'ve always been a bit cautious about using IN because I believe SQL Server turns th

9条回答
  •  一整个雨季
    2020-11-22 06:43

    EXISTS will be faster because once the engine has found a hit, it will quit looking as the condition has proved true.

    With IN, it will collect all the results from the sub-query before further processing.

提交回复
热议问题