// SQL Server error reference

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
Error message
There is insufficient system memory in resource pool '%ls' to run this query.

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 memory set 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

  1. 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)');
  2. 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;
  3. 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;
  4. Raise max server memory if 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

More memory, log and storage errors

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.

// fewer errors, faster fixes

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.