SQL SERVER – Dirty Pages Clean Pages and the Correct Cache Commands

Clean Pages have no outstanding data-file write, while dirty pages contain unwritten changes. A customer asked which state was better.

Panels with pending and settled work remain distinct from a separate template case.

SELECT DB_NAME(database_id) AS DatabaseName,is_modified,COUNT_BIG(*) AS CachedPages
FROM sys.dm_os_buffer_descriptors
WHERE database_id=DB_ID() GROUP BY database_id,is_modified;

A clean page can be read without modification. It can also become clean after changed contents are written. My earlier definition required modification incorrectly. Both states are normal buffer-pool behavior.

Checkpoints write eligible dirty pages under write-ahead logging. DROPCLEANBUFFERS removes clean buffers for specialized tests. FREEPROCCACHE clears execution plans. It does not turn dirty data pages clean.

The inventory counts database buffer descriptors by modification flag. It does not describe every memory allocation or total process memory. Compare defined intervals and workloads for pressure or latency investigations.

Don’t clear shared caches or force checkpoints to improve the appearance of a count. Investigate the actual workload requirement. Keep plan-cache and data-cache scopes distinct.

Related reading

A clean page is not necessarily a previously modified page, it is a page without an outstanding modification to write.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

SQL Memory, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Query Cost 100%
Next Post
SQL SERVER – Parallelism in Express Edition

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.