Compile Memory Limit Exceeded
sp_BlitzCache™ Finding: Compile Memory Limit Exceeded
SQL server only has so much memory available for all operations. The query optimizer is no exception. One or more execution plans have been found where the queries were so complex, SQL Server could not allocate enough memory to compile the queries. This is a bad sign.
How to Fix the Problem
Simplify your query. There are no tricks that you can pull here – this requires hands on query tuning.
You can find the offending queries with the following T-SQL:
|
1 2 3 4 5 6 7 8 9 10 11 |
WITH XMLNAMESPACES('http://schemas.microsoft.com/sqlserver/2004/07/showplan' AS p) SELECT st.text, qp.query_plan FROM ( SELECT TOP 50 * FROM sys.dm_exec_query_stats ORDER BY total_worker_time DESC ) AS qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) AS qp WHERE qp.query_plan.exist('//p:StmtSimple/@StatementOptmEarlyAbortReason[.="MemoryLimitExceeded"]') = 1 |
