Sobes.tech
Middle

Which command performs a PostgreSQL backup?

sobes.tech AI

Answer from AI

To create a PostgreSQL backup, the pg_dump utility is usually used.

Example command for creating a database backup:

pg_dump -U <user> -h <host> -p <port> -F c -b -v -f backup_file.dump <database_name>

Where:

  • -F c — archive format (custom), convenient for restoration
  • -b — include large objects
  • -v — verbose output
  • -f — filename for saving the backup

For restoration, the pg_restore command is used.