How do you detect if you have memory pressure in SQL Server?

Below code is a very rudimentary way of finding out if you have memory pressure, the code uses SQL server DMVs:

SELECT total_physical_memory_kb/1024 [Total Physical Memory in MB],
	   available_physical_memory_kb/1024 [Physical Memory Available in MB],
	   system_memory_state_desc
FROM sys.dm_os_sys_memory

SELECT physical_memory_in_use_kb/1024 [Physical Memory Used in MB],
	   process_physical_memory_low [Physical Memory Low],
	   process_virtual_memory_low [Virtual Memory Low]
FROM sys.dm_os_process_memory

SELECT committed_kb/1024 [SQL Server Committed Memory in MB],
	   committed_target_kb/1024 [SQL Server Target Committed Memory in MB]
FROM sys.dm_os_sys_info

Watch out if you see the value of Physical Memory Low or Virtual Memory Low is 1. Then you should consider increasing the memory on the server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: