On a powerful machine the SQL Server query is running too slowly.
In the execution plan I can see that most of the time spent goes to a "Lazy Index Spooling" process. In the query some aggregate functions are being used for calculation of values.
How can I speed-up the query (machine resources are enough)?
Thanks in advance.
DBCC RULEOFF ('BuildSpool');
. Don't do this in production and remember to turn it on when you are done.DBCC RULEON ('BuildSpool');
– Dowry