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 1th0am-00Ff8d-46 for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2025 06:14:56 +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 1th0ak-00BZvI-CU for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2025 06:14:54 +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.94.2) (envelope-from ) id 1th0ak-00BZvA-20 for pgsql-hackers@lists.postgresql.org; Sun, 09 Feb 2025 06:14:54 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1th0ah-0043oA-1w for pgsql-hackers@postgresql.org; Sun, 09 Feb 2025 06:14:52 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ab7917fc0c2so313342766b.0 for ; Sat, 08 Feb 2025 22:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1739081690; x=1739686490; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=XtoYX1a3FR8ZGd5xOezlA3XUe+HCCmJuhI1smbQcfy4=; b=K/Hj500s+DZmfGjOKxeHNdPKgqGQqnmuVoZ2X+eNQ+msHhG9oXOirO7yO2QkmEMmY3 XYZjx14Tx3xx2X8skomS3GG1gUniickPOFmG4xM3VDFRwGyxYmzFhYcEfiQojlvixAEp aRc6nOcwgkIx0/yD+CnhJa+w3qHWQNKfaOfuAFcFW1bl8ZvdDwBoeSDJjwJ3UCfrgic1 HlToDv41xwNXasTqsdRBS0QSupsSaEjRUxAmu7Eoo5EzZplHH35TwlxtOKJ6ZlbsJ+rg W68JeoxvGPCfOO9ZRfHgoWXtBgby119BsxQIdeLZHzX1vHbXj46Au8KdzZ98ajUFSgG5 yFgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739081690; x=1739686490; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XtoYX1a3FR8ZGd5xOezlA3XUe+HCCmJuhI1smbQcfy4=; b=doYgG8xomp+oWGuD9EHEbTuaaXoEyFQ8gygwfFodGZChWLWG4kXFuPZi06Q2Y0sfs9 w6E//v16hStaUhLn/aq/qLKaE8HnVlK8uVLsFtfNzJQFjq8U7ZJJQ5X/EJy2C7Ij/02K LfRNCIdQBP1VuMD7C2PIUkngcxHXuWGJmoKmRQ1rzQ0IyyNozUHEeHhLMfbykjzDo5+l BuZFx52r3uvjuyClK3F3aAdqnfr7In7x3jPwi6wuHntrDDlprRxnbwB/G+7xL/VqPWel keNJ1ULFUNXE81e8i+fxaKofwZEVOxPYpl/NqtZTDrsIii+pvmTJ6bNS/VY3r5IPNyJ+ JujA== X-Forwarded-Encrypted: i=1; AJvYcCW7iiyJYXhvEFlXWo6CXD4geUAsXHFKCQ+x8ibfMbpXo6NjdTtrKR1qYAIIUqHyCBoIwvNSvZyURMWT7avl@postgresql.org X-Gm-Message-State: AOJu0YzMh2I9SgEgifO3cb/yUfVo1eweAY/2MpNQPxVIV+4qAVz12XY3 zHPX5G0VRZO1UaPn+OxdNsUMgBh3t3BcMCAo6BkLMD70BpINhr+0sc/2hmDscP0o+JZRjvimHQj 9YQs= X-Gm-Gg: ASbGncsUrb6zcYZeQuTft5KN7O/K9CsTSEwO3JJ4wHryl/m1xtJ9JCp3I9nkKDqbmv6 7wIdRS7DFYCeXtIk7BJcsvlh7rHXwEjJ/L9m0C3s0U4eB7RdEEJUud/ed/pcJn1Kk1K+w0oA1px v+qBI14olsQXuJUB+p+CSKh650f5S1OE4BDMrK6qdGOLaSs8an6aiUQH2hAcyBorDSkR77mZKO1 o9f+oE9z+HPIrBwexAYNSS+iMrhFsGYJHXnzamvTm3r4enpkTw8NQMlK+q+A2NCVyOaZXK9mDL4 XGVYC6L02h5Gl2qvBg10dYbzxgql9q4HCqZs X-Google-Smtp-Source: AGHT+IGY4FyjcLeovvf7qmYnZ+emMyNJuvMN1ryaYNS/2eVrtR2ymVlH+QvUntXGRofIW2n02Y2GlQ== X-Received: by 2002:a17:907:7603:b0:ab7:b729:9a5a with SMTP id a640c23a62f3a-ab7b7299be7mr70868966b.33.1739081689906; Sat, 08 Feb 2025 22:14:49 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:9c88:cdb3:e735:5fe5:f7aa]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772f486e9sm614447766b.35.2025.02.08.22.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Feb 2025 22:14:49 -0800 (PST) Message-ID: <0a47ce53fa635787d36325b5ad7bac94cdca4246.camel@cybertec.at> Subject: Re: Expanding HOT updates for expression and partial indexes From: Laurenz Albe To: "Burd, Greg" , "pgsql-hackers@postgresql.org" Date: Sun, 09 Feb 2025 07:14:49 +0100 In-Reply-To: <78574B24-BE0A-42C5-8075-3FA9FA63B8FC@amazon.com> References: <78574B24-BE0A-42C5-8075-3FA9FA63B8FC@amazon.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-02-06 at 22:24 +0000, Burd, Greg wrote: > Attached find a patch that expands the cases where heap-only tuple (HOT) = updates are possible > without changing the basic semantics of HOT. This is accomplished by exam= ining expression > indexes for changes to determine if indexes require updating or not. A si= milar approach is > taken for partial indexes, the predicate is evaluated and, in some cases,= HOT updates are > allowed. > > [...] > > Third, there is overhead to this patch, it is no longer a single simple b= itmap test to choose > HOT or not in heap_update(). Sometimes this patch will perform expensive = additional checks > and ultimately not go down the HOT path, new overhead with no benefit. So= me expressions are > more expensive than others to evaluate, there is no logic to adjust for t= hat. The Surjective > patch/email thread had quite a bit of discussion on this without resoluti= on. I=E2=80=99ve chosen to > add a GUC that optionally avoids the expression evaluation. I=E2=80=99m o= pen to ideas here as well, > addition of another GUC or removal of the one I=E2=80=99ve added. I=E2=80= =99ve tried to avoid rechecking > indexes for changes when possible. I think that the goal of this patch is interesting and desirable. The greatest concern for me is the performance impact. I think that a swit= ch is warranted, but I am not sure if it should be a GUC. Wouldn't it be better to have a r= eloption, so that this can be configured per table? I am not sure if a global switch is nece= ssary, but I am not fundamentally against it. Yours, Laurenz Albe