PostgreSQL Tutorial for Absolute Beginners [Administration]
About Lesson

Commit Log

PostgreSQL holds the statuses of transactions in the Commit Log. The Commit Log, often called the clog, is allocated to the shared memory, and is used throughout transaction processing.

Transaction status

  • PostgreSQL defines four transaction states, i.e. IN_PROGRESS, COMMITTED, ABORTED, and SUB_COMMITTED.
  • The first three statuses are obvious. For example, when a transaction is in progress, its status is IN_PROGRESS, etc.
  • SUB_COMMITTED is for sub-transactions, and its description is omitted in this document.

pg_control file

As the pg_control file contains the fundamental information of the checkpoint, it is certainly essential for database recovery. If it is broken or unreadable, the recovery process cannot start up in order to not obtained a starting point.

Even though pg_control file stores over 40 items, three items to be required in the next section are shown in the following:

State –The state of database server at the time of the latest checkpointing starts.

There are seven states in total:

  • ‘start up’ is the state that system is starting up;
  • ‘shut down’ is the state that system is going down normally by the shutdown command;
  • ‘in production’ is the state that system is running; and so on.
  • Latest checkpoint location – LSN Location of the latest checkpoint record.
  • Prior checkpoint location – LSN Location of the prior checkpoint record. Note that it is deprecated in version 11;
Join the conversation