Re: Pruning never visible changes - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Pruning never visible changes
Date
Msg-id 20220922141550.dfuf5ab2mjjyky2q@alvherre.pgsql
Whole thread Raw
In response to Re: Pruning never visible changes  (Simon Riggs <simon.riggs@enterprisedb.com>)
Responses Re: Pruning never visible changes
List pgsql-hackers
On 2022-Sep-22, Simon Riggs wrote:

> On Mon, 19 Sept 2022 at 00:16, Greg Stark <stark@mit.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/



pgsql-hackers by date:

Previous
From: torikoshia
Date:
Subject: Re: RFC: Logging plan of the running query
Next
From: John Naylor
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum