Query – Percentage of Physical Memory SQL Server is Currently Using

Note: Unlike other queries I have share here at TheSQLReport, I am the author of this one.   Sharing because I could not find it in my Google Searches.  Tested this back to version SQL Server 2012.   Also please remember that physical_memory_in_use_kb may be a constantly changing number depending on how SQL Server  is configured & the activity of the operating system.

--
-- Percentage of Physical Memory SQL Server is Currently Using
-- 
select
sys.dm_os_sys_info.physical_memory_kb/1024 AS [OS RAM / Physical Memory (MB)],
sys.dm_os_process_memory.physical_memory_in_use_kb/1024 as [Physical Memory SQL Using (MB)],
FORMAT((
CONVERT( numeric,sys.dm_os_process_memory.physical_memory_in_use_kb) /
CONVERT( numeric,sys.dm_os_sys_info.physical_memory_kb)
),'P', 'en-us') as [Percentage of Physical Memory SQL Using]
FROM
sys.dm_os_sys_info,
sys.dm_os_process_memory;

 

Leave a Comment