Nov
18
PostgreSQL dump and restore with PostGIS data
Our initial data load from production to test wasn’t complete, and we figured out that we got correct results using a custom format for pg_dump. We don’t have to DEFINE the custom format, just use it. On the other end, you need to use pg_restore to bring that custom format dump into a database.
To dump:
pg_dump -Fc dbname > dbname.dmp
To restore:
pg_restore -Fc -d dbname dbname.dmp
One benefit of the custom format is that it is compressed during the dump; there’s no need for an additional gzip (dump) and zcat (restore) to be run. The compression is about the same as with gzip.