Posts

Showing posts with the label SQL Server Optimizer

SQL Server Optimizer and The partial aggregate, GenLGAgg e LocalAggBelowJoin rules

Image
Hi Guys, Welcome back! I hope you enjoy this new post. Today i will show you others interesting facts about the SQL optimizer. Are you ready to enter in the detail of the partial aggregate ? Introduction The execution plan produced by a query depends a lot from data. This in because the optimizer is able to use both cardinality estimate and statistics in order to improve the execution plan . If you remember, is what we saw in the last posting when we was talking about the cost based optimization plan and the rules . Well, we continue today to talk about its operation logic!   The partial aggregate rules So, we find ourselves today with the same query of the last post: SELECT ANNDOC, NUMDOC, SUM (R.QTA1) AS SUM_QTA FROM ORDTES T JOIN ORDRIG R ON R.IDORDTES = T.ID WHERE ANNDOC = 2018 GROUP BY ANNDOC, NUMDOC ORDER BY ANNDOC, NUMDOC Our Query have the simple execution plan below: Now look what happens! I add a non clustered ...