Subquery v/s inner join in sql server

后端 未结 6 1497
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 06:15

I have following queries

First one using inner join

SELECT item_ID,item_Code,item_Name 
FROM [Pharmacy].[tblitemHdr] I 
    INNER JOIN  EMR.tblFavour         


        
6条回答
  •  执念已碎
    2020-11-30 06:59

    join is faster than subquery.

    subquery makes for busy disk access, think of hard disk's read-write needle(head?) that goes back and forth when it access: User, SearchExpression, PageSize, DrilldownPageSize, User, SearchExpression, PageSize, DrilldownPageSize, User... and so on.

    join works by concentrating the operation on the result of the first two tables, any subsequent joins would concentrate joining on the in-memory(or cached to disk) result of the first joined tables, and so on. less read-write needle movement, thus faster

    Source: Here

提交回复
热议问题