Postgresql – Database Restoration Issue

postgresql

I am new with postgresql.

When I attempt to restore database a .sql.gz file into the database with psql, the restore does not complete when the database size is too large (32Gb, for example).

These reason again I restore empty tables.
How can I resolve this issue?

psql -U postgres -d dbname -f <filename>

Best Answer

It may not be the data size, but rather the number of tables and schemas. Database dumps and restores are known to run into problems in those cases.

For large backups the preferred backup approach is to use pg_basebackup which creates a snapshot of the database files at a specific time. These are restored much faster. Unfortunately this does not necessarily work for certain sorts of things, like restoring across major versions (but see pg_upgrade).

the raw data size is not a problem. But in your case, pg_dump may not be very useful and you may want to look at other ways of making a backup.