SQL: Performance comparison for exclusion (Join vs Not in)

后端 未结 4 955
借酒劲吻你
借酒劲吻你 2020-12-18 03:28

I am curious on the most efficient way to query exclusion on sql. E.g. There are 2 tables (tableA and tableB) which can be joined on 1 column (col1). I want to display the d

4条回答
  •  一个人的身影
    2020-12-18 03:33

    Depends on the RDBMS. For Microsoft SQL Server NOT EXISTS is preferred to the OUTER JOIN as it can use the more efficient Anti-Semi join.

    For Oracle Minus is apparently preferred to NOT EXISTS (where suitable)

    You would need to look at the execution plans and decide.

提交回复
热议问题