How SQL decides how much procedure cache and how much buffer cache to use.

There are two main types of cache which SQL Server deals with, the buffer cache and the procedure cache.  The procedure cache is where the execution plans for procedures and queries are stored.  The buffer cache is where the actual data is cached so that SQL Server doesn’t have to go to disk to get often accessed data.

The version of SQL Server that you are running will determine how SQL calculates the maximum size of the procedure cache.

SQL 2000 – 50% of the memory or 1 Gig which ever is lower

SQL 2005 RTM to SP1 – 75% of the first 8 Gigs of RAM + 50% of the next 56 Gigs of RAM + 25% of the ram over 64 Gigs.

SQL 2005 SP2 and up – 75% of the first 4 Gigs of RAM + 10% of the ram over 4 Gigs

As I understand the reason for the change the original settings were causing SQL Server to lockup for some customers as not enough RAM was left over for the buffer cache.

If you are using SQL 2005 in a Win32 platform these calculations change again as the procedure cache must remain within the first 2 Gigs of memory giving you a max of 2 Gigs of procedure cache no matter how much memory you install.

Denny

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trust DCAC with your data

Your data systems may be treading water today, but are they prepared for the next phase of your business growth?