Re: Pruning never visible changes

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pruning never visible changes
Date: 2022-09-22 14:15:50
Message-ID: 20220922141550.dfuf5ab2mjjyky2q@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022-Sep-22, Simon Riggs wrote:

> On Mon, 19 Sept 2022 at 00:16, Greg Stark <stark(at)mit(dot)edu> wrote:

> > VACUUM was willing to remove a committed-dead tuple immediately if it was
> > deleted by the same transaction that inserted it. The idea is that such a
> > tuple could never have been visible to any other transaction, so we don't
> > need to keep it around to satisfy MVCC snapshots. However, there was
> > already an exception for tuples that are part of an update chain, and this
> > exception created a problem: we might remove TOAST tuples (which are never
> > part of an update chain) while their parent tuple stayed around (if it was
> > part of an update chain). This didn't pose a problem for most things,
> > since the parent tuple is indeed dead: no snapshot will ever consider it
> > visible. But MVCC-safe CLUSTER had a problem, since it will try to copy
> > RECENTLY_DEAD tuples to the new table. It then has to copy their TOAST
> > data too, and would fail if VACUUM had already removed the toast tuples.

> Good research Greg, thank you. Only took 10 years for me to notice it
> was gone ;-)

But this begs the question: is the proposed change safe, given that
ancient consideration? I don't think TOAST issues have been mentioned
in this thread so far, so I wonder if there is a test case that verifies
that this problem doesn't occur for some reason.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-09-22 14:37:58 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message torikoshia 2022-09-22 14:12:16 Re: RFC: Logging plan of the running query