Clean up the “adhoc plan cache” in SQL Server 2005
I found that the "adhoc cache plan" in my SQL Server 2005 occupies more than 1000MB memory.
There is a solution on SQL Server 2008 that could solve the adhoc plan by setting the "optimize the adhoc", but it does not exists in SQL Server 2005? Have ideas of how to clean up the adhoc plan in SQL Server 2005?
You can use DBCC FREESYSTEMCACHE('SQL Plans'); to drop the cached plans for adhoc queries while leaving stored procedure plans alone.