Memory grant related diagnostics
Published Mar 23 2019 02:38 PM 784 Views
First published on MSDN on Jul 16, 2016
Back in March I blogged about Addressing large memory grant requests from optimized Nested Loops . To further enhance discoverability of memory grant related issues, in SQL Server 2016 we released a new xEvent (query_memory_grant_usage). This fires at the end of query processing for all queries with a memory grant over 5MB, and provides insight into potential memory grant inaccuracies.

Also in SQL Server 2014 SP2, we now included a new memory grant warning in showplan. This will also release on SQL Server 2016 in an upcoming update.

Purpose of this warning is to help identify potentially detrimental performance scenarios related to memory grants. As such, this is a warning that is only available at execution time, so an actual execution plan.

Three conditions can trigger this warning to show up in showplan:

  1. Excessive Grant : when max used memory is too small compared to the granted memory. This scenario can cause blocking and less efficient usage when large grants exist and a fraction of that memory was used.

  2. Used More Than Granted : when the max used memory exceeds the granted memory. This scenario can cause OOM conditions on the server.

  3. Grant Increase : when the dynamic grant starts to increase too much, based on the ratio between the max used memory and initial request memory. This scenario can cause server instability and unpredictable workload performance.

Below is a simple example of an excessive grant warning:

Pedro Lopes ( @sqlpto ) – Senior Program Manager
Version history
Last update:
‎Mar 23 2019 02:38 PM
Updated by: