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 1w2Aj5-0003Ru-0K for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 16:23:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2Aj2-00BBZY-06 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 16:23:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2Aj1-00BBZQ-0w for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 16:23:28 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2Aiy-000000002QU-2n0k for pgsql-hackers@postgresql.org; Mon, 16 Mar 2026 16:23:27 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 68FD31D0013D; Mon, 16 Mar 2026 12:23:25 -0400 (EDT) Received: from phl-imap-14 ([10.202.2.87]) by phl-compute-02.internal (MEProxy); Mon, 16 Mar 2026 12:23:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-transfer-encoding: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=fm1; t=1773678205; x=1773764605; bh=j4iodGz3wG3nB6FuswQIDIJP3pDSSt02ibGloN258JM=; b= jrVNagBEsviyTtwZueKS6Gq0TKH+jKJsNBc6M7clOB2slzkI5OyKofoIYVwo3o2E 4aN/Kdvp4mH+/8ImyB+WTekmcmIOZOg4jQhBIgvliRUU8FxeZBBh82p1Z4tu/V3N HJ3h+eo+YMu2TpeTCsbJt6y8/UMwNWFVzxwI4Cx+EAVRvMlxNIQ80d9ZPJE5UUEv qwOjj+zh0EV429WUKm2CJKisgtHh7OLAksIYhAyFYU8+onR+5EPzm/fGntJZiwDN QSZ0olN07ugDdVMEBSMFDM/LmXbaH2Cbz9g1hp73T6MhCmCo8yvzaFkqacn/udQW kD9nJterqncxnulefaKgXA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm1; t=1773678205; x= 1773764605; bh=j4iodGz3wG3nB6FuswQIDIJP3pDSSt02ibGloN258JM=; b=q +Z717sOubExrKbjWqBd9sM+c7sSdPcr1l0EO9jtTjyAHPYzdif6xekynau515W21 /iFPZpXxnn9a4AND1Y1Fo9difgO4prNq6g9fyKST0don6+1pvGzdyVre0NALtliY mRlr0n7u2JifEi6elyr69HZbdg/cBomR4qgEX3o+FRz7HmxxF0qhPOLFYPPOFiAj AJdV8rPktHaCDX82sNUh+4tlR5LhEsfiPXYutIIvBzy21V7Yo5WscaBsq3vl4pUj rM2Ex39u1s5fERC40Xq0ynETvASly1Tzpb7I+eiY9UIi6eYNNYi9u4NstCb1GuaM LvXwRGOZaHjng/vhylQNw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvleekkeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfifhrvghg uceuuhhrugdfuceoghhrvghgsegsuhhrugdrmhgvqeenucggtffrrghtthgvrhhnpedvue fhffdtvdevueffteehheefleevtedvfedtueefffeijeefudelveeftdffudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvghessghurh gurdhmvgdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepnhgrthhhrghnuggsohhsshgrrhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepph hgshhqlhesjhdquggrvhhishdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgv rhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id B779DC4006E; Mon, 16 Mar 2026 12:23:24 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: A1gxZgRQNkgk Date: Mon, 16 Mar 2026 12:23:04 -0400 From: "Greg Burd" To: "Jeff Davis" , "Nathan Bossart" Cc: pgsql-hackers Message-Id: In-Reply-To: <811d6f42e5481935943556b692859aae9146d4c9.camel@j-davis.com> References: <9bb9bdd6-e1fe-48fe-837d-4d0289396f1c@app.fastmail.com> <872b875c-0aa4-4269-9c84-532227b32361@app.fastmail.com> <91f4dbe2-21ed-49f3-bebe-270f9bbec9d5@app.fastmail.com> <811d6f42e5481935943556b692859aae9146d4c9.camel@j-davis.com> Subject: Re: Expanding HOT updates for expression and partial indexes Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Mar 15, 2026, at 5:11 PM, Jeff Davis wrote: > On Thu, 2026-03-12 at 17:31 -0400, Greg Burd wrote: >> Other than the heap_modify_tuple() calls I don't know of something >> that allows for direct changes but that doesn't matter, 0002 will >> scan and pick up those attributes even if we introduce a new >> modification path in the future (as intended). Hello Jeff, thanks for taking a look! :) > Why do extra work in ExecBRUpdateTriggers() to eliminate the false > negative case if we don't rely on it anyway? If we do need to rely on > it in subsequent patches, then we need to be sure, right? Later commits do currently rely on it, ExecUpdateModifiedIdxAttrs() uses it in the next commit (0003) to avoid reviewing indexed attributes that could not have possibly changed. Imagine a table with a lot of indexes where updates only modify one or two at a time. Why are we testing indexed attributes for changes in HeapDeterminColumnsInfo() that couldn't have changed? The answer is that a) HeapDeterminColumnsInfo() lives in heap, not the executor (see patch 0003) so it has no ability to call ExecGetAllUpdatedCols(), and b) the set returned by ExecGetAllUpdatedCols() is sometimes incomplete. I see (a) as something I fix in patch 0003 and (b) as an oversight (or bug). I'll also argue that the overhead of checking for additional attributes in ExecBRUpdateTriggers() vs the overhead of checking all indexed attributes in HeapDeterminColumnsInfo() is net zero once patch 0003 is applied. The argument to keep 0002 is both performance as much as correctness. After 0002 and 0003 ExecUpdateModifiedIdxAttrs() replaces HeapDeterminColumnsInfo() and doesn't have to scan all indexed attributes anymore. Relations with lots of indexed attributes but update patterns that only focus on subsets of those attributes will benefit as there will be fewer memcmp() calls when comparing datums. What do we "need to be sure" of? That ExecGetAllUpdatedCols() not really contains all attributes that its name implies? I think it now does that after 0002, do you disagree? > I guess I'm confused about whether 0002 is introducing a new guarantee > or if it's just a convenient place to eliminate one source of false > negatives. I think it is a new guarantee that was implied before now but not required until 0003. I think this change reduces overhead and helps to avoid some future security feature that depends on ExecGetAllUpdatedCols() to provide that guarantee. Does that make sense? > Regards, > Jeff Davis best. -greg