How to optimize Hash Match aggregation in SQL Server execution plan
-
How to optimize Hash Match aggregation in SQL Server execution plan for the below
SELECT ServicePointID, MAX(SP1.StartDayID) as StartDayID FROM SP sp1 JOIN Transfr tr1 ON sp1.TransformerID = tr1.TransformerID --Hash Match JOIN SP_Met spm1 ON spm1.ServicePointKey = sp1.ServicePointKey JOIN Met dm1 ON dm1.MeterKey = spm1.MeterKey WHERE sp1.StartDayID <= 20200715 AND sp1.EndDayID >= 20200616 AND sp1.CommodityType ='Electric'AND (tr1.Division = null OR NULL is null ) AND (tr1.Region = null OR NULL is null )AND MeterID IS NOT NULL GROUP BY ServicePointID Hash Match Aggregation 34%
-
How to optimize Hash Match aggregation in SQL Server execution plan for the below
SELECT ServicePointID, MAX(SP1.StartDayID) as StartDayID FROM SP sp1 JOIN Transfr tr1 ON sp1.TransformerID = tr1.TransformerID --Hash Match JOIN SP_Met spm1 ON spm1.ServicePointKey = sp1.ServicePointKey JOIN Met dm1 ON dm1.MeterKey = spm1.MeterKey WHERE sp1.StartDayID <= 20200715 AND sp1.EndDayID >= 20200616 AND sp1.CommodityType ='Electric'AND (tr1.Division = null OR NULL is null ) AND (tr1.Region = null OR NULL is null )AND MeterID IS NOT NULL GROUP BY ServicePointID Hash Match Aggregation 34%
Execution plan is depending on multiple factors. How to optimize? Get rid of excess colunms, get red of the date-constriction, get rid of region. Best idea; find a damn programmer.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.