SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Clear SQL Plans -- DBCC FREESYSTEMCACHE('SQL Plans')


Clear SQL Plans -- DBCC FREESYSTEMCACHE('SQL Plans')

Author
Message
UncleBoris
UncleBoris
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 732
I know I have a large number of single use plans being created on my SQL 2008 STD Server.

I have enabled "optimize for ad hoc workloads" which has reduced the size of each plan but the cache size still increases (but more plans).

I understand that SQL will manage the Plan Cache based on its own algorithm but I am checking I fully understanding the following article suggests.

It is basically saying that if the SQL Plan part of the cache is greater than a set threshold then clear the cache:
DBCC FREESYSTEMCACHE('SQL Plans')

Am I correct in saying doing this would free up more memory for other processes (if it was run every one or two days) and the only hit would be higher compilation times the next time the query was run?

So it might be a good thing for me to do this on my Prod server -- if I have understood the article correctly!

http://www.sqlskills.com/blogs/kimberly/plan-cache-adhoc-workloads-and-clearing-the-single-use-plan-cache-bloat/

Out of interest on a 8MB 64 bit machine the returned figures as now are (using Kimberly's logic):

TotalPhysicalMemory (MB) 8191.000

TotalConfiguredMemory (MB) 0.000

MaxMemoryAvailableToSQLServer (%) 0.000000000000000

MemoryInUseBySQLServer (MB) 7089.000

TotalSingleUsePlanCache (MB) 1695.375

TotalNumberOfSingleUsePlans 99134

PercentOfConfiguredCacheWastedForSingleUsePlans (%) 23.916


thanks
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search