开发者

is "NOT EXISTS" bad SQL practice?

In SQL Server, using "NOT EXISTS" in queries are considered bad practice and I've heard that micr开发者_JAVA百科osoft code reviews test for NOT EXISTS and flag these as warnings. Why is NOT EXISTS considered bad practice and that join operators are preferred over NOT EXISTS?


Given that:

  • Any reasonably query optimizer will be able to convert between “not exists”, “exists” and "joins", so there is normally no performance difference these days.

  • “Not exists” can often be easier to read then joins.

Therefore I don’t consider “Not exists” to be bad practice in the general case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜