Where或ON子句中的列顺序(左/右或右/左) [英] Order of columns (left/right, or right/left) on the Where or ON clause

查看:126
本文介绍了Where或ON子句中的列顺序(左/右或右/左)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

研究,似乎无法找到以下问题的答案。 Where子句的列的顺序(左/右)是否会影响执行计划?例如:
$


其中products.num = othertable.column 


< br $> b $ b $
vs

其中othertable.column = products.num 




$


同样的问题也适用于:



< pre class ="prettyprint lang-sql"> products JOIN othertable On products.num = othertable.column












 products JOIN othertable On othertable.column = products.num 






两者之间是否有任何性能差异/执行计划?






Adrian Hernandez

解决方案

不,它不会影响 生成执行计划。 


Researching, can't seem to find an answer to the following question. Does the order (left/right) of columns on a Where clause affect execution plan? For example :

where products.num = othertable.column



vs

where othertable.column = products.num




The same question would also apply to :

products JOIN othertable On products.num = othertable.column




OR

products JOIN othertable On othertable.column = products.num



Is there any difference performance wise/execution plan between the 2?



Adrian Hernandez

解决方案

No, it does not affect the  generated execution plan at all. 


这篇关于Where或ON子句中的列顺序(左/右或右/左)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆