Clean up the "adhoc plan cache" in SQL Server 2005

1k views Asked by At

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?

1

There are 1 answers

1
Martin Smith On BEST ANSWER

You can use DBCC FREESYSTEMCACHE('SQL Plans'); to drop the cached plans for adhoc queries while leaving stored procedure plans alone.