Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Antonin Houska
Subject Re: Adding REPACK [concurrently]
Date
Msg-id 12105.1774261203@localhost
Whole thread Raw
In response to Re: Adding REPACK [concurrently]  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

> On 2026-Mar-19, Antonin Houska wrote:
>
> > Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> >
> > > So here's v43.  Here, I've changed the CONCURRENTLY implementation to go
> > > through table AM.  This necessitated changing it to use tuples in slots
> > > instead of HeapTuple.  This is good because we can avoid repeated tuple
> > > form/deform, which could get pretty expensive.  Antonin's 0004 patch
> > > here looks suspicious here though, because it deforms the tuple and
> > > forms it again, which sounds unnecessary now.
> >
> > I suppose you mean
> > v42-0004-Serialize-decoded-tuples-without-flattening.patch. This deforms the
> > tuple to get the external attributes and to write them to file. The tuple the
> > logical worker received from reorderbuffer.c cannot be passed to the backend
> > executing REPACK because it may contain "external indirect" attributes,
> > i.e. pointers to the worker's memory.
>
> No, that patch has been absorbed in what is now v43-0003.  I meant
> v43-0004 "Use BulkInsertState when copying data to the new heap.",
> that's why I said "patch 0004 here".  In this patch, we have
> reform_tuple which deforms the tuple, sets to NULL any attribute that's
> marked dropped, and then forms a new one.  This is wasteful and should
> probably be done elsewhere, while the tuple is still in slot
> representation.  In fact, I suspect it may not be necessary at all
> anymore.

The idea to "reform" the tuple comes from VACUUM FULL / CLUSTER. I agree the
"deform" and "form" steps are no longer needed when we use tuple slots.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com



pgsql-hackers by date:

Previous
From: Jelte Fennema-Nio
Date:
Subject: Re: Make copyObject work in C++
Next
From: Soumya S Murali
Date:
Subject: Re: Fix bug with accessing to temporary tables of other sessions