Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Memory Clerks Discrepancy


Memory Clerks Discrepancy

Author
Message
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
Hi all

Environment: SQL 2008 Ent SP3

I am noticing a discrepancy in my Memory Clerks for SQL Plans (Adhoc plans)

Running this query produces 1101MB for SQL Plans
SELECT TOP(20) [type], [name], SUM(single_pages_kb)/1024 AS [SPA Mem, Mb] 
FROM sys.dm_os_memory_clerks
GROUP BY [type], [name]
ORDER BY SUM(single_pages_kb) DESC;



Running this query produces 150MB
SELECT 
sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
FROM sys.dm_exec_cached_plans
where objtype = 'Adhoc'



Is this a bug? Am I missing something here?

Thanks
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8239 Visits: 14368
The 'SQL Plans' cache includes plans for both 'Ad Hoc' and 'Prepared' queries.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
opc.three (2/28/2013)
The 'SQL Plans' cache includes plans for both 'Ad Hoc' and 'Prepared' queries.


Thanks

Taking into account the fact that SQL plans consists of Adhoc and Prepared queries - The total MB's reported in sys.dm_exec_cached_plans is still very far off from the value in MB's reported in memory clerks.

Any Ideas?
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8239 Visits: 14368
The queries are a little off in my environments too, with clerks being about 10-15% higher. All I can think of is that clerks are operating a lower level than plans so may be accounting for some additional memory overhead not shown in the plans query. Just a guess though.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
opc.three (3/1/2013)
The queries are a little off in my environments too, with clerks being about 10-15% higher. All I can think of is that clerks are operating a lower level than plans so may be accounting for some additional memory overhead not shown in the plans query. Just a guess though.


Thanks for your input

I definately think something is up here - I'm seeing differences of 1GB+

Definately stumped on this one

Thanks
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8239 Visits: 14368
Is your system running NUMA of any flavor?

Does this yield multiple rows?

SELECT  [type],
[name],
memory_node_id,
SUM(single_pages_kb) / 1024 AS [SPA Mem, Mb]
FROM sys.dm_os_memory_clerks
WHERE type = 'CACHESTORE_SQLCP'
GROUP BY [type],
[name],
memory_node_id;



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
opc.three (3/1/2013)
Is your system running NUMA of any flavor?

Does this yield multiple rows?

SELECT  [type],
[name],
memory_node_id,
SUM(single_pages_kb) / 1024 AS [SPA Mem, Mb]
FROM sys.dm_os_memory_clerks
WHERE type = 'CACHESTORE_SQLCP'
GROUP BY [type],
[name],
memory_node_id;



Nope - 1 row
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