Re: [PING] fallocate() causes btrfs to never compress postgresql files

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Dimitrios Apostolou <jimis(at)gmx(dot)net>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Andres Freund <andres(at)anarazel(dot)de>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Subject: Re: [PING] fallocate() causes btrfs to never compress postgresql files
Date: 2025-05-31 14:00:17
Message-ID: CA+hUKGJeO8xF5JBiRwc5onCrmthkhoeY0RC538v5vLd7c4s_LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 30, 2025 at 3:58 AM Dimitrios Apostolou <jimis(at)gmx(dot)net> wrote:
> All I'm saying is that this is a regression for PostgreSQL users that keep
> tablespaces on compressed Btrfs. What could be done from postgres, is to
> provide a runtime setting for avoiding fallocate(), going instead through
> the old code path. Idelly this would be an option per tablespace, but even
> a global one is better than nothing.

Here's an initial sketch of such a setting. Better name, design,
words welcome. Would need a bit more work to cover temp tables too.
It's slightly tricky to get smgr to behave differently because of the
contents of a system catalogue! I couldn't think of a better way than
exposing it as a flag that the buffer manager layer has to know about
and compute earlier, but that also seems a bit strange, as fallocate
is a highly md.c specific concern. Hmm.

I suppose something like the 0001 part could be back-patched if this
is considered a serious enough problem without other workarounds, so I
did this in two steps. I wonder if there are good reasons to want to
change the number on other file systems. I suppose it at least allows
experimentation.

Attachment Content-Type Size
0001-Add-io_min_fallocate-setting.patch text/x-patch 5.2 KB
0002-Add-io_min_fallocate-tablespace-option.patch text/x-patch 15.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Davydov 2025-05-31 14:23:19 Re: Speedup truncations of temporary relation forks
Previous Message Fujii Masao 2025-05-31 12:41:36 Re: Speedup truncations of temporary relation forks