SQL Server error 701: Insufficient memory in resource pool
SQL Server couldn't get the memory it needed for a query in this resource pool. The server, pool or a memory-hungry workload is short of memory.
- Error number
701- Severity
- 19
- Category
- Memory, log and storage
What it means
Error 701 means a memory allocation failed: SQL Server needed memory for the query and the resource pool (usually default or internal) couldn't provide it. It points at memory pressure on the instance, not a bug in the query itself, though one query with a huge memory grant can be the cause.
Common causes
max server memoryset too low for the workload, or the machine itself low on memory.- A Resource Governor pool with a tight
MAX_MEMORY_PERCENT. - Memory-optimized (In-Memory OLTP) tables growing beyond what the pool allows.
- Queries with very large memory grants for sorts and hash joins, often from bad row estimates.
- Other processes on the server taking memory, or a memory leak in a component loaded into SQL Server.
How to fix it
-
Check the memory configuration.
SELECT name, value_in_use FROM sys.configurations WHERE name IN (N'max server memory (MB)', N'min server memory (MB)');
-
See which memory clerks use the most memory.
SELECT TOP (10) type, SUM(pages_kb) / 1024 AS mb FROM sys.dm_os_memory_clerks GROUP BY type ORDER BY mb DESC;
-
Look for queries with large memory grants.
SELECT session_id, requested_memory_kb, granted_memory_kb, query_cost FROM sys.dm_exec_query_memory_grants ORDER BY requested_memory_kb DESC;
-
Raise
max server memoryif the host has room, or add memory, and tune the queries with the largest grants (better indexes and up-to-date statistics shrink sorts and hashes).
Related errors
8645Timeout waiting for memory resources8623Query processor ran out of resources53200PostgreSQL: out of memoryORA-04031Oracle: unable to allocate bytes of shared memory
More memory, log and storage errors
9002Transaction log for database is full1105Filegroup is full, cannot allocate1101Could not allocate a new page1204Cannot obtain a LOCK resource
The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.
Work on SQL Server in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.