Appearance
Checkpointing
A mechanism used in database recovery to reduce the time required to recover from a system failure.
The Problem It Solves
During normal operation, a DBMS keeps a log of all transactions. If a crash occurs, the system must scan the entire log to redo/undo transactions — which can be very slow for large logs. Checkpointing solves this by periodically creating a "save point".
What Happens During a Checkpoint?
- Suspends all active transactions temporarily
- Flushes all modified (dirty) buffers from memory to disk
- Writes a record to the log
- Resumes transactions
Recovery Using Checkpoints
After a crash, the system only needs to look at the log from the last checkpoint onwards:
- Transactions committed after the last checkpoint → REDO
- Transactions not committed at crash time → UNDO
- Transactions committed before the last checkpoint → NOTHING (already safe on disk)
Types of Checkpointing
| Type | Description |
|---|---|
| Sharp Checkpoint | All dirty pages flushed at once; simple but causes a brief pause |
| Fuzzy Checkpoint | Pages flushed gradually; no pause, used in modern systems |
Key Benefit
Checkpointing limits the recovery window, making crash recovery much faster and more efficient.