Inner join vs Where

后端 未结 19 1073
庸人自扰
庸人自扰 2020-11-22 05:20

Is there a difference in performance (in oracle) between

Select * from Table1 T1 
Inner Join Table2 T2 On T1.ID = T2.ID

And



        
19条回答
  •  灰色年华
    2020-11-22 06:03

    As kiewik said, the execution plan is the same.

    The JOIN statement is only more easy to read, making it easier not to forget the ON condition and getting a cartesian product. These errors can be quite hard to detect in long queries using multiple joins of type : SELECT * FROM t1, t2 WHERE t1.id=t2.some_field.

    If you forget only one join condition, you get a very long to execute query returning too many records... really too many. Some poeple use a DISTINCT to patch the query, but it's still very long to execute.

    That's accurately why, using JOIN statement is surely the best practice : a better maintainability, and a better readability.

    Further more, if I well remember, JOIN is optimized concerning memory usage.

提交回复
热议问题