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 1w0mih-002Coy-1e for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 20:33:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0mif-0001BW-3C for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 20:33:22 +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 1w0mif-0001BM-2K for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 20:33:22 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0mie-00000002M6S-0Hw7 for pgsql-hackers@postgresql.org; Thu, 12 Mar 2026 20:33:21 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-7d7412cfb9eso1391515a34.1 for ; Thu, 12 Mar 2026 13:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773347598; x=1773952398; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wwWbWAC69PL7EVDEZgUQkrVwujs7lrJ7jNFmFhUALKo=; b=SdE+VzoA8/ye7slH6w9pzRK06Ktdq67JsdfVgPuBCSub4f9m0v+YrV9aIsJYlurDoe TL/yKlxX5NOD+XSMImP0aGfaDer7peSEefytm4SEH6TtQ723Fb17VeXrGiq7M3X9BTf3 TYndL8/jrCSn8C0CtwBZhcdigLZp1AOykM3fC2PDSJeKitvcjwyCsuvZYsOPLoVZIlN6 wEn59QtgEX/Jm0cyzBeyEbGY8ARKgRx5ZjV6ZrNMbdckCjMspb/Fs8nCfD6BZw+DyosH VBIO7T1kgQoPQCLVfJ3YPBRw8FhdzoEDAT+hwnzcIUER/CzB0j9LcSqAG7Rnn6yJgp24 4Gng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773347598; x=1773952398; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wwWbWAC69PL7EVDEZgUQkrVwujs7lrJ7jNFmFhUALKo=; b=UJRCngjmD75ZctDnG96Qn2Q+YCgrye6bwFWvqTpvc10MRM8loayNZ3sh6R+JMpP7qI ZUo/4qex6gjQuWjoKH5OWka7mrTelnJjHmoPBeMQHfLlPqpi2g2PIwngdBJEdI/CWfwu h5QUzFMss+ZpPu/pluynoMWsapMdxZfp0LaBHqNXekhF/vt+lFj3jnp/ZJYuCFkvGjK4 rXja3nv+FPPV7RAGLb+NcxL6ngvJzrrhIw/CVRzhXOiPGpXberDSV+quVe8Yx5fwbqtz 15it4SwPFFen3f1MF8Fe8tlkz5LPvFQBVM3si1AVR0WLGygy4QOLTMwRxgZOJvXvJji2 ixfQ== X-Gm-Message-State: AOJu0Yxor4CM+Rt5znur5Hpw2fDiZSz9S+s7r3oWHLB+AjJ3afw6d/Z3 XDc0sokmX8FO7keDeIfguCr+1dwZzowcqaBdwg98eO5HyFUnUU5It6LKa+YvLQ== X-Gm-Gg: ATEYQzyKS1qpGhLNod/JTvcaEtZvsfkHH9hVA18CyHA/bwjMsfJdv89IECg98WNrrJa 58vhO+h9zBArSs7krACkIIzy9rsUyxYsIZyb/FS0oys0Dj/Y3BDlYtbg813bTQ7ai8mY//sSskA XzzEWMbCa39o1sh2TWjFsYDdT52M5X2bN/jJ4iIioNZbIe5zUBcHdeEZGqAFYvwHoPx2B6Zta5C J4d8n0e+agpoQAyFZCae2GjznQn6yqRRLcxTeXa3l60+EVtq/msB5IQa4Rj92qhYI1QrNtyryXk v3hF1pUy+Nm6PPBtUYhWfPoedjgaR+y3hHsG5wPs/xKLyw86u2e6NrzFfIdC0CKABPTcmRHgC/P 8Llv5Ln00qlhS8BOajc5pJJ63+aoiCYV7EP0lcxvTs2AkrqQjG+ZTfAkgFS30yrIK28ypiMDB3F 0bpOWENXR/kPNlaDKip0SOw+ufTJVQrfUcfI6vZ10/IYd/adUK4dZC633PKtwjavOMDft8Jq+ZC mXGdgO+qKHsq+ChTuqeCw== X-Received: by 2002:a05:6830:8287:b0:7cf:cd4c:347 with SMTP id 46e09a7af769-7d782604004mr525879a34.30.1773347597772; Thu, 12 Mar 2026 13:33:17 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d77a763ba8sm2017776a34.2.2026.03.12.13.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 13:33:17 -0700 (PDT) Date: Thu, 12 Mar 2026 15:33:15 -0500 From: Nathan Bossart To: Greg Burd Cc: pgsql-hackers , Jeff Davis Subject: Re: Expanding HOT updates for expression and partial indexes Message-ID: References: <9bb9bdd6-e1fe-48fe-837d-4d0289396f1c@app.fastmail.com> <872b875c-0aa4-4269-9c84-532227b32361@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <872b875c-0aa4-4269-9c84-532227b32361@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 11, 2026 at 11:51:03AM -0400, Greg Burd wrote: > 0002 - This patch plugs a hole (bug?) in ExecGetAllUpdatedCols() which is > triggered by an existing test in tsearch.sql and the > tsvector_update_trigger(). That trigger uses heap_modify_tuple() to > change an indexed attribute that is not discovered by > ExecGetAllUpdatedCols(), which seems odd to me at best and at worst wrong > (or even a potential security issue). This patch finds and adds columns > that are updated into the Bitmapset returned by ExecGetAllUpdatedCols(). > The patch includes a helper function ExecCompareSlotAttrs() that will be > used in follow-on patches as well. I just looked at this one for now. > The net is that the functions like HeapDetermineColumnsInfo() have to > scan all indexed attributes for changes rather than being able to first > reduce the indexed set by intersecting it with the set of attributes > known to be potentially updated. I noticed the patch doesn't update HeapDetermineColumnsInfo() accordingly. Is that intended? > This commit introduces ExecCompareSlotAttrs() as a utility function to > identify those attributes that have changed. It compares a subset of > attributes between two TupleTableSlots and returns a Bitmapset of > attributes that differ. Hm. Most of this new function looks duplicated from HeapDetermineColumnsInfo(), so IIUC this commit effectively adds another scan through all the attributes. Does this produce noticeably more overhead? > It would be nice to integrate this into HeapDetermineColumnsInfo(), > however it would be a layering violation given that it is within > heap_update(). It'd be good to understand whether the current behavior is intentional or just a happy accident. I found commit 2fd8685e7f, which looks like it was intended as a prerequisite for the WARM feature (which I don't think was ever committed). And it seems to have scanned through all indexed columns when HOT was first introduced in commit 282d2a03dd. I'm also curious whether anything else could modify columns that won't be discovered by ExecGetAllUpdatedCols(). Having HeapDetermineColumnsInfo() scan everything seems like a defense against such things, which is perhaps why you've left it unchanged in the patch. I haven't looked into 0003 yet. Is 0002 a prerequisite for that or a separate fix? -- nathan