1)
select * from student_tbl A ,result_tbl B where
A.student_name = B.student_name and
A.student_name = "xyz" ;2)
select * from student_tbl A ,result_tbl B where
A.student_name = "xyz" and
A.student_name = B.student_name ;我知道这些查询的结果是相同的。性能上有什么不同吗?如果是,请解释原因。
发布于 2011-12-07 18:10:59
假设您使用的是Sql server,您可以显示每个表的执行计划并查看实际发生了什么,这将显示每个操作的成本以及查询对每个表的实际操作。
对于不太深入的查看,您也可以只运行查询并检查执行时间。
我怀疑这里真正的问题是“where子句中条件的顺序是否会影响性能?”在这种情况下,您可能希望阅读这篇文章,以便发布Does the order of columns in a WHERE clause matter?
https://stackoverflow.com/questions/8413049
复制相似问题