SQL Efficiency: WHERE IN Subquery vs. JOIN then GROUP

后端 未结 7 1647
予麋鹿
予麋鹿 2021-02-07 09:35

As an example, I want to get the list of all items with certain tags applied to them. I could do either of the following:

SELECT Item.ID, Item.Name
FROM Item
WH         


        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 09:49

    run this:

    SET SHOWPLAN_ALL ON
    

    then run each version of the query

    you can see if they return the same plan, and if not look at the TotalSubtreeCost on the first row of each and see how different they are.

提交回复
热议问题