Sqlserver自动优化

 (1)select a.* from tb1 a left join tb2  b on a.id=b.id where  a.name='1'


(2)select * from (select a.* from  tb1 a left join tb2 b on a.id=b.id) as d where name='1'


(3)建视图tbView :select a.* from  tb1 a left join tb2 b on a.id=b.id

select * from tbView as d where name='1'

这三种写法执行效率一模一样,印象中应该第一种写法最快。 

猜你喜欢

转载自www.cnblogs.com/zhaogaojian/p/9316881.html