INNER JOIN vs LEFT JOIN performance in SQL Server

后端 未结 9 1876
名媛妹妹
名媛妹妹 2020-11-22 11:51

I\'ve created SQL command that uses INNER JOIN on 9 tables, anyway this command takes a very long time (more than five minutes). So my folk suggested me to change INNER JOIN

9条回答
  •  余生分开走
    2020-11-22 12:15

    I found something interesting in SQL server when checking if inner joins are faster than left joins.

    If you dont include the items of the left joined table, in the select statement, the left join will be faster than the same query with inner join.

    If you do include the left joined table in the select statement, the inner join with the same query was equal or faster than the left join.

提交回复
热议问题