lowOther

WAITFOR Wait Type Explained

SQL Server WAITFOR wait type explained: causes, diagnosis, and why this benign wait should be filtered from wait statistics analysis for accurate performance tuning.

Quick Answer

WAITFOR waits occur when applications use the WAITFOR DELAY or WAITFOR TIME T-SQL statements to intentionally pause execution. This is a completely benign wait type that represents programmed delays, not performance problems. Filter this wait from all wait statistics analysis as it provides no diagnostic value.

Root Cause Analysis

WAITFOR waits occur when the SQL Server scheduler processes WAITFOR DELAY or WAITFOR TIME commands. When these statements execute, the scheduler places the session into a waiting state for the specified duration without consuming CPU resources. The wait appears in sys.dm_os_wait_stats because the session is literally waiting, but this is intentional application behavior, not a system bottleneck.

Common sources include application retry logic with deliberate delays, maintenance scripts with pauses between operations, and service broker applications using timed waits. The scheduler handles these waits identically across all SQL Server versions from 2016 through 2025, parking the session until the specified time expires or a WAITFOR condition is met.

Unlike resource waits that indicate contention, WAITFOR represents successful execution of programmed delays. The duration directly correlates to the DELAY parameter or time remaining until the specified TIME value.

AutoDBA checks benign wait filtering, actionable wait identification, and wait statistics analysis across your entire SQL Server instance in 60 seconds. Download the free diagnostic script and see what else needs attention.

Diagnostic Queries

Confirm WAITFOR wait presence and impact:

-- Show WAITFOR waits compared to total waits
SELECT 
    wait_type,
    wait_time_ms / 1000.0 AS wait_time_seconds,
    waiting_tasks_count,
    wait_time_ms * 100.0 / SUM(wait_time_ms) OVER() AS percent_of_total
FROM sys.dm_os_wait_stats
WHERE wait_type = 'WAITFOR'
    AND wait_time_ms > 0
ORDER BY wait_time_ms DESC;

Filter benign waits for meaningful analysis:

-- Wait stats excluding benign waits like WAITFOR
SELECT TOP 20
    wait_type,
    wait_time_ms / 1000.0 AS wait_time_seconds,
    (wait_time_ms - signal_wait_time_ms) / 1000.0 AS resource_wait_seconds,
    waiting_tasks_count,
    wait_time_ms * 100.0 / SUM(wait_time_ms) OVER() AS percent_of_total
FROM sys.dm_os_wait_stats
WHERE wait_type NOT IN (
    'WAITFOR', 'SLEEP_TASK', 'BROKER_TO_FLUSH', 'BROKER_TASK_STOP',
    'CLR_AUTO_EVENT', 'CLR_MANUAL_EVENT', 'LAZYWRITER_SLEEP',
    'RESOURCE_QUEUE', 'SERVER_IDLE_CHECK', 'SLEEP_SYSTEMTASK',
    'SQLTRACE_BUFFER_FLUSH', 'WAIT_FOR_RESULTS', 'XE_DISPATCHER_WAIT',
    'XE_TIMER_EVENT'
)
AND wait_time_ms > 0
ORDER BY wait_time_ms DESC;

Prevention

No prevention is required since WAITFOR waits represent normal, intended application behavior. These waits confirm that WAITFOR statements are executing as designed. Attempting to eliminate them would break application logic that depends on timed delays.

Modern monitoring tools like AutoDBA automatically filter benign waits including WAITFOR, allowing DBAs to focus on actionable performance issues rather than sorting through noise from intentional application delays.

Need hands-on help?

Dealing with persistent waitfor issues across your environment? Samix Technology provides hands-on SQL Server performance consulting with 15+ years of production DBA experience.

Related Pages