A standalone hot physical backup
Hot physical backup is an important capability for databases.
Physical backup allows us to get a completely consistent view of the changes to all databases at once. Physical backup also allows us to back up even while DDL changes are being executed on the database. Apart from resource constraints, there is no additional overhead or locking with this approach.
Physical backup procedures used to be slightly more complex than logical backup procedures, but since version 10, some defaults have been changed, making them easier; after these changes, making a backup with pg_basebackup
has become very easy, even with default settings.
In this recipe, we will first describe the easiest method, which is to use the pg_basebackup
utility, and then provide a lower-level equivalent process to explain physical backups in more detail and describe the changes required for additional features, such as differential backup or a parallel file copy.