Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Buffer Manager Size Expand / Collapse
Author
Message
Posted Thursday, November 15, 2012 1:29 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:21 AM
Points: 1,380, Visits: 2,698
Hi Guys

I use the following script to assess the current size used by my plan cache and the data cache

select object_name,counter_name,cntr_value,cntr_value*8/1024 MBs from sys.dm_os_performance_counters
where object_name like '%Plan Cache%' and counter_name like '%Cache Pages%' and instance_name like '%_Total%'
or object_name like '%Buffer Manager%' and counter_name like '%Database Pages%'

Regarding the plan cache pages, considering that when a plan that exceeds 8KB is allocated outside of the buffer pool by the multipage allocator. Does this query include that or is this just what's in my buffer pool?

Any Help?

Thanks
Post #1384998
Posted Thursday, November 15, 2012 2:19 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 10:34 AM
Points: 857, Visits: 370
you need to look in sys.dm_os_memory_clerks using a query such as

SELECT SUM(multi_pages_kb)
FROM sys.dm_os_memory_clerks
Post #1385015
Posted Thursday, November 15, 2012 3:46 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:21 AM
Points: 1,380, Visits: 2,698
Ok

I've verified that the performance counter includes memory for plans allocated through both MPA and SPA by using the below

SELECT  [type]
, SUM(single_pages_kb)/1024 AS [SPA Mem, Kb]
, SUM(multi_pages_kb)/1024 AS [MPA Mem, Kb]
, SUM(single_pages_kb)/1024+ SUM(multi_pages_kb)/1024 Total
FROM sys.dm_os_memory_clerks
where type in ('CACHESTORE_SQLCP','CACHESTORE_OBJCP','CACHESTORE_PHDR')
GROUP BY [type] with rollup
ORDER BY SUM(single_pages_kb)

select object_name,counter_name,cntr_value*8/1024 MBs from sys.dm_os_performance_counters
where object_name like '%Plan Cache%' and counter_name like '%Cache Pages%' and instance_name like '%_Total%'

That's all good and well.

However, I am assuming that the DMV sys.dm_exec_cached_plans reports on all plans, irrespective of whether they were allocated using SPA or MPA

The problem is, why do the below queries return 2 different results?

SELECT 
sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
FROM sys.dm_exec_cached_plans

SELECT
SUM(single_pages_kb)/1024+ SUM(multi_pages_kb)/1024 [Total MBs]
FROM sys.dm_os_memory_clerks
where type in ('CACHESTORE_SQLCP','CACHESTORE_OBJCP','CACHESTORE_PHDR')

Any help with this guys?

Thanks
Post #1385057
Posted Thursday, November 15, 2012 8:49 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:21 AM
Points: 1,380, Visits: 2,698
Guys

Any help/ideas with this? Or pointers in the right direction?

Thanks
Post #1385217
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse