Re: reloption to prevent VACUUM from truncating empty pages at the end of relation

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reloption to prevent VACUUM from truncating empty pages at the end of relation
Date: 2018-11-15 05:48:00
Message-ID: 8dee96bc848db93ae5a4750eae47bf949f0e654d.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2018-04-17 at 15:09 -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > Andres was working on a radix tree structure to fix this problem, but
> > that seems to be abandoned now, and it seems a major undertaking. While
> > I agree that the proposed solution is a wart, it seems much better than
> > no solution at all. Can we consider Fujii's proposal as a temporary
> > measure until we fix shared buffers? I'm +1 on it myself.
>
> Once we've introduced a user-visible reloption it's going to be
> practically impossible to get rid of it, so I'm -1. I'd much rather
> see somebody put some effort into the radix-tree idea than introduce
> a kluge that we'll be stuck with, and that doesn't even provide a
> good user experience. Disabling vacuum truncation is *not* something
> that I think we should recommend.

This new option would not only mitigate the long shared_buffers scan,
it would also get rid of the replication conflict caused by the
AccessExclusiveLock taken during truncation, which is discussed in
https://www.postgresql.org/message-id/c9374921e50a5e8fb1ecf04eb8c6ebc3%40postgrespro.ru
and seems to be a more difficult problem than anticipated.

Could that tip the scales in favor of this stop-gap?

FWIW, I have always considered heap truncation on VACUUM to be something
strange anyway. VACUUM does not get rid of empty pages in the middle of
a relation, so why is it so important to do it at the end of the relation?
If the answer is "just because we can do it easily", then I think it would be
ok to disable the feature in cases where it causes problems.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2018-11-15 05:49:27 Re: doc fix for pg_stat_activity.backend_type
Previous Message Michael Paquier 2018-11-15 05:38:30 Re: ATTACH/DETACH PARTITION CONCURRENTLY