Sobes.tech
Junior — Middle

Which command parameter in pg_dump can be used to enable compression of the created backup?

sobes.tech AI

Answer from AI

To enable compression of the created backup in pg_dump, the -Z or --compress parameter is used. It accepts a value from 0 to 9, where 0 means no compression and 9 means maximum compression.

Example usage:

pg_dump -Fc -Z 9 -f backup.dump mydatabase

Here, -Fc specifies the dump format (custom), which supports compression, and -Z 9 sets the maximum compression level.