# PostgreSQL Backup

Back up PostgreSQL databases with scheduled dumps to any cloud storage provider.

SimpleBackups connects to your PostgreSQL database and creates scheduled dump files using `pg_dump`. Backups are compressed, uploaded to your chosen storage, and retained according to the policy you set. For connection method options (SSH, serverless, Docker), see the [database backup overview](https://simplebackups.com/docs/database-backup/overview).

## Backup options

### Backup user permissions

Your PostgreSQL backup user needs read access to every object you want to include in the dump. If you encounter permission errors during a backup run, grant the following privileges on your target database and schema:

```sql
GRANT CONNECT ON DATABASE "your_database_name" TO backup_user;
GRANT SELECT ON ALL TABLES IN SCHEMA your_schema_name TO backup_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA your_schema_name TO backup_user;
```

Replace `your_database_name`, `your_schema_name`, and `backup_user` with your actual values.

### Backing up from a replica

You can point SimpleBackups at a read replica instead of the primary to reduce load on your production database. When doing so, be aware that long-running `pg_dump` queries can conflict with WAL replay on the replica and cause the backup to fail.

- [PostgreSQL backups on replicas](https://simplebackups.com/docs/database-backup/postgresql-backup/postgresql-backups-on-replicas-conflict-with-recovery): Understand replica conflict errors and how to avoid them.

## Restoring a backup

- [Restore a PostgreSQL backup](https://simplebackups.com/docs/database-backup/postgresql-backup/restore-a-postgresql-backup): How to download and restore a PostgreSQL dump file using pg_restore or psql.

## Troubleshooting

- [PostgreSQL backup FAQ](https://simplebackups.com/docs/database-backup/postgresql-backup/faq): Common errors and fixes for PostgreSQL backup operations.
