SQL: Using Optimize For Adhoc Workloads to Avoid Plan Cache Pollution
Memory is a precious resource on most systems today. SQL Server loves memory, so it’s important to avoid wasting it.
One common cause of wasted memory is what we call plan cache pollution. The plan cache is the region where SQL Server stores compiled query plans (and query plan stubs).
There are some nice new DMVs that give you details of what’s in that cache but nothing still compares to one of the older compatibility views sys.syscacheobjects. You can use it to see what’s in your plan cache:
2017-11-20
