SQL Server 2005 - Order of Inner Joins

前端 未结 3 1026
渐次进展
渐次进展 2020-12-19 10:58

I have a query containing three inner join statements in the Where clause. The query takes roughly 2 minutes to execute. If I simply change the order of two of the inner joi

3条回答
  •  抹茶落季
    2020-12-19 11:07

    I would have thought it was smart enough to do that as well, but clearly it's still performing the joins in the order you explicitly list them... As to why that affects the performance, if the first join produces an intermediate result set of only 100 records in one ordering scheme, then the second join will be from that 100-record set to the third table. If putting the other join first produces a first intermediate result set of one million records, then the second join will be from a one million row result set to the third table...

提交回复
热议问题