A common refrain in the SQL Server community is the phrase, “It depends.” And, truthfully, that’s the correct answer to many questions. There are so many variables in any given situation that what works great 99 times will not work on the 100th, due to some slight difference.
But here’s one piece of advice that – even if it’s not perfectly 100% – has a high enough success rate that I would say “It does not depend.”
EXECUTE sp_configure 'Show Advanced Options', 1;
EXECUTE sp_configure 'Optimize for Ad hoc Workloads', 1;
I have yet to come across a situation in which this shouldn’t be enabled. And I’ve heard others say the same.
By the way, in case you have the same question as an attendee at my SQL Saturday session today in Salt Lake City, no, it will not wipe the plan cache when you turn it on.