Wednesday, April 29, 2020

Memory Grants Pending value

 Memory Grants Pending value

Here's a SQL query you can use to check for **pending memory grants** on your SQL Server instance. This can be a useful indicator of memory pressure, as it shows how many requests are waiting for memory to be allocated.

SELECT @@SERVERNAME AS [Server Name]
 ,RTRIM([object_name]) AS [Object Name]
 ,cntr_value AS [Memory Grants Pending]
FROM sys.dm_os_performance_counters WITH (NOLOCK)
WHERE [object_name] LIKE N'%Memory Manager%' -- Handles named instances
 AND counter_name = N'Memory Grants Pending'
OPTION (RECOMPILE);

For more in-depth information about the `sys.dm_os_performance_counters` dynamic management view, you can refer to the official Microsoft documentation: dm_os_performance_counters

If you're interested in further exploring SQL Server memory management, here are some related posts that might be helpful:

Popular Posts