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 1qTfEZ-00AHRg-E4 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Aug 2023 09:12:03 +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 1qTfEX-0040Po-Ph for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Aug 2023 09:12:02 +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 1qTfEX-0040Pg-GS for pgsql-hackers@lists.postgresql.org; Wed, 09 Aug 2023 09:12:01 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qTfEU-001Rl8-UG for pgsql-hackers@lists.postgresql.org; Wed, 09 Aug 2023 09:12:01 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9CD105C0094; Wed, 9 Aug 2023 05:11:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 09 Aug 2023 05:11:57 -0400 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 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1691572317; x= 1691658717; bh=RdVa+7HV0LaSJhLJR4zsdKetovXuRauFbffxiBNceEY=; b=J mMZnIExPi4ALgjze9YD8/aD9nZPMUmFPtf5ql2rsbel/hclZq1U7L9DCkc1THWZ3 AyEr73wlv8Pl8rPEPddypedTpWsyN0zTqlM+/OYbLX4CV67Atw5P7gGaSd9ozYlW 2BjyeuPuXI+QzRduf6NNyk8JLtiB1TgjWb+cCc4B2thBg3WREOa9Giep1930KNhC r+5+Bu2kyWtbcQFD4Afvd0i9e56bmkzXk/eXA94tIET2EwEw4n7VBpa8TIdcgCv8 W4ddgO2kGoFjXsoNL8UxHzryR36dqEe2QbXdZGdHKMk2N8e2Fgn5UoDZUxB6PWnH 7eCrpJXvMi+Vo5PcLvVlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrleeggdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehmkeerredttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeduleekkefgtddttedtkefguddvieffleetgeejiefhteeh keevfeettdduvdfhueenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Aug 2023 05:11:57 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7AD8ADF; Wed, 9 Aug 2023 11:11:55 +0200 (CEST) Date: Wed, 9 Aug 2023 11:11:55 +0200 From: Alvaro Herrera To: pgsql-hackers@lists.postgresql.org Cc: Matthias van de Meent , Tomas Vondra , Josef =?utf-8?B?xaBpbcOhbmVr?= Subject: Re: pgsql: Ignore BRIN indexes when checking for HOT udpates Message-ID: <20230809091155.7c7f3gttjk3dj4ze@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="sr6mye444zs4xrf5" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --sr6mye444zs4xrf5 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2021-Nov-30, Tomas Vondra wrote: > Ignore BRIN indexes when checking for HOT udpates I was trying to use RelationGetIndexAttrBitmap for something and realized that its header comment does not really explain things very well. That was already the case before this commit, but it (this commit) did add new possible values without mentioning them. I propose the attached comment-only patch. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Al principio era UNIX, y UNIX habló y dijo: "Hello world\n". No dijo "Hello New Jersey\n", ni "Hello USA\n". --sr6mye444zs4xrf5 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Document-RelationGetIndexAttrBitmap-better.patch" From db4c89d15d121bf0e15c4160cb2f0770bc98195a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 12 Jul 2023 14:19:23 +0200 Subject: [PATCH] Document RelationGetIndexAttrBitmap better Commit 19d8e2308bc5 changed the list of set-of-columns that can be returned by RelationGetIndexAttrBitmap, but didn't update its "documentation". That was pretty hard to read already, so rewrite to make it more comprehensible, adding the missing values while at it. Backpatch to 16, like that commit. --- src/backend/utils/cache/relcache.c | 12 +++++++++--- src/include/utils/relcache.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 8e28335915..8e08ca1c68 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -5150,9 +5150,15 @@ RelationGetIndexPredicate(Relation relation) * simple index keys, but attributes used in expressions and partial-index * predicates.) * - * Depending on attrKind, a bitmap covering the attnums for all index columns, - * for all potential foreign key columns, or for all columns in the configured - * replica identity index is returned. + * Depending on attrKind, a bitmap covering attnums for certain columns is + * returned: + * INDEX_ATTR_BITMAP_KEY Columns in non-partial unique indexes not + * in expressions (i.e., usable for FKs) + * INDEX_ATTR_BITMAP_PRIMARY_KEY Columns in the table's primary key + * INDEX_ATTR_BITMAP_IDENTITY_KEY Columns in the table's replica identity + * index (empty if FULL) + * INDEX_ATTR_BITMAP_HOT_BLOCKING Columns that block updates from being HOT + * INDEX_ATTR_BITMAP_SUMMARIZED Columns included in summarizing indexes * * Attribute numbers are offset by FirstLowInvalidHeapAttributeNumber so that * we can include system attributes (e.g., OID) in the bitmap representation. diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index beeb28b83c..38524641f4 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -54,6 +54,9 @@ extern List *RelationGetIndexPredicate(Relation relation); extern Datum *RelationGetIndexRawAttOptions(Relation indexrel); extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy); +/* + * Which set of columns to return by RelationGetIndexAttrBitmap. + */ typedef enum IndexAttrBitmapKind { INDEX_ATTR_BITMAP_KEY, -- 2.39.2 --sr6mye444zs4xrf5--