Backup history file

A file written after completion of an online backup

A backup history file is a file written to pg_wal after completion of an online backup which contains parameters about the backup.

The PostgreSQL documentation says, somewhat nebulously:

pg_stop_backup() creates a backup history file in the transaction log archive area. The history file includes the label given to pg_start_backup(), the starting and ending transaction log locations for the backup, and the starting and ending times of the backup. The return value is the backup's ending transaction log location (which again can be ignored).

This file is basically an extended copy of the backup label file created by pg_start_backup(), however it is written to the pg_wal (PostgreSQL 9.6 and earlier: pg_xlog) directory as the WAL file name current when the backup completed, suffixed by .backup.

Moreover it will be almost immediately archived and moved from the pg_wal directory into the specified archive directory. If archiving is not active, the file will simply be removed.


$ cat 000000010000000000000002.00000028.backup
START WAL LOCATION: 0/2000028 (file 000000010000000000000002)
STOP WAL LOCATION: 0/20000F8 (file 000000010000000000000002)
BACKUP FROM: primary
START TIME: 2018-04-08 10:22:04 UTC
LABEL: test base backup
STOP TIME: 2018-04-08 10:22:05 UTC


Backup, Replication

See also

backup_label, tablespace_map