When you are specifying compression on pg_dump, is the compression happening on the server side so that the transfer is quicker or is the pg_dump doing the compression?
Thank you
The compression with -Fc
(custom format) dumps is done client-side. Per the documentation:
This format is also compressed by default
There is no protocol compression done between client and server.
PostgreSQL protocol compression would be very nice to have, but hasn't yet been implemented.
You can run pg_dump
server-side and stream its compressed dump over something like ssh to the client if you wish, though.
Following command may reduce the backup size.
$pg_dump -i -U dbuser -F c -v --schema=testschema -f outputpath/outputfile.tar "mydb"
then, compress the output file using gunzip tool
$gzip outputpath/outputfile.tar
-Ft
(tar) and -Fc
(custom) formats. See how the uncompressed tar is much bigger? You might gain a little bit more by gzipping a custom-format dump because it only compresses the data sections, not the catalog, but it'll be a small gain. If you gzip the tar format dump you'll see it shrink to something similar to the custom format size. Because, like the documentation says, the custom format is already compressed.
Sep 30, 2015 at 14:38