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 1w2CA9-0004eo-0Y for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 17:55:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2CA7-00BgPV-1F for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 17:55:32 +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 1w2CA6-00BgPN-39 for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 17:55:31 +0000 Received: from mail-dy1-x1333.google.com ([2607:f8b0:4864:20::1333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2CA3-0000000037S-1A4M for pgsql-hackers@postgresql.org; Mon, 16 Mar 2026 17:55:30 +0000 Received: by mail-dy1-x1333.google.com with SMTP id 5a478bee46e88-2ba895adfeaso4688008eec.0 for ; Mon, 16 Mar 2026 10:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1773683728; x=1774288528; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=787ptzPdD8GDwElb07cVe6kjBM5QNgGK/CnWq9Fb69w=; b=GkqXBOCkdoESjDC9iQAWq5W5S++kJlqBur/Bpt8JHZ+FfcU6eRZQGg7gFNojr4GZxd PLz+OHwWEJ5pC1vQ7Re3aJRD7x5nMtDPziide1zhKiV7ZwWB0wkTwPdqeWU95PUEFAqn tYjAUsYQ4gnmF3/hyNLad4rUN7mvlJBQOLuolvBR2fIn6xEymsPmfDiJ/chac58sO02A sLIdk69bG6DaoM5TRR9SX1HvN9XmradJziTOgclEOA7r2YmqXJlIXsDnU1iz7rghcpDj MChUYSkhKBggCjSg+otLpl/cB+MtqPo91j06Ft/w/3HNVWkHhu1v6PFATkBJXc0W56eK 1EUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773683728; x=1774288528; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=787ptzPdD8GDwElb07cVe6kjBM5QNgGK/CnWq9Fb69w=; b=KpQyAEJ3yhhHSGx/lw1eZAFKDpwZf5PQwe2MmBq0QuC91G+ZTsDvhmevxLRavaesDU QGp+RLL5rfY2G5yDCvEEM9cMA3kUxNMh0r8xf8cACClVR1WOhis577LFFWDET6WfiFrP vI4FVyBKeKPs01i+Xzn5oPPwqTrDKDREtHH5RoQiWGJq7/pu3xYVcIwFDhppdtSKlHnf 9F/DoiAQcv+mAkoRBvAWiRizOpp4UEb3y4eG3cPpf8m4fwEDI9hRhlLdYxkWtWFcXicW RL2QaM/0jP3kSD7gk1WjaqkiZ6aCUf/8x8ElLl7LX+F4DQ2gyIZylpc0yJ4tVK0XLGaa UlqA== X-Gm-Message-State: AOJu0YwQNKJPqpLHB8XTD5VB9cXRP3JKVnjZt0MGu4Qd+1HYY9phUUOB NXhmiQMy0JAgRxC1f87JMTEITeYcVbsy+SvQl87pBooZDLDyV3R/crl06dJhlfnCRQ== X-Gm-Gg: ATEYQzyEyHWR28DECzJkSn8xquMc/trbni8qDgxhs49TycmtIBeghMAqxUhIO2t1Do6 5irNqrGpUb+x8odVwSsPIcjQkVT3hsvqkFNqfrGdz7N0DXTAUcIxtjinBSpSkqqRFmW8jUbsGhJ iDKNNMAGxqwQULTEq/9Ybhvw44k1eTx0g5SoAX+C2GRkqq6dfX/tcet8k2WDCyEFISEYGeboNot bVPBphwO1s0cWaDjve/8Dx4dti3srT3WsXdf3NaDI+bP+I+kD7bmjX5uPoZsR6H4mpJxDjhUemZ Qt9fDU20pfOJunrcELJEj1djP4wMmIxoNL+Jdjhli5dAtHA69Iun8Y81DJMlU3ngfGh3Zfc7puB soIUvdonnIiSdlK0RanWw48r0RiPNCKrLt5foov4uIOuza5W8xPMW0diVUiVnr/33hYSYMvob8P 6ApruBKSOi0dqBpVZCHREbPqCKZnqWxT8B2fY6W3bnc8P6PzOezf+Kttuc/4pXtA== X-Received: by 2002:a05:693c:60dc:b0:2c0:ae1b:4573 with SMTP id 5a478bee46e88-2c0ae1b48c9mr3361915eec.7.1773683727869; Mon, 16 Mar 2026 10:55:27 -0700 (PDT) Received: from jeff-laptop.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2c0bab13f60sm7754707eec.21.2026.03.16.10.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 10:55:27 -0700 (PDT) Message-ID: <7b8681a578b5fe77103948eeb7b5cdd80fabad5d.camel@j-davis.com> Subject: Re: Expanding HOT updates for expression and partial indexes From: Jeff Davis To: Greg Burd , Nathan Bossart Cc: pgsql-hackers Date: Mon, 16 Mar 2026 10:55:26 -0700 In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2026-03-16 at 12:23 -0400, Greg Burd wrote: > Hello Jeff, thanks for taking a look! :) Hi, thank you for working on this problem! > > 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? >=20 > 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. OK. The first half of the commit message for 0002 is slightly confusing because it's referring to pre-existing behavior, behavior changed by the commit, and also future work. It might help to clarify the tenses like: - Previously, ExecGetAllUpdatedCols() had gaps ..., but not a real bug because ... - This commit closes those gaps by updating ri_extraUpdatedCols in ExecBRUpdateTriggers(), making ExecGetAllUpdatedCols() reliable. - We know there are no other gaps because ... - Useful to fix because later work will rely on it for [very brief reason] > =C2=A0 Imagine a table with a lot of indexes where updates only modify on= e > or two at a time.=C2=A0 Why are we testing indexed attributes for changes > in HeapDeterminColumnsInfo() that couldn't have changed?=C2=A0 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. That's helpful, thank you. > What do we "need to be sure" of?=C2=A0 That ExecGetAllUpdatedCols() not > really contains all attributes that its name implies?=C2=A0 I think it no= w > does that after 0002, do you disagree? I don't disagree, but I think we need some kind statement that we believe that it's true, and a brief explanation why. (I don't have much of an opinion about whether it's in this thread, the commit message, or the code.) >=20 > I think it is a new guarantee that was implied before now but not > required until 0003.=C2=A0 I think this change reduces overhead and helps > to avoid some future security feature that depends on > ExecGetAllUpdatedCols() to provide that guarantee. >=20 > Does that make sense? A subtlety here is that perhaps ExecGetAllUpdatedCols() already *was* correct, and it just meant something different than we thought: the *targeted* columns of an update, instead of the actually-updated values. If so we should think about whether that distinction should be preserved. For instance, column filtering for triggers should be based on the targeted columns (rather than actually-updated values) because, semantically, it should still fire even for a no-op update. Perhaps similar for choosing the lock mode? >=20 Regards, Jeff Davis