Re: [PING] fallocate() causes btrfs to never compress postgresql files - Mailing list pgsql-hackers

From Dimitrios Apostolou
Subject Re: [PING] fallocate() causes btrfs to never compress postgresql files
Date
Msg-id 4e46b377-cae1-09a8-49fa-634cfeb8bd20@gmx.net
Whole thread Raw
In response to Re: [PING] fallocate() causes btrfs to never compress postgresql files  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
On Mon, 9 Jun 2025, Thomas Munro wrote:

> On Tue, Jun 3, 2025 at 1:58 AM Dimitrios Apostolou <jimis@gmx.net> wrote:
>> This sounds like the best solution IMO. People can then experiment with
>> different settings and filesystems, and that way we also learn in the
>> process. Thank you for the effort and patches so far.
>
> OK, here's a basic patch to experiment with.  You can set:
>
> file_extend_method = fallocate,ftruncate,write
> file_extend_method_threshold = 8 # (below 8 always write, 0 means never write)
>

I applied the patch on PostgreSQL v17 and am testing it now. I chose
ftruncate method and I see ftruncate in action using strace while doing
pg_restore of a big database. Nothing unexpected has happened so far. I
also verified that files are being compressed, obeying Btrfs's mount
option compress=zstd.

Thanks for the patch! What are the odds of commiting it to v17?

Dimitris


pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: Non-reproducible AIO failure
Next
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: Improve tab completion for various SET/RESET forms