This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing few options of pg_dump for taking the compressed backup in PostgreSQL.
When your database size is increasing, you should demand compressed backup for saving the disk space and time both.
Few OSs also not supported the big size of the single file so we have to split the backup file into different files or we can go with compressed options.
PostgreSQL supports zlib compression. We can use -Fc option in pg_dump for taking a compressed backup, and it also has an advantage like we can restore table selectively.
Syntax:
1 |
pg_dump -Fc dbname > filename |
Use pg_restore for restoring the database:
1 |
pg_restore -d dbname filename |
We can also use gzip option for compression:
1 |
pg_dump dbname | gzip > filename.gz |
Leave a Reply