SQL Server Error 701 — There is insufficient system memory
There is insufficient system memory in resource pool 'X' to run this query.
SQL Server (or a specific Resource Governor pool) couldn't get the memory grant it needed. This can be a server-level configuration issue or a single poorly-optimized query demanding far more memory than it should.
Common causes
- SQL Server's max server memory set too high relative to actual RAM, starving the OS and other processes (or set too low, starving SQL Server itself)
- A single query with a huge sort, hash join, or hash aggregate requesting an unreasonably large memory grant
- Resource Governor pool limits configured too restrictively for the workload
- Other applications on the same machine competing for memory (a sign SQL Server shouldn't be co-hosted with other heavy workloads)
- Plan cache bloat or a memory leak in an extended stored procedure/CLR module (rarer)
How to fix it
- Check current memory configuration vs. actual server RAM: sp_configure 'max server memory'.
- Look for queries waiting on or requesting large memory grants: SELECT * FROM sys.dm_exec_query_memory_grants.
- If one query is the culprit, get its execution plan and look for large sort/hash operators — often fixable with a better index that avoids the sort entirely.
- If Resource Governor is in use, review whether the relevant pool's MAX_MEMORY_PERCENT is too tight for real workload needs.
- Confirm no other applications are competing for memory on the same box, and that "Lock Pages in Memory" / OS-level settings are configured correctly for a dedicated SQL Server host.
Paste the query and its execution plan here to see exactly why it's requesting so much memory.
Try query analyzer free →