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.94.2) (envelope-from ) id 1v6w0Z-00CC0E-4U for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 19:08:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v6w0F-0081mP-AC for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 19:08:40 +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.94.2) (envelope-from ) id 1v6w0E-0081mF-RM for pgsql-hackers@lists.postgresql.org; Thu, 09 Oct 2025 19:08:39 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6w0A-001HnZ-28 for pgsql-hackers@postgresql.org; Thu, 09 Oct 2025 19:08:39 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7833765433cso1776080b3a.0 for ; Thu, 09 Oct 2025 12:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1760036912; x=1760641712; 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=AI/7oFpPOwvtXZpBfB9omdR5hOETAH44sdvw2aiETeA=; b=1gstU9hokYCQHzPdYrJ3cBVX/8Em0iwtvwRacMSEisq0EHmjrRS1SNiymqVUkqeoHY 02oIHthmq10679+0ddV5M+EIfYaxRr2sZvzasuUSjEdDQkHHQn9vccQmvnInFzfz5Gy8 lpv6BOwBvB7itYNRlUeqzHsvfiqbcZ5PRPwk96colyGvHcKmxdyPa0TqVdJluhIfQepo Wjxzhi8zV6ONvYPzo2sCk92jyOO7kY8QU36OC5Hk5kfoWzvOF7JPZPRsXcv54ljayMsf N9ot+Ah7Lqn0xxkFTD6xVPTHxL+nqctrdM75JCwTAYV28+hz2AZ9+Qm3W6ZiQ5qoI7Gg 0lkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760036912; x=1760641712; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AI/7oFpPOwvtXZpBfB9omdR5hOETAH44sdvw2aiETeA=; b=LltBCe+rWvcYBz0ls+iKUXekcsE8+MMPAVbiLHiJf4ATCCUY6daCNVcERBKQZg+Wf1 Y0xngH7xWRQUZUXmxSwl1/ompM0I86s9c7I/n/CNzhWxRyr+cJsiqY9ZC36m8/tMDS6U d8JXr10nTixCZVLT6YpCpenysglxtrOyOn2VAcyLXmNIixdJ+Y4f8Etx7wsozhx/T415 FCKhQGJ/dLukac00nkiFGxm5+8OfgJ6KWM0Q2nGArrwCaSrg/sV28kglM40VGtBA+6WN +JIz0XCqhYkL+4NJPECm8ZNanmbkMLovWo5NqP5CHhR19S79cCQFiydORcyZFBSTdfdL UKyg== X-Forwarded-Encrypted: i=1; AJvYcCUZfVBms/m0KpFDTd0aXIlQshPwWPW2627JyU8SHgAHp2eetf3inC1mWB62LmR2X0DCmXMTaYkuw5gyYpqt@postgresql.org X-Gm-Message-State: AOJu0Yyx1HG9b9KIvkDBNuwAG5ZT96jzO4qjMEBobg0cG8T+DuAdUihl wFA6opwoSn18AoEzn9Zq00DDSIkJWMQnmx4OEQURFha1JdyymWeXQEqQevqdsIHvgA== X-Gm-Gg: ASbGncvI5d+fbnyJuMqfYIdRlWgoRqyNlz0PO1n3tgOIpAgPTD7ER1smRqY64ULQeOP 9jnk5K61T83B1poV5jjJ0KEeRLrcDSOfXlkoWQzWRXYNaIql4R8uE//KJDV4c4iNfM6YAijQd0Y /7ZlkzCJSvslgpwOuJJS6lDZ+FDMksKbj9YBuwJHCCkcaruziNdFurnixhFKPp/PzFnSQpM2VjS 72VuLFcVfELnaMOwYIVJzZQRI8G0rdRjX49ZRznH/sV84Pwt4XZ6xyW7OXXJ2L/pz9D89bU+YQk N/yrSWLaeMHpnbj2Pd9AQwCUiiMaQkV7E+6FH1TuymhrLHwGkFVCgwGKclGGjyAF5I6JHEWhB+1 pJtgs00axTSRf734VhqU7lNrrBWoScISbpxefxYv+eUr/r6sixSIPowOXog0iIWZ9iW2/OCOJX6 DpXvlH4Oi0lRSbMPRnpfVBXI1m X-Google-Smtp-Source: AGHT+IGz8drC6ay8tPq/oWYebR1zmh+QKd24KZMunDmDdsbciaVxu9VLdWY5XD7Ia6DXaF+8Ia5eBQ== X-Received: by 2002:a05:6a00:812:b0:782:7052:5167 with SMTP id d2e1a72fcca58-79384f489bfmr11037230b3a.6.1760036911952; Thu, 09 Oct 2025 12:08:31 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0964c1sm459829b3a.54.2025.10.09.12.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Oct 2025 12:08:31 -0700 (PDT) Message-ID: <96b451774d927daffe7fe40d06447eabb06a8f3f.camel@j-davis.com> Subject: Re: Expanding HOT updates for expression and partial indexes From: Jeff Davis To: Nathan Bossart , Greg Burd Cc: "Burd, Greg" , "pgsql-hackers@postgresql.org" Date: Thu, 09 Oct 2025 12:08:30 -0700 In-Reply-To: References: <97f0aa72-f172-4673-8b04-533f022c3149@app.fastmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2025-10-08 at 15:48 -0500, Nathan Bossart wrote: > > The theory being that > > my new code using the old/new tts to form and test the index tuples > > resulting from executing expressions was using the resultsRelInfo > > struct > > created during plan execution, not the information found on the > > page, > > and so was safe without the lock. >=20 > An open question (at least from me) is whether this is safe.=C2=A0 I'm no= t > familiar enough with this area of code yet to confidently determine > that. The optimization requires that the expression evaluates to the same thing on the old and new tuples. That determination doesn't have anything to do with a lock on the buffer, so long as the old tuple isn't pruned away or something. And clearly it won't be pruned, because we're in the process of updating it, so we have a snapshot that can see it. There might be subtleties in other parts of the proposal, but the above determination can be made safely without a buffer lock. >=20 > > I added a reloption "expression_checks" to disable this new code > > path.=20 > > Good idea or bad precedent? >=20 > If there are cases where the added overhead outweighs the benefits > (which > seems like it must be true some of the time), then I think we must > have a > way to opt-out (or maybe even opt-in).=C2=A0 In fact, I'd advise adding a > GUC to > complement the reloption so that users can configure it at higher > levels. I'll push back against this. For now I'm fine with developer options to make testing easier, but we should find a way to make this work well without tuning. Regards, Jeff Davis