6

I got the warning message

The query had to wait xx seconds for MemoryGrant during execution

from the SQL execution plan. May I know what are the reasons/possibilities that would cause this warning message to appear?

Is it due to system memory leak or waiting for others pending SQL queries to be finished?

I extracted the query from SQL profile which is generated from Entity Framework(Linq) and run in SSMS 2019.

enter image description here

Dale K
  • 25,246
  • 15
  • 42
  • 71
Jimmy
  • 73
  • 1
  • 4
  • https://dba.stackexchange.com/questions/192520/mssql-query-had-to-wait-for-memory-grant – Dale K Jan 23 '20 at 03:17
  • https://www.brentozar.com/archive/2017/02/memory-grants-data-size/ – Dale K Jan 23 '20 at 03:17
  • check the memory grant & the min required memory & memory used in the properties of the execution plan. if there is a scale difference (between granted&used) go through the xml plan and check if optimized nested loops are performed. If they are, execute the query with 2340 trace flag or DISABLE_OPTIMIZED_NESTED_LOOP query hint. and check the diff of memory values again. – lptr Jan 23 '20 at 07:12

0 Answers0