6

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

2 Answers 2

5

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.

-1

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

5
  • Er... no. pg_dump with -Fc does do compression. Sep 30, 2015 at 14:26
  • @Craig, -F is format and c refers custom format. postgresql.org/docs/9.3/static/app-pgdump.html
    – RBB
    Sep 30, 2015 at 14:28
  • Exactly. Note the documentation, which says "This format is also compressed by default". If you gzip it, you're gzipping already-gzipped data, which is quite pointless. Sep 30, 2015 at 14:29
  • That's right. but here, *.tar not reducing the size of the output (same as if I take *.backup) until we do gzip. Correct me if wrong.
    – RBB
    Sep 30, 2015 at 14:32
  • 1
    Compare sizes of a dump done with -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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .