| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | Ken Marshall <ktm(at)rice(dot)edu>, Hannu Krosing <hannuk(at)google(dot)com> |
| Cc: | Andreas Karlsson <andreas(at)proxel(dot)se>, Christoph Berg <myon(at)debian(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Andres Freund <andres(at)anarazel(dot)de>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Japin Li <japinli(at)hotmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, John Naylor <johncnaylorls(at)gmail(dot)com> |
| Subject: | Re: WAL compression setting after PostgreSQL LZ4 default change |
| Date: | 2026-08-06 15:32:31 |
| Message-ID: | da2389df-05a0-4ba7-8284-4344d31b5882@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 8/6/26 16:50, Ken Marshall wrote:
> On Thu, Aug 06, 2026 at 04:31:44PM +0200, Hannu Krosing wrote:
>> On Thu, Aug 6, 2026 at 2:11 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
>>>
>>> The executive summary is that lz4/zstd perform about the same, but zstd
>>> has a clearly better compression ratio. I withdraw my initial plan to
>>> default to lz4, and I agree we should default to zstd. (By "default" I
>>> mean that "on" would use that algorithm, but the GUC would still default
>>> to 'off' as before. Maybe we should reconsinder that for PG20, though?)
>>
>> Do you have any ideas why recovery on Azure is 10-20% faster for lz4
>> (and surprisingly also pglz) than for zstd ?
>>
I don't, but I'll do a couple more runs with for these parameters
(zstd/3, lz4/1 and pglz), to see how stable the results are.
Might be interesting to run this on other cloud instances, but I don't
have access to those at the moment.
Could this be due to difference in decompression speed? I've seen
figures like 2GB/s for zstd vs. 4GB/s for lz4. We're we'd dealing with
~45GB of WAL, so that'd be 25 vs. 10 seconds, which is not far from the
~20s difference in recovery time. Then again, it only affects azure, so
there's some hw influence.
>> ---
>> Hannu
>
> Hi,
>
> I know that lz4 has much higher decompression speed but I have no idea
> why it would also be faster for pglz. Do they actually use it or call
> lz4 under the hood?
>
I don't understand what this means by "calling lz4 under the hood".
> My two cents is that since cloud CPU is much more expensive than cloud
> storage we should pick the option that minimizes it. In the application
> that I used, it was mostly to pull historic data so the key performance
> metric was rapid decompression speed. It was the difference between a
> sub-second screen draw and not. I would tend to lz4 even with the better
> compression ratio from zstd.
>
Even on the two azure systems, the tests still use local NVMe disks, not
the cloud storage. But I agree that with cloud storage, it's likely
better to prefer higher compression ratio, even if it costs a bit more
CPU (but the difference in CPU usage seem tiny).
FWIW this only affects recovery/replication, not interactive tasks.
regards
--
Tomas Vondra
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Korotkov | 2026-08-06 16:00:43 | JSON_TABLE: table => column ON ERROR propagation |
| Previous Message | Tomas Vondra | 2026-08-06 15:10:27 | Re: hashjoins vs. Bloom filters (yet again) |