Default compression level for custom format in pg_dump ?

From: Grzegorz Szpetkowski <gszpetkowski(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Default compression level for custom format in pg_dump ?
Date: 2011-04-18 00:26:02
Message-ID: BANLkTinp-OFn_d_j9e+T1TuRnFqcGargXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hi,

I can't find in documentation what is implicit default compression
level for pg_dump format. There
(http://www.postgresql.org/docs/9.0/static/app-pgdump.html) is only:

"This format is also compressed by default."

"For the custom archive format, this specifies compression of
individual table-data segments, and the default is to compress at a
moderate level."

After some some reaserching I found it actually depends on zlib
library behaviour. In other words pg_dump is "zlib aware" and actually
it is 6 and it's constant value:

pg_dump someDB -Fc -f dump
pg_dump someDB -Fc -Z-1 dump (I know that -1 is not "legal", but it works)
pg_dump someDB -Fc -Z6 -f dump

In pg_dump.c there is (main function):

int compressLevel = -1;
...
else if (pg_strcasecmp(format, "c") == 0 || pg_strcasecmp(format,
"custom") == 0)
g_fout = CreateArchive(filename, archCustom, compressLevel, archModeWrite);

Then "it goes to" zlib library. According to http://www.zlib.net/manual.html:

"The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and
9: 1 gives best speed, 9 gives best compression, 0 gives no
compression at all (the input data is simply copied a block at a
time). Z_DEFAULT_COMPRESSION requests a default compromise between
speed and compression (currently equivalent to level 6)."

#define Z_DEFAULT_COMPRESSION (-1) (zlib.h)

What do you think about adding some clarification in PostgreSQL doc ?

Regads,
Grzegorz Szpetkowski

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Alvaro Herrera 2011-04-18 16:46:06 Re: Default compression level for custom format in pg_dump ?
Previous Message Josh Kupershmidt 2011-04-17 15:22:32 Re: [DOCS] 9.0.3 pdf manual is missing bookmarks