Re: Different compression methods for FPI

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Different compression methods for FPI
Date: 2021-06-17 07:52:10
Message-ID: 05dc4b1a-aef3-f1c7-c407-e8b53e3fb70b@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17/06/2021 04:12, Michael Paquier wrote:
> On Wed, Jun 16, 2021 at 11:49:51AM +0300, Heikki Linnakangas wrote:
>> Hmm, do we currently compress each block in a WAL record separately, for
>> records that contain multiple full-page images? That could make a big
>> difference e.g. for GiST index build that WAL-logs 32 pages in each record.
>> If it helps the compression, we should probably start WAL-logging b-tree
>> index build in larger batches, too.
>
> Each block is compressed alone, see XLogCompressBackupBlock() in
> XLogRecordAssemble() where we loop through each block. Compressing a
> group of blocks would not be difficult (the refactoring may be
> trickier than it looks) but I am wondering how we should treat the
> case where we finish by not compressing a group of blocks as there is
> a safety fallback to not enforce a failure if a block cannot be
> compressed. Should we move back to the compression of individual
> blocks or just log all those pages uncompressed without their holes?

Just log all the pages uncompressed in that case. If you didn't save any
bytes by compressing the pages together, surely compressing them one by
one would be even worse.

> I really don't expect a group of blocks to not be compressed, just
> being a bit paranoid here about the fallback we'd better have.

Yeah, there will inevitably be some common bytes in the page and tuple
headers, if you compress multiple pages together. But I don't think the
fallback is that important anyway. Even in the worst case, the
compressed image of something uncompressible should not be much larger
than the original.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-06-17 07:53:36 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Previous Message Dilip Kumar 2021-06-17 07:44:46 Re: Decoding speculative insert with toast leaks memory