Why This Error Happens
Error 3950 occurs when a long-running transaction holds row versions in the version store (tempdb) for an extended period, causing the version store scan to exceed its internal timeout while trying to locate the next required row version. This is typically triggered by high transactional activity combined with insufficient tempdb throughput, aggressive snapshot isolation usage, or a tempdb that is undersized and heavily fragmented. In Windows Server 2025 / Windows 11 environments, this can be exacerbated by slow disk I/O on the tempdb volume or misconfigured tempdb file counts relative to CPU core allocation.
Step-by-Step Resolution Guide
Step 1: Identify Long-Running Transactions Blocking the Version Store
- Run the following query to find open transactions consuming version store space:
SELECT * FROM sys.dm_tran_active_snapshot_database_transactions
ORDER BY elapsed_time_seconds DESC;
- Look for transactions with high
elapsed_time_secondsand cross-reference withsys.dm_exec_sessionsto identify the offending session or application. - Kill or commit any orphaned long-running transactions using
KILL <session_id>if safe to do so.
Step 2: Expand and Reconfigure tempdb
- Navigate to
SQL Server Management Studio > Databases > tempdb > Properties > Files. - Increase the initial size of tempdb data files (e.g., set to 10GB+ depending on workload) and set autogrowth in fixed MB increments (e.g., 512MB) rather than percentage-based growth.
- Ensure the number of tempdb data files matches CPU core count (up to 8), each file equal in size:
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev2, SIZE = 5120MB, FILEGROWTH = 512MB);
- Relocate tempdb files to a dedicated SSD/NVMe volume if currently sharing disk I/O with OS or user databases.
Step 3: Adjust Version Store Timeout Threshold
- Use trace flag 1255 or configure the version store cleanup interval via
sp_configureif your workload requires longer snapshot retention windows:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'version store cleanup interval', 120;
RECONFIGURE;
- Restart the SQL Server service via
services.mscon Windows Server 2025 for configuration changes to take effect.
Step 4: Review Isolation Level Usage in Application Code
- Audit application connection strings and stored procedures for excessive use of
READ COMMITTED SNAPSHOTorSNAPSHOT ISOLATION. - Where possible, shorten transaction scope by committing batches more frequently instead of wrapping large bulk operations in a single transaction.
Alternative or Verification Steps
- Re-run the previously failing query/statement during a lower-traffic window and monitor
sys.dm_db_file_space_usageto confirm tempdb version store space is stable and not climbing uncontrollably. - If the error persists, consider temporarily disabling snapshot isolation on the affected database (
ALTER DATABASE [YourDB] SET ALLOW_SNAPSHOT_ISOLATION OFF;) as a fallback while you address the root cause of long-running transactions.