How to know SQL Server Memory Utilization

  • Hi All,

    We have SQL 2008R2 Standard Ed.(64 bit) installed on Windows 2008 R2. Physical RAM on Server is 48GB.

    We have set SQL maximum memory to 35GB.

    Is there any way to know about how much memory is getting utilized by the SQL server out of 35GB.

    Below are some details

    Target Server Memory (KB) = 36700160

    Total Server Memory (KB) = 36700160

    Memory from task manager in MB

    Total49142

    Cached2648

    Available8222

    Free5624

    sqlsvr.exe 38456316 (in KB)

    Which information is correct how do I calculate memory usage for SQL out of 35GB (35840MB)

  • Amount of memory being used for the buffer pool:

    SELECT CAST((bpool_committed * 8) / (1024.0 * 1024.0) AS DECIMAL(20, 2)) AS BufferPoolCommittedMemoryGB

    FROM sys.dm_os_sys_info;

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Hi,

    Thanks for your reply.

    Out put of your query is 35GB which I have set for max server memory.

    I got some query from blog of SSC only which give the utilization of buffer.

    With CTE_BP(DatabaseName, BufferSizeInMB )

    as

    (

    SELECT

    case when DB_NAME(b.database_id) is null then 'Resource DB' else DB_NAME(b.database_id) end AS database_name

    ,(cast(COUNT(*) as decimal(20,2)) * 8192.00) / (1024.00 * 1024) AS buffer_count_MB

    FROM sys.dm_os_buffer_descriptors AS b

    GROUP BY b.database_id

    )

    select * from CTE_BP order by BufferSizeInMB desc

    Here is the out put memory in MB

    db1 18035.23438

    db2 5483.632813

    tempdb2719.28125

    db3 1926.796875

    db4 718.359375

    msdb 98.3828125

    Resource DB 18.625

    master0.9609375

    model 0.359375

    If I some up this 29001.63281 MB. So now what is the difference between bpool_commited memory & buffer descriptor memory. Can I some how know the details of 35GB utilization same like buffer descriptor memory so that I can properly justify the 35GB as the max server memory setting.

  • Your query returns the size of the data cache, which is one component of the buffer pool. There are a lot of other caches including the plan cache also within the buffer pool.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks for the reply Gail.

    so bpool_commited is the only consolidated way to describe the memory usage out of max server memory setting.

    Any reference to calculate memory of all component will be helpful..

  • select Type, SUM(single_pages_kb)/(1024.00) SingleP_MB

    , SUM(Multi_pages_kb)/(1024.00) MultiP_MB

    , SUM(virtual_memory_committed_kb)/(1024.00) VirtualP_MB

    , SUM(shared_memory_committed_kb)/(1024.00) SharedP_MB

    , SUM(awe_allocated_Kb)/(1024.00) AWEp_MB From sys.dm_os_memory_clerks

    Group by type

    try this..

  • Thanks for the reply.

    I have attached out put of this query in excel format.

    So then SQL max server memory = Sum(SingleP_MB)+Sum(MultiP_MB)+data cache memory.

    Please correct if I am wrong.

    Thanks again to all for all great efforts.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply