Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arekgotfryd/ef7229ece738a44ee7584ce5bf38c350 to your computer and use it in GitHub Desktop.
Save arekgotfryd/ef7229ece738a44ee7584ce5bf38c350 to your computer and use it in GitHub Desktop.
-- Good basic information about OS memory amounts and state (Query 14) (System Memory)
SELECT total_physical_memory_kb/1024 AS [Physical Memory (MB)],
available_physical_memory_kb/1024 AS [Available Memory (MB)],
total_page_file_kb/1024 AS [Total Page File (MB)],
available_page_file_kb/1024 AS [Available Page File (MB)],
system_cache_kb/1024 AS [System Cache (MB)],
system_memory_state_desc AS [System Memory State]
FROM sys.dm_os_sys_memory WITH (NOLOCK) OPTION (RECOMPILE);
------
-- You want to see "Available physical memory is high" for System Memory State
-- This indicates that you are not under external memory pressure
-- Possible System Memory State values:
-- Available physical memory is high
-- Physical memory usage is steady
-- Available physical memory is low
-- Available physical memory is running low
-- Physical memory state is transitioning
Credits to Igor --> https://dba.stackexchange.com/questions/213010/memory-usage-by-sql-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment