Checkpoint in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

In DBMS, checkpoints are crucial for maintaining system consistency and managing transaction log files. They mark points where transactions are saved to the database, clearing the log file for new operations. This mechanism compresses the log by transferring old transactions to permanent storage, ensuring system recovery and stability. Checkpoints act as a 'savepoint', signifying a consistent state before all transactions are committed. As transactions execute, checkpoints are traced, updating the log file with each step. When a checkpoint is reached, updates are saved to the database, and the log is cleared, beginning anew until the next checkpoint.

Recovery using Checkpoint

The schematic representation of the system recovery when the failure occurs during the execution of concurrent transactions.

Recovery using  Checkpoints

Transactions and their operations in the above diagram:

T1T2T3T4
START
START
COMMIT
START
COMMIT
START
FAILURE

Following are the steps to be performed for the system recovery using checkpoint.

  • The transaction log file are read in the reverse order, ie., from T4 to T1.
  • Redo and Undo are the lists that are created and maintained by the system.
  • If the transactions contain operations like <Tn, start> and <Tn, commit> together or <Tn, commit> alone then the transaction will be stored in the redo list. In the above diagram, The transaction T1 contains only <Tn, commit> and transactions T2 and T3 contain <Tn, start> and <Tn, commit> both the operations and therefore transactions T1, T2 and T3 are stored in the redo list.
  • If the transactions contain operations like <Tn, start> but not <Tn, commit>, then the transaction will be stored in undo list. In the above diagram, The transaction T4 contains <Tn, start> but not <Tn, commit> operation, and therefore transaction T4 is stored in undo list.

Table of transactions operations and the lists they are placed in

OperationsList
<Tn,start> and <Tn,commit>Redo list
<Tn,commit>Redo list
<Tn,start>Undo list

Advantages of Checkpoint

  • A checkpoint is a feature that enhances the consistency of the database during the execution of multiple transactions concurrently.
  • Checkpoint help in getting our transactions back in the case of accidental shutdown of the database.
  • Checkpoint hardens the dirty pages. Hardening dirty pages refer to writing all the dirty pages from log files or the buffer to physical disk.
  • Checkpoint serves as the synchronization point between the database and the transaction log file.
  • Checkpoint accelerates the data recovery process.
  • Checkpoint records in the log file avoid irrelevant redo operations.
  • The execution and the maintenance of the transaction log file become easier and simpler due to the continuous shifting of dirty pages from log files to permanent storage.

Conclusion

  • The DBMS checkpoint is a mechanism of compressing the transaction log file by transferring the old transactions to permanent storage.
  • The checkpoint marks the position till the consistency of the transactions is maintained.
  • During the execution of the transactions, the log is generated till the checkpoint gets transferred to the permanent storage.
  • It helps in system recovery when the failure occurs.
  • The procedure of system recovery includes reading of log file in the reverse order and maintaining redo and undo lists.

Read More: