← Lessons

quiz vs the machine

Gold1420

Databases

Checkpointing

Checkpoints flush dirty pages so recovery does not replay the entire log.

5 min read · core · beat Gold to climb

Why Bound The Log

Write ahead logging means committed changes may sit in the redo log long before they reach the data files. Without limits, recovery would have to replay the log from the beginning of time. A checkpoint bounds this work by flushing dirty pages and recording how far recovery can safely start.

What A Checkpoint Does

  • It writes dirty buffer pool pages to disk up to a chosen point in the log.
  • It records a checkpoint position marking the oldest log record still needed for recovery.
  • After a crash, recovery starts replaying from that position instead of the whole log.

Sharp vs Fuzzy

  • A sharp checkpoint pauses activity and flushes everything, giving a clean point but a stall.
  • A fuzzy checkpoint flushes pages gradually while transactions keep running, smoothing the load at the cost of a slightly longer replay window.

Tuning checkpoint frequency trades steady write load against recovery time. Frequent checkpoints mean shorter recovery but more constant flushing.

Key idea

A checkpoint flushes dirty pages and marks a log position so recovery replays only recent records, trading ongoing write effort against crash recovery time.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a checkpoint primarily accomplish?

2. How does a fuzzy checkpoint differ from a sharp one?

3. What is the cost of very frequent checkpoints?