如
例一:
Select * from tabA a inner join tabB b on a.id = b.id and b.name = '小张'
Select * from tabA a inner join (select * from tabB where name = '小张') b on a.id = b.id
----------------
例二
select * from tab3
select * from (select * from tab3) b
谢谢
第一条自我感觉应该没有差别
第二条应该第二句语句要执行两次才有结果
大家帮我分析一下谢谢
例一:
Select * from tabA a inner join tabB b on a.id = b.id and b.name = '小张'
Select * from tabA a inner join (select * from tabB where name = '小张') b on a.id = b.id
----------------
例二
select * from tab3
select * from (select * from tab3) b
谢谢
第一条自我感觉应该没有差别
第二条应该第二句语句要执行两次才有结果
大家帮我分析一下谢谢
关于例子1
用pubs下的sales和stores表进行了测试。Select * from sales a inner join stores b
on a.stor_id = b.stor_id and b.zip= '98056'
go
Select * from sales a inner join
(select * from stores where zip = '98056') b on a.stor_id = b.stor_id
事件跟踪
0 4 0 33
0 4 0 0
结果不稳定,但总体来看Duration指标,上一句始终大于第二句。
其余3项相同关于例子2
用pubs下的sales表做了测试。
进行了事件跟踪,select * from pubs..sales --Reads时间2
go
select * from (select * from pubs..sales) as b --Reads时间15CPU时间,Writes写时间,Duration持续时间,3项指标相同。以上2例子,执行计划相同。