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 1w5K6h-0038Fs-2L for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 09:00:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5K6g-00DGvO-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 09:00:54 +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 1w5K6f-00DGvG-39 for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 09:00:54 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5K6d-000000012Nt-2asa for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 09:00:54 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-48702d51cd0so48858185e9.2 for ; Wed, 25 Mar 2026 02:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774429251; x=1775034051; darn=lists.postgresql.org; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SGtPCPXgosKjPhaKilke6J5FGYjPrKeuWhRnG6sKDqY=; b=Uv2KI3PdoYV5bKnazsCSyzbOliZmjmClkGRbkRiCsnP34qGb7z9unQ31oJJXjwOKb7 P8m7Zvr0uFTIQ6/yWESvMpc+u22SUV4o0NFH+la3BwvBuRkR8rxX2ibKs6Ejbx2QVu+Z FiJmYb5LtAZ6VgeKHlD1hRlnr+cmNOc4X4DVDNxg0I4Yrf13DO7cTh0c8xqLiTrU1R7L alldRyHAYt7H9TpKUexRelnoTUYjzcPB4CDSKi9x/vDAGj/NoAMIDbrAiemjKw3gAA7T HXjwxR7SQy+WI3EcVZgK3LGNwFbD9nNoWF8+bJjnvSqsanmQQ9WzYFuGqWB6MB7tgefi MHXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774429251; x=1775034051; h=message-id:date: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=SGtPCPXgosKjPhaKilke6J5FGYjPrKeuWhRnG6sKDqY=; b=kTNWjf9WljwqKXQhWg9CLfnGRiqpn86A3tf7JiGT06ov5pFkHUntus6sA8UQIw7enz GcgMM5rGgXUEr204+RBlR+Ece0gUD0+KHgFImQRonoUg0UMRDHV8eaeCcV4QxrKdLRWv QYRzuBv83+vkHmDSdcglVnvDiavx83oiO1wUBSwJDuYcEBZS9eUwB/L1Cps3FQu0RnQG BhDr0IwPyQ+VTjDe5wYFKFXNw5q0sapruRX59SsBX4eQoR0E8UlzPAVq0yVsUeD09jds tYP3kbFTr5LyRCM5CTMjad3CH/vykZMbCwied+uUYQtn4+B5+7MyyKH2seCF8jND/FT3 slMw== X-Forwarded-Encrypted: i=1; AJvYcCXIXIgvSPQ8ArNQmREf8tE9sMvGchzjEkeD/ChzsfHJWlBxRmYbuIdZ7j3iN5ot5Zu2Ps+0f4w6n6LXCdiU@lists.postgresql.org X-Gm-Message-State: AOJu0YxbpCqS8n3RAXVacNOuA66zOk0jN31u52r9WmBPfIJFZqlVeLMv lZU0XZwkhhmOCmgKX34AJYU8NeoX71fbiCiEktK9QF2akW9XW7K5a3oHtunt0gbo2QY= X-Gm-Gg: ATEYQzw0Y5EouPpUJHf1BAXNEl1Ts/7xI9y/JrwJ0UWKiW6AFnG5h2tjMI+S1SNVnoL 61nWRjgw08w12S3dnvtOb9p2jZX6RB+izKeb1eSKwV4sByyUkhB6DVotP4/jbpg976n+jgebAKu rCqzhm+eMInazkWjSlBc5bWd8BognZMjMhM0ig55QBv7smkMdb3TslBDT0mwD3+wHFzOK4QuKeL BhlhWkN/oruTQHQD/n4Pym+fVURMJpIu/JuDIY1aHUu/MxxxTXGdRT0IOru95OEV7CoIOkFuUCN Z8CdOYmDSrC8F4O/j0wHNOwfblD8p58ruBfVnG//FQ25E6LEQ+qLMa8yCBGlIpJfXfhbHjrM2Is R9qJiaC2W85BUQvIgwyd9xisNr6R+nyMJMFhjXukBF2Gcg43c6JPCCzqZ/DOAqYV94cNsOjXfP4 uNjhH9VXz055OGZ4w5sCdT2V6pcQX7+cMCE4WO X-Received: by 2002:a05:600c:3acf:b0:486:fdba:f5db with SMTP id 5b1f17b1804b1-48715f02369mr41858085e9.0.1774429250749; Wed, 25 Mar 2026 02:00:50 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487116939b8sm177027845e9.3.2026.03.25.02.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 02:00:50 -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: <202603242222.5i7awkn7jpdr@alvherre.pgsql> References: <202603242222.5i7awkn7jpdr@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 24 Mar 2026 23:32:17 +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: <23097.1774429249.1@localhost> Date: Wed, 25 Mar 2026 10:00:49 +0100 Message-ID: <23099.1774429249@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera 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