This project aims to reduce the size of archive log files by replacing backup blocks (full page writes) marked as "removable" (introduced in 8.3) with corresponding incremental logs.
The Full Page Write Improvementproject is a PostgreSQL Community project that is a part of the pgFoundry. It is produced by NTT OSS Center.
The pgFoundry page for the project is at http://pgfoundry.org/projects/pglesslog, where you can find downloads, documentation, bug reports, mailing lists, and a whole lot more.
Lesslog is a set of tools to reduce the size of PostgreSQL archive log. Lesslog consists of the following programs.
This command restores page headers and add dummy data to make up for physical log record, finally restores LSN of each log record and restores the page size to be used in the archive recovery. This command should be specified as restore_command in recovery.conf. Size of the file will be the same as original WAL segment files before archived. "NOOP" WAL record will be used for the filler, which will be neglected by redo functions at the recovery.
Pglesslog works with PostgreSQL 8.3.x. It uses "removable" flag in WAL records intruduced in PostgreSQL 8.3.
full_page_writes = on
archive_command = 'pg_compresslog "%p" /"%f"'
pg_compresslog [from [to]]
pg_compresslog removes physical log from the WAL segment file specified by
< from > and archives as < to > file name.
if < from > is omitted or specfied as "-", WAL segment file is read from
stdin.
If < to > is omitted or specified as "-", archive file will be written to
stdout.
Full page writes replaced with corresponding incremental logs by
pg_compresslog are those written while online backup is not running.
To use the output of pg_compresslog command in archive recovery, it must be
restored using pg_decompresslog command.
pg_compresslog returns zero if no error occurs, 1 if error occurs.
pg_decompresslog [from [to]]
pg_decompresslog reads archive log file specified by < from > argument and
restores an area corresponds to the removed physical log, which restores
LSN of each log record, and writes them to the file specified by < to >
argument.
If < from > is omitted or specified as "-", it reads from stdin. If < to > is
omitted of specified as "-", it writes to stdout.
Full page writes replaced with corresponding incremental logs by
pg_compresslog are those written while online backup is not running.
You can specifiy the file written by pg_compresslog as < from > argument.
It returns zero if no error occurs, 1 if error occurs.
Lesslog 1.1 can generate incremental log for HEAP2_CLEAN WAL records, which are created by vacuum and prune (HOT). Because full page writes of this WAL records occupies major part of WAL segments, replacing this with incremental log dramatically reduces the size of WAL when archiving.
I appreciate Pavan Deolasee and Heikki Linnakangas for their stimulating comments and advise. Without their advises, the solution would have been much more complicated.