How to fix Error 3613 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3613 — “SQL Server parse and compile time”

Why This Error Happens

This message is actually a diagnostic trace output rather than a true error, and it typically surfaces when SET STATISTICS TIME ON or an extended event session is capturing parse/compile metrics during query execution. It becomes a visible “issue” when excessive parse and compile CPU time indicates plan cache bloat, outdated statistics, or missing indexes causing the optimizer to work harder than expected. In some cases, corrupted procedure cache entries or a misconfigured max server memory setting on Windows Server 2025 can also inflate compile times unnecessarily.

Step-by-Step Resolution Guide

Step 1: Confirm the Source of the Message

  • Open SQL Server Management Studio (SSMS) and check if SET STATISTICS TIME ON is active in the session.
  • Review Extended Events sessions via SELECT * FROM sys.dm_xe_sessions; to see if a trace is logging compile time.
  • Check Windows Event Viewer under Applications and Services Logs > Microsoft > SQL Server for correlating Event ID 3613 entries.

Step 2: Clear and Rebuild the Procedure Cache

  • Run the following to flush the plan cache (use cautiously in production):
  DBCC FREEPROCCACHE;
  • Update statistics on the affected database to help the optimizer generate efficient plans faster:
  EXEC sp_updatestats;
  • Rebuild fragmented indexes using ALTER INDEX ALL ON [TableName] REBUILD;

Step 3: Adjust Memory and Configuration Settings

  • Open SQL Server Configuration Manager (search for it in Windows 11 Start Menu or run SQLServerManager16.msc).
  • Navigate to SQL Server Services, confirm the service account has sufficient privileges, and restart the SQL Server service.
  • In SSMS, verify max server memory (MB) is appropriately set under Server Properties > Memory (avoid starving the OS, especially on Windows Server 2025 with Hyper-V roles active).

Step 4: Disable Unnecessary Diagnostic Tracing

  • If the message appears only in debug/testing environments, disable SET STATISTICS TIME ON in your scripts.
  • Remove any active Extended Events sessions you no longer need:
  DROP EVENT SESSION [SessionName] ON SERVER;

Alternative or Verification Steps

  • Run a sample query with SET STATISTICS TIME ON; manually and confirm the parse/compile CPU time has dropped to near-zero (under 5ms) after cache rebuild.
  • If high compile times persist, use sys.dm_exec_query_stats to identify specific problem queries and consider forcing a plan via USE PLAN or creating a Plan Guide as a workaround.