agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Antonin Houska <ah@cybertec.at>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Cc: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Robert Treat <rob@xzilla.net>
Subject: Re: Adding REPACK [concurrently]
Date: Wed, 25 Mar 2026 10:00:49 +0100
Message-ID: <23099.1774429249@localhost> (raw)
In-Reply-To: <202603242222.5i7awkn7jpdr@alvherre.pgsql>
References: <202603242222.5i7awkn7jpdr@alvherre.pgsql>
Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> - 0008 to 0010 are as posted by Antonin; they are unchanged, except for
> fixes for the problems pointed out by Mihail. Antonin, I would
> appreciate it if you want to change the "reform" bit in 0007 as
> discussed.
I've taken a look, but not sure if the tuple slots help here. In
heapam_relation_copy_for_cluster(), both table_scan_getnextslot() and
index_getnext_slot() call ExecStoreBufferHeapTuple() ->
tts_buffer_heap_store_tuple(), which AFAICS do not deform the tuple. Then
ExecFetchSlotHeapTuple() is used to retrieve the tuple, but again, the
underlying slot (TTSOpsBufferHeapTuple) handles it by copying rather than
deforming / forming. Thus I think the explicit "reforming" currently does not
add any performance overhead.
Of course, we can still use the slots, and do the following: 1) enforce tuple
deforming (by calling slot_getallattrs()), 2) set the dropped attributes to
NULL, 3) use ExecStoreVirtualTuple() to store the tuple into another slot and
4) get the heap tuple from the other slot. Should I do that? I'm asking
because I wasn't sure if you're concerned about performance or coding (or
both).
Whatever approach we take, I see two more opportunities for better
performance:
1. Do the "reforming" only if there are some dropped columns. (AFAICS even the
old CLUSTER / VACUUM FULL did not check this.)
2. Get rid of the values of dropped columns earlier, so that the dropped
values are not put into the tuplestore (likewise, I think that CLUSTER /
VACUUM FULL did not care.)
Besides that, I think that heap_form_tuple() should set the values of dropped
columns to NULL by default, or do I miss something? Anyway, this should be
addressed by a separate patch.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
view thread (416+ messages) latest in thread
Message-ID: <23099.1774429249@localhost>
Permalink: ../23099.1774429249@localhost/
Also on: postgresql.org/message-id/23099.1774429249@localhost
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ah@cybertec.at, alvherre@alvh.no-ip.org, mihailnikalayeu@gmail.com, srinath2133@gmail.com, boekewurm+postgres@gmail.com, pgsql-hackers@lists.postgresql.org, rob@xzilla.net
Subject: Re: Adding REPACK [concurrently]
In-Reply-To: <23099.1774429249@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox