Re: online debloatification (was: extending relations more efficiently) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: online debloatification (was: extending relations more efficiently)
Date
Msg-id 18056.1335991144@sss.pgh.pa.us
Whole thread Raw
In response to Re: online debloatification (was: extending relations more efficiently)  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: online debloatification (was: extending relations more efficiently)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Brainstorming wildly, how about something like this:

> 1. Insert a new copy of the tuple onto some other heap page.  The new
> tuple's xmin will be that of the process doing the tuple move, and
> we'll also set a flag indicating that a move is in progress.
> 2. Set a flag on the old tuple, indicating that a tuple move is in
> progress.  Set its TID to the new location of the tuple.  Set xmax to
> the tuple mover's XID.  Optionally, truncate away the old tuple data,
> leaving just the tuple header.
> 3. Scan all indexes and replace any references to the old tuple's TID
> with references to the new tuple's TID.
> 4. Commit.

What happens when you crash partway through that?  Also, what happens if
somebody wishes to update the tuple before the last step is complete?

In any case, this doesn't address the fundamental problem with unlocked
tuple movement, which is that you can't just arbitrarily change a
tuple's TID when there might be other operations relying on the TID
to hold still.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Daniel Farina
Date:
Subject: Modeling consumed shmem sizes, and some thorns
Next
From: Robert Haas
Date:
Subject: Re: online debloatification (was: extending relations more efficiently)