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 1vutZO-00Bkpt-20 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 14:39:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vutZM-001LmY-1n for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 14:39:24 +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 1vutZL-001LmQ-1P for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 14:39:24 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vutZH-000000014Dj-1owy for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 14:39:23 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7DA927A00DC; Tue, 24 Feb 2026 09:39:17 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Tue, 24 Feb 2026 09:39:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1771943957; x=1772030357; bh=2RXgN1dyKA sVPpnuEA9tL1P4MuZmTRszlVZmHmr/rgM=; b=L5TJvA1WO37JqF1CJmawdko1jE F8nc6zhWQXqzuglMwO/HuWGIwTRpOZXuNNaozWOgvtHZah/3LeXi5wDuZoLIrkFC lZx9G5rsdwpjXDGJE7p6IrlFNk0rmLhOmrMmyqERtKPIThsSi8xCpqnWiYW8YdhA TuRLDCd84suoKvVReMFOAwF3YJepekFE+4jxuudHz3Pr/MQA12TKv6LxgSjLUz1e 3VFTNEv+RRiedJBmJ5pzx/bEeHHgofjkOMwUQOWj/Awp2TNfVsWLWSZKY4n1UEL/ Z0bixI+ebX9XUjNLJcsrgIZmpqyZhvK8dPP0vJ8YQjo/IB3LEmZCuQutGO7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1771943957; x=1772030357; bh=2RXgN1dyKAsVPpnuEA9tL1P4MuZmTRszlVZ mHmr/rgM=; b=b0jadAmoeJIVuvxg6UxRoAP0OdmOo4lIGPczF8he6AoMuqxtNBl Zw1AawxmUxibifS/GwY7GCbZrhlhh1P3x+h4G450sTQOo8XQrYNTdAryPzcOcFiA cml44Gjeq/DdsNDLrR3c+HMpKpWDEX3N8mY060CUU3Sv8HO2wFeuhteWF5soP2zn xRXUdDriB18bZY21DyHgW7CQX8sgu5mrg8TlXC3LOK1LdoQG93+Ft0uHfx/2ismB R62UrFEgrsVWBBjBP+ECy4Ka23FDjESmY2OeWAJLj/Duk6M0JvopILyW6pO4LKAt tJYI78reVcRpamq9+CqRb0bXMV4B3CjKsOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedtgedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehttdfstd dttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgr rhgriigvlhdruggvqeenucggtffrrghtthgvrhhnpeeffffgledvffegtdevlefgtdeggf fhvdekgfegteeiveejkeetudelveejhfeugeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgdpnh gspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepughgrhho fihlvgihmhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepjhhohhhntghnrgihlhhorh hlshesghhmrghilhdrtghomhdprhgtphhtthhopehlihdrvghvrghnrdgthhgrohesghhm rghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrd hpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 09:39:17 -0500 (EST) Date: Tue, 24 Feb 2026 09:39:16 -0500 From: Andres Freund To: David Rowley Cc: John Naylor , Chao Li , PostgreSQL Developers Subject: Re: More speedups for tuple deformation Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-02-24 15:23:17 +1300, David Rowley wrote: > The changes in 0004 and 0005 are new. 0004 makes calling > slot_getmissingattrs() the responsibility of the > TupleTableSlotOps.getsomeattrs() function. Doing this allows > getsomeattrs() to be called with the sibling call optimisation in > slot_getsomeattrs_int() and since slot_getsomeattrs_int() is such a > trivial function now, I ended up just modifying slot_getsomeattrs() to > call getsomeattrs() in a way that allows the compiler to apply the > sibling call optimisation. This seems to help reduce some overheads > and makes the 0 extra column tests look better. ISTM we should just merge 0004. In my testing it's a very clear win, without, afaict, any downsides. > 0005 reduces the size of CompactAttribute. It shrinks the struct down > to 8 bytes from 16 by using some bitflags for some lesser-used > booleans and by shrinking attcacheoff down to int16. The idea is that > we just don't cache any offsets larger than 2^15. It's likely if we > get a tuple that big that there's a variable-length attribute anyway, > which caching the offset of isn't possible. > > I'm not getting great results from benchmarking the 0005 patch. I > verified that gcc does access the array without calculating the > element address from scratch each time and calculates it once, then > increments the pointer by sizeof(CompactAttribute). See the attached > .csv for the results on the 3 machines I tested on. FWIW, where I had seen that be rather beneficial is the TupleDescCompactAttr() at the start of the various loops, where the compiler has little choice to compute the address of the tupdesc->compact_attrs[firstNeededCol]. That matters only when only deforming a small number of columns, of course. > I've also resequenced the patches to make the deform_bench test module > part of the 0001 patch. This makes it easier to test the performance > of master. What are your thoughts about merging the deform_bench tooling? I wonder if we should have src/test/modules/benchmark_tools or such, so we can add a few more micro-benchmarky tools over time? Greetings, Andres Freund