What a Dirty Page Is
When a transaction modifies a row, the engine changes the page in the buffer pool, not on disk. That modified page is now dirty: its memory copy differs from the disk copy. The change is durable thanks to the write ahead log, but the page itself still needs to reach disk eventually.
Why Flushing Is Deferred
Writing every change to disk immediately would be slow and would force random I O. By holding dirty pages in memory, the engine can:
- Batch many changes to the same page into one write.
- Write groups of pages sequentially instead of one at a time.
- Let the fast write ahead log provide durability in the meantime.
When Pages Get Flushed
A background flusher writes dirty pages to disk based on triggers:
- The fraction of dirty pages crosses a threshold.
- A checkpoint runs to advance the recovery starting point.
- A page must be evicted but is still dirty.
Flushing too lazily lengthens crash recovery, while flushing too eagerly wastes I O bandwidth, so engines tune the pace carefully.
Key idea
Dirty pages hold modified data in memory, and a background flusher writes them to disk on thresholds and checkpoints, balancing I O cost against recovery time.