Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5RTb-003FrH-2I for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 16:53:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5RTY-00FIRH-3D for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 16:53:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5RTY-00FIR9-27 for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 16:53:01 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5RTW-000000016Mx-0AQl for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 16:53:00 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso684145e9.1 for ; Wed, 25 Mar 2026 09:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774457577; x=1775062377; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=/MkxYA8zC6sb9WVhKG1g0x1hMWblv4VkazmMCsgLm2k=; b=HMSCqjZrTzYh1RyqGjcK4is1yL15pfLncY6mQbyOQmxsdjoI/7KlkZVXLNXjEUTerQ ryqPZFgq96q2MUEHtbx1z5UHaYmpB+wnlZDnLt1Z8RalzlMJewxBlgWFVlYfAbsjUbX3 gEJmBS+qGwye3Nqtbqi1GOSs0Ytv2lZ6X7z4fB9KrYiW7rFtjOWiS8VFL+Xw+4/Ho9Of BuZeHUEZ1o0iwN2d5B7L/p52msImDYKtH8jhcB2Tx5bArwlH2AiTXSiDi6CiDH35MIRD B3wUhMfdmTn0TCkiLvB2fl4YQ1SvkzU3jLhJIweS0kYC+BZbDnCH+u/w3SzwKdWC84N/ OCzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774457577; x=1775062377; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/MkxYA8zC6sb9WVhKG1g0x1hMWblv4VkazmMCsgLm2k=; b=rWJvA90phYlcm9CVQPF4YuKnamQjNCGEeEfvx6iW6UraM3hrSsZU8VchpfDO/0w0PF HldzMJjAMP2hY1dZ/AM02yto3lfCmMgLNQEFKFOcCRi6S2JipoFfWpAbOnVvaPewZyBr pVzXuIPCTnqETtfVJlhXLt8UcCNHr6r93ENoSTJP/8amnM6XeHMErkR7t0eMdXPnTma6 EyU8qtCo8fUC0YCVfKu0brFWxdvztOxNvMx7AzQGwNeOhrwjbB5mst33pjZZMqayMrXa IUWRX8CXZj2PjgCUdSH2CBrN62TEnuDuPtIGQA6HJMaH5rYeLlORjjYt04J/Cp+c5KTG Ps1A== X-Forwarded-Encrypted: i=1; AJvYcCW6XK6stcYK/bsm1MORWD/dhaaXfco84+iTEun6tgK9zfUZLPG3fcAoltLWbR2JHfRyKnPRrVr1Y/v5NUIG@lists.postgresql.org X-Gm-Message-State: AOJu0YwLKWbwcDkUg8k1GQPQLlLNjuAAnKt7huoKKOQJzebwagd5/35h 1EVNRSO9uWU69lv3Co/ovkqvQxBaQVrDD+MU+tiFnobmlSz+EvB9lvVlZVbLUC0ga2w= X-Gm-Gg: ATEYQzz2fs4mQOwSqTjStbn5iRu4C+dVbJKp85kCkTeL2pRBQ8qWK2+ZncKMnZcuA5B kA/fSucQI2c8D75vf1qq6LBOlOqZw25b9hjMjFDZPshqlFKUwHjIOTyKqhhHBpGaO4J0C7KoTrE 6InSG7gZX1oSMyDAfN2kMuTeeigY1N868S1hYn90WbAdH4+NYawYyM/fQSu2MrxB6FSUcxwWqp9 2I+bU/KpvHWp9q8foEhiZDe74M7gOCfLxo5xReHG2oLRhYftuW36Rpwkg7F9EoXIgrse4QOGDba R4a1sHMOhvHKsLz/4RGPbtS5lI7YgFi2BSvz2N2S8wna0PRQESXb4siVSwxpso2cLa3Y9+GIppe K+9ThpEyFC2U+nxNe+yw/csi7DU9fg5vw2FOLVM4v1yVWVtle26LxdZStr522O6tJmZ9EQmEsWo 1dcfNdkT44+IS8HN0hsrf4wW3SehA1FsqEl4K51TLDik7JfHE= X-Received: by 2002:a05:600c:8489:b0:485:4453:401d with SMTP id 5b1f17b1804b1-48715fc38b4mr61738505e9.2.1774457577361; Wed, 25 Mar 2026 09:52:57 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487173955a8sm23986105e9.32.2026.03.25.09.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 09:52:57 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera Cc: Mihail Nikalayeu , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: <23099.1774429249@localhost> References: <202603242222.5i7awkn7jpdr@alvherre.pgsql> <23099.1774429249@localhost> Comments: In-reply-to Antonin Houska message dated "Wed, 25 Mar 2026 10:00:49 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <50824.1774457576.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Wed, 25 Mar 2026 17:52:56 +0100 Message-ID: <50825.1774457576@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Antonin Houska wrote: > Alvaro Herrera wrote: > = > > - 0008 to 0010 are as posted by Antonin; they are unchanged, except fo= r > > 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. The= n > ExecFetchSlotHeapTuple() is used to retrieve the tuple, but again, the > underlying slot (TTSOpsBufferHeapTuple) handles it by copying rather tha= n > deforming / forming. Thus I think the explicit "reforming" currently doe= s not > add any performance overhead. Well, the deform / form steps do add some overhead of course, but these ar= e necessary to get rid of the values of the dropped columns. I wanted to say that it wouldn't be cheaper with slots, because then we'd have to enforce = the deform / form steps too, although the coding would be different: > 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 slo= t 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 (o= r > 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 ev= en the > old CLUSTER / VACUUM FULL did not check this.) I think this would need more work because CLUSTER / VACCUM FULL / REPACK d= o not remove the dropped attributes from the tuple descriptor. So the optimization would only work until the first column is dropped. All the following runs would then do the reforming even if no other colmns were dr= oped since the previous run. Perhaps we can teach REPACK to remove dropped columns from the tuple descriptor in the future. -- = Antonin Houska Web: https://www.cybertec-postgresql.com