SQL Server Memory – Query Had to Wait for Memory Grant

memorymemory-grant-feedbacksql server

How do I go about troubleshooting an SP that times out every once in a while. When you include the actual execution plan, it says "The query had to wait for XXs for memory grant"

This does not happen on all the environments where the SP is running.

I have tried increasing the memory the on one of the machines where this occurs, it had no effect (8gb -> 16gb).

I am aware of the Memory Grant query hints, but this is not an option since the minimum requirement is SQL2012 (with no SP) and the hints were introduced in SP3.

Any guidance would be appreciated.

Query execution plan: https://www.brentozar.com/pastetheplan/?id=S1YAhUUbf

Best Answer

As sp_BlitzErik suggested, I used sp_Blitzcache to highlight the issues in the offending proc. I was able to address them and the problem went away. I highly recommend having a look at the SQL First Responders Kit. I wish I could give the credit for this answer to to Erik.