Learn how checkpoints are used to make the recovery process more efficient.
While log-based recovery is robust, relying solely on the log after a system crash can be inefficient. If the system has been running for a long time, the log file can become enormous, and the recovery process would have to scan the entire log from the very beginning to identify which transactions need to be redone or undone. This could lead to very long recovery times. Checkpoints are a mechanism to optimize this process. A checkpoint is a point in time where the DBMS pauses momentarily and performs several tasks to minimize the work needed for future recovery. Specifically, it forces all log records that are currently in memory buffers to be written to the stable log file on disk. More importantly, it forces all modified data blocks (from committed transactions) that are in memory buffers to be written to the database on disk. Once this is done, a special `<CHECKPOINT>` record is written to the log file. Now, when the system recovers from a crash, the recovery manager knows it only needs to scan the log file from the last checkpoint record forward. Any transaction that committed before the checkpoint is guaranteed to have its changes already on disk, so it doesn't need to be redone. This significantly reduces the portion of the log that needs to be processed, leading to much faster recovery.