Quick Answer
LAZYWRITER_SLEEP occurs when the lazy writer background process is idle and waiting for work. This wait type represents normal downtime for the lazy writer thread, which asynchronously flushes dirty pages from the buffer pool to disk. This is a completely benign wait that should be filtered from wait statistics analysis as it indicates healthy system operation, not performance problems.
Root Cause Analysis
The lazy writer is a SQL Server background process that manages buffer pool cleanliness by writing modified data pages to disk during periods of low activity. When the lazy writer has no dirty pages to flush or when the system is not under memory pressure, the process enters a sleep state that generates LAZYWRITER_SLEEP waits.
The lazy writer operates independently of user activity and checkpoint operations. It scans the buffer pool looking for dirty pages to write, prioritizing pages that haven't been accessed recently. When it finds no work to perform, the thread suspends itself for a predetermined interval, typically around 100 milliseconds, before checking again for dirty pages.
This behavior is consistent across SQL Server versions 2016 through 2025, though the efficiency of the lazy writer algorithm has improved in newer versions. In SQL Server 2019 and later, the lazy writer uses more sophisticated algorithms to determine when to sleep and for how long, but the fundamental LAZYWRITER_SLEEP wait behavior remains unchanged.
The presence of LAZYWRITER_SLEEP waits actually indicates a healthy system where the lazy writer isn't constantly busy, suggesting adequate memory and reasonable I/O patterns. Systems under severe memory pressure or with extremely high write workloads may show fewer of these waits because the lazy writer never gets to rest.
AutoDBA checks benign wait filtering, wait statistics analysis, and background process monitoring across your entire SQL Server instance in 60 seconds. Download the free diagnostic script and see what else needs attention.
Diagnostic Queries
-- Check current LAZYWRITER_SLEEP wait statistics
SELECT
wait_type,
waiting_tasks_count,
wait_time_ms,
max_wait_time_ms,
signal_wait_time_ms,
wait_time_ms - signal_wait_time_ms AS resource_wait_time_ms
FROM sys.dm_os_wait_stats
WHERE wait_type = 'LAZYWRITER_SLEEP';
-- View wait stats excluding benign waits like LAZYWRITER_SLEEP
SELECT
wait_type,
wait_time_ms,
waiting_tasks_count,
wait_time_ms / waiting_tasks_count AS avg_wait_time_ms,
(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 (
'LAZYWRITER_SLEEP', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
'DISPATCHER_QUEUE_SEMAPHORE', 'LOGMGR_QUEUE',
'CHECKPOINT_QUEUE', 'REQUEST_FOR_DEADLOCK_SEARCH',
'XE_TIMER_EVENT', 'BROKER_TO_FLUSH', 'BROKER_TASK_STOP'
)
AND wait_time_ms > 0
ORDER BY wait_time_ms DESC;
Prevention
No prevention is required or recommended for LAZYWRITER_SLEEP waits. This wait type represents normal, healthy SQL Server operation and attempting to eliminate it would indicate a misunderstanding of SQL Server's architecture.
Modern monitoring solutions like AutoDBA automatically filter benign waits including LAZYWRITER_SLEEP from their analysis, allowing DBAs to focus exclusively on wait types that indicate actual performance bottlenecks. Manual wait statistics queries should always exclude these background process waits to avoid false positives in performance analysis.
The presence of LAZYWRITER_SLEEP waits confirms that your lazy writer process is functioning normally and has periods of inactivity, which is exactly what you want in a well-tuned system.
Need hands-on help?
Dealing with persistent lazywriter_sleep issues across your environment? Samix Technology provides hands-on SQL Server performance consulting with 15+ years of production DBA experience.