sql-servermemorymemory-managementsql-server-2005dmv

Total server memory - what is the most accurate way to get it through SQL Server?


How is it that the values of these 2 queries disagree between each other:

SELECT [server memory] = physical_memory_in_bytes /1024.00/1024.00/1024.00
FROM sys.dm_os_sys_info;

SELECT object_name, cntr_value 
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Total Server Memory (KB)';

they should both be showing the total server memory.

Why do they disagree?

enter image description here

enter image description here


Solution

  • Physical memory is the total RAM on that server has

    You can compare how much memory is SQL Server service is consuming using: sys.dm_os_sys_info system view committed_kb field and sys.dm_os_performance_counters view cntr_value

    enter image description here