Skip to content

Est. 2011ยทMicrosoft Partner ID 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

License Error 8645

Error 8645: Memory Grant Timeouts Against the Standard Edition Memory Cap

12 min read Updated October 5, 2026 SQL Server

Fix it now

8645 is a timeout waiting for memory resources to execute a query in a named resource pool. It is not corruption or storage; it is plans reserving far more memory than they use inside an instance whose memory is bounded. Find the outlier grant first, because the edition ceiling is only the answer once the plans are sound.

Run at peak, while requests are actually queuing

SELECT g.session_id, g.dop, g.requested_memory_kb, g.granted_memory_kb,
       g.ideal_memory_kb, g.max_used_memory_kb, g.grant_time, g.wait_time_ms
FROM sys.dm_exec_query_memory_grants AS g
ORDER BY g.requested_memory_kb DESC;
  1. Look for rows with a NULL grant_time. That column is documented as NULL when memory has not been granted yet, so those are the requests still queuing.
  2. On the largest completed grant, compare granted_memory_kb with max_used_memory_kb. Reserving gigabytes and using megabytes is a broken estimate, not a capacity problem.
  3. Cap that one statement immediately with OPTION (MAX_GRANT_PERCENT = 10) so it stops starving everything else, then fix the estimate properly.
  4. Check the ceiling with SELECT SERVERPROPERTY('Edition'), SERVERPROPERTY('ProductVersion');, and search the error log for 17890 – a paged-out working set produces identical symptoms and has to be fixed first.

MAX_GRANT_PERCENT is not available for index creation or rebuilding, and in the default system pool a query still gets at least the memory it requires, so the hint is a ceiling rather than a guarantee.

If grants stop queuing under the same workload, you are done. If they still queue with sound plans, the next section covers where the pool’s size comes from.

Why it happens

A memory grant is a reservation, not an allocation. When the optimiser builds a plan containing a sort, a hash join or a hash aggregate, it works out the workspace that operator needs from the estimated row count and row width, and fixes that figure into the plan before a single row is read. The query must be handed the whole reservation before it starts, because a sort that runs out halfway has nowhere to go but tempdb.

Reservations come from a pool, and a resource semaphore issues them and forms a queue when the pool is empty. Each waiting request carries a timeout derived from its own cost unless the query wait option overrides it. 8645’s published text is exactly that: a timeout occurred while waiting for memory resources to execute the query in a named resource pool. 8651 is the neighbouring case where the grant simply was not available, and 8657 is the request exceeding what the workload group and pool permit at all.

Read the pool names in those messages carefully. All three name a resource pool and a workload group even when nobody has configured resource governor, because the internal and default pools always exist. Seeing a pool name in the message is therefore not evidence that somebody set up governance; check sys.dm_resource_governor_workload_groups before assuming it.

The edition decides how large that pool can get, because workspace memory is a fraction of what the instance may commit. Microsoft publishes Standard’s buffer pool ceiling as 128 GB per instance on SQL Server 2022 and earlier, and 256 GB on SQL Server 2025. Enterprise is bounded only by the operating system. That ceiling belongs to the edition, not to configuration: no trace flag or startup parameter lifts it, and memory beyond it simply sits unused.

A handful of plans reserve far more than they need

You have this one if On completed grants, max_used_memory_kb is a small fraction of granted_memory_kb, and ideal_memory_kb is far below what was requested.

  1. Update statistics on the tables the plan reads: UPDATE STATISTICS dbo.YourTable WITH FULLSCAN;
  2. Look in the plan for implicit conversion warnings on join or filter predicates. A converted column destroys the cardinality estimate and inflates the grant with it.
  3. Remove the sort by giving the query an index in the right order, which removes the grant as well.

MAX_GRANT_PERCENT is a ceiling, not a target. Set it too low and the query spills to tempdb and runs slower, which is usually still better than blocking the instance.

Resource governor is capping the request

You have this one if 8657 rather than 8645, raised instantly with no wait, and the session classifies into a group other than the default.

  1. Check what the group and pool permit in sys.dm_resource_governor_workload_groups and sys.dm_resource_governor_resource_pools.
  2. A request that wants more than the group will ever allow fails at once rather than queuing, which is why there is no wait time to look at.
  3. Raise REQUEST_MAX_MEMORY_GRANT_PERCENT on the group or the pool’s memory percentage, then run ALTER RESOURCE GOVERNOR RECONFIGURE.

Resource governor is available in Enterprise, Enterprise Developer, Standard and Standard Developer from SQL Server 2025; on earlier releases it is Enterprise and Developer only.

The instance is not getting the memory you think it has

You have this one if 17890 in the error log, reporting that a significant part of the process memory has been paged out, with the duration and working set in the message.

  1. Set max server memory (MB) to a figure that leaves the operating system real headroom rather than leaving it at its default maximum.
  2. Account for everything else on the machine: a second instance, an antivirus engine or a reporting service all squeeze the buffer pool.
  3. Consider the Lock Pages in Memory user right for the service account so the working set cannot be trimmed, and restart the instance so it takes effect.

Lock Pages in Memory changes how Windows reclaims memory under pressure across the whole machine. Set max server memory sensibly first, and only then consider it.

You are at the edition ceiling

You have this one if The edition is Standard, committed memory sits at the documented ceiling while the operating system reports free RAM, and grants queue at ordinary concurrency with plans that are already reasonable.

  1. Confirm rather than assume: compare the edition, the release, the memory the instance has committed, and the physical memory installed.
  2. Reduce what has to be resident. Archive cold data, compress the largest indexes, and drop indexes sys.dm_db_index_usage_stats shows nothing reads.
  3. Move the largest grant consumers off the busy instance, or schedule them away from the peak.

One workload is starving the rest and nobody has bounded it

You have this one if The instance is fine except during one reporting window, and the same handful of statements are always the top grants.

  1. Put that workload in its own pool with its own memory percentage. From SQL Server 2025 this no longer requires Enterprise.
  2. Where governance is not available, apply MAX_GRANT_PERCENT to the specific statements rather than to everything.
  3. Schedule the work away from the peak if neither is practical. It is a blunt fix but it costs nothing.

Full reference

Reading the numbers, layer by layer

What you observe Where the fault is
A few huge grants, most of each reservation unused Plan estimation: stale statistics or an implicit conversion
8657 raised instantly, with no wait The request wants more than the workload group will ever allow
8651 rather than 8645 The grant was not available in the pool, rather than timing out while waiting for it
17890 in the error log The working set was paged out. Fix that before anything else
Committed memory pinned at the documented ceiling, plans already sound The edition ceiling is the constraint

The two views that answer this

The pool first, then the individual requests

SELECT resource_semaphore_id, target_memory_kb, available_memory_kb,
       granted_memory_kb, used_memory_kb, grantee_count, waiter_count,
       timeout_error_count, forced_grant_count
FROM sys.dm_exec_query_resource_semaphores;

SELECT session_id, dop, requested_memory_kb, granted_memory_kb,
       ideal_memory_kb, max_used_memory_kb, required_memory_kb,
       grant_time, request_time, wait_time_ms
FROM sys.dm_exec_query_memory_grants
ORDER BY requested_memory_kb DESC;

In the semaphore view, waiter_count is the number of queries waiting for grants to be satisfied and timeout_error_count is the running total of timeout errors since startup, so a climbing timeout count with a non-zero waiter count is this problem in two numbers. Note that resource_semaphore_id 0 is the regular semaphore and 1 is the small-query one, and that several columns are NULL for the small-query semaphore by design.

The edition ceilings, dated

Scale limit Enterprise Standard (SQL Server 2025) Standard (2022 and earlier)
Buffer pool per instance Operating system maximum 256 GB 128 GB
Compute capacity Operating system maximum Lesser of 4 sockets or 32 cores Lesser of 4 sockets or 24 cores
Columnstore segment cache per instance Unlimited 32 GB 32 GB
Memory-optimised data per database Unlimited 32 GB 32 GB
Resource governor Yes Yes Enterprise and Developer only

Quote the number that matches the release you are running. The 128 GB figure is repeated everywhere and is simply wrong for SQL Server 2025.

The grant hints, and their documented limits

Hint What it does Limits
OPTION (MAX_GRANT_PERCENT = n) Caps the grant at n per cent of the configured memory limit Values 0.0 to 100.0. Not available for index creation or rebuilding. In the default system pool the query still gets at least the memory it requires
OPTION (MIN_GRANT_PERCENT = n) Guarantees at least the larger of required memory and n per cent Values 0.0 to 100.0. Overrides the minimum memory per query setting. Also unavailable for index work

Both have been available since SQL Server 2012 Service Pack 3 and SQL Server 2014 Service Pack 2, and in Azure SQL Database. Use MAX_GRANT_PERCENT as an emergency brake on one statement while you fix the estimate behind it, not as a standing hint on everything.

What not to do while the instance is queuing

Do not clear the plan cache to shift one bad plan on a busy instance. It forces every statement to recompile at once and turns a slow query into a stalled server. Target the individual plan instead, with a hint, a statistics update, or the index that removes the sort.

When the plans really are sound

  • Confirm committed memory is at the documented ceiling for your edition and release, not merely high.
  • Confirm the operating system has free memory the instance is not permitted to use. That gap is the whole argument.
  • Confirm 17890 is absent, because a paged-out working set imitates this exactly and is free to fix.
  • Confirm the workload has not simply grown past the machine. A ceiling you have not reached is not the constraint.

When a licence is the actual fix

If the plans are tuned, the outliers are capped, 17890 is absent and the instance still queues grants while the operating system holds memory it is not permitted to touch, then the edition ceiling is the constraint and nothing else is. Enterprise removes the per-instance buffer pool limit and the compute cap with it, so the grant pool grows to what the hardware has rather than to what the edition allows – on SQL Server 2025 that is the difference between Standard’s 256 GB and 32 cores and the operating system maximum. It is licensed per core in two-core packs, so the quantity follows the cores the instance runs on. Do the free work first: most outbreaks come from two or three plans with badly wrong estimates, and fixing those costs nothing. Arco supplies SQL Server 2025 Enterprise 2-core packs and will check the core count and the memory figures with you before you order.

Every code this article covers

Code What it points at Source
8645 A timeout occurred while waiting for memory resources to execute the query in the named resource pool Microsoft Learn
8657 The memory grant could not be issued because it exceeds the maximum configuration limit in the named workload group and resource pool Microsoft Learn
17890 A significant part of the SQL Server process memory has been paged out, with the duration, working set and committed memory in the message Microsoft Learn
8651 The operation could not be performed because the requested memory grant was not available in the named resource pool Microsoft Learn

Confirm the fix worked

  1. Run the grants query at peak and confirm no row holds a NULL grant_time for more than a moment.
  2. waiter_count sits at zero and timeout_error_count stops climbing in sys.dm_exec_query_resource_semaphores.
  3. The error log shows no new 8645, 8651 or 8657 across a full business day.
  4. 17890 is absent from the error log.
  5. In the actual plan of the statement that failed, granted memory is now in proportion to the rows it returns.

Questions people ask about this

Can a trace flag raise the Standard memory limit?

No. It is a documented scale limit of the edition and no supported flag, registry value or startup parameter changes it. Anything claiming otherwise is describing a different limit, such as the separate allowances for columnstore segment cache and memory-optimised data.

Is the Standard ceiling 128 GB or 256 GB?

128 GB of buffer pool per instance on SQL Server 2022 and earlier, and 256 GB on SQL Server 2025. Check the release before quoting either figure, because the older number is still the one most often repeated.

The error names a resource pool. Does that mean resource governor is configured?

No. The internal and default pools always exist, so 8645, 8651 and 8657 name a pool whether or not anyone has set up governance. Check sys.dm_resource_governor_workload_groups before concluding it has been.

Will adding RAM to the server help?

Only if the instance may use it. On a capped edition, memory beyond the ceiling is invisible to the engine, so check what the instance has committed before ordering hardware.

Does raising query wait fix it?

It hides it. Requests then queue longer before failing, which converts an error into a stall. Treat it as a temporary measure while you fix a plan, not as a setting to leave in place.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

Free Fix Error 17182: TDSSNIClient Initialisation Failed and the Port Never Opens License Error Error 3967: Insufficient Space in tempdb to Hold Row Versions Free Fix Error 3241: The Media Family on Device Is Incorrectly Formed Free Fix Error 9002: The Transaction Log Is Full – Find the log_reuse_wait Reason
โ† Back to Knowledge Base