Troubleshooting Guide: SQL Server Error 3641 (“Total logical reads %lu…”)
Why This Error Happens
Error 3641 is typically a statistics/informational message rather than a critical failure, often appended to the output of STATISTICS IO or DBCC commands when displaying query performance metrics such as logical reads, physical reads, and read-ahead reads. In SQL Server 2025 running on Windows Server 2025 or Windows 11, this message can appear unexpectedly in logs or client output when verbose diagnostic logging is enabled, when a corrupted statistics cache causes malformed output formatting, or when trace flags (such as 3604 or 3605) redirect diagnostic output incorrectly. In rarer cases, it surfaces alongside I/O subsystem stress, where delayed reads from a misconfigured storage path (SAN/NVMe passthrough) cause the message buffer to flush improperly.
Step-by-Step Resolution Guide
Step 1: Verify the Context of the Message
- Open SQL Server Management Studio (SSMS) and re-run the query with
SET STATISTICS IO ON;to confirm whether this is expected diagnostic output rather than a true error. - Check the SQL Server Error Log at
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOGfor surrounding context (timestamps, session ID, and preceding warnings).
Step 2: Disable Conflicting Trace Flags
- Run
DBCC TRACESTATUS(-1);to list all active trace flags on the instance. - If flags like
3604or3605are active unintentionally, disable them using:
DBCC TRACEOFF (3604, -1);
DBCC TRACEOFF (3605, -1);
- Restart the SQL Server service via Services.msc or
net stop MSSQLSERVER && net start MSSQLSERVERto ensure flags aren’t re-applied at startup via-Tstartup parameters in SQL Server Configuration Manager.
Step 3: Rebuild Statistics and Check for Corruption
- Run
DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;to rule out underlying corruption causing malformed message output. - Update statistics using
EXEC sp_updatestats;to refresh the metadata driving the logical reads calculation. - Ensure Windows Server 2025 storage drivers (particularly NVMe/Storage Spaces Direct drivers) are updated via Windows Update or vendor-specific driver packages to rule out I/O layer interference.
Step 4: Validate SQL Server Configuration Manager Settings
- Open SQL Server Configuration Manager → SQL Server Services → Right-click SQL Server (MSSQLSERVER) → Properties → Startup Parameters.
- Remove any stray
-T3641or unofficial trace flag parameters that may be forcing this output on every session.
Alternative or Verification Steps
- Verify the fix by re-executing the original query with
SET STATISTICS IO, TIME ON;— the output should now cleanly display logical reads without the error wrapper, confirming it was a diagnostic/trace flag issue rather than a system fault. - Alternative solution: If the message persists, apply the latest SQL Server 2025 Cumulative Update (CU) via Microsoft Update Catalog, as this specific formatting issue may be tied to a known display bug in the I/O statistics module on cross-compatible Windows 11/Server 2025 builds.