关于关联连接性能测试(小表关联大表性能更优)

--内连接  小表关联大表(CPU 时间 = 78 毫秒,占用时间 = 832 毫秒。)
set statistics time on 
select * from rowt as l inner join  ctable as r 
on l.name= r.int
set statistics time off 


--内连接 大表关联小表(CPU 时间 = 94 毫秒,占用时间 = 906 毫秒。)
set statistics time on 
select * from ctable as l inner join  rowt as r 
on l.int= r.name
set statistics time off  

--左连接  小表关联大表  CPU 时间 = 32 毫秒,占用时间 = 794 毫秒。 
set statistics time on 
select * from rowt as l left join  ctable as r 
on l.name= r.int
set statistics time off 


--左连接 大表关联小表  CPU 时间 = 47 毫秒,占用时间 = 883 毫秒。
set statistics time on 
select * from ctable as l left join  rowt as r 
on l.int= r.name
set statistics time off  



--右连接  CPU 时间 = 15 毫秒,占用时间 = 828 毫秒。 
set statistics time on 
select * from rowt as l right join  ctable as r 
on l.name= r.int
set statistics time off 


--右连接 CPU 时间 = 62 毫秒,占用时间 = 904 毫秒
set statistics time on 
select * from ctable as l  right join  rowt as r 
on l.int= r.name
set statistics time off 

 

posted on 2019-01-24 18:11  高达  阅读(1139)  评论(0)    收藏  举报

导航