v3-0002-tweaks.patch
text/x-patch
Filename: v3-0002-tweaks.patch
Type: text/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v3-0002
Subject: tweaks
| File | + | − |
|---|---|---|
| src/backend/utils/cache/relcache.c | 11 | 15 |
From 319de1400bff8a803afce6046d413e3febc75cbb Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas.vondra@postgresql.org>
Date: Wed, 22 Feb 2023 12:38:30 +0100
Subject: [PATCH v3 2/2] tweaks
---
src/backend/utils/cache/relcache.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 092c5ed8c7f..cd0f6e2a5ee 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -5251,6 +5251,7 @@ restart:
bool isKey; /* candidate key */
bool isPK; /* primary key */
bool isIDKey; /* replica identity index */
+ Bitmapset **attrs;
indexDesc = index_open(indexOid, AccessShareLock);
@@ -5288,6 +5289,11 @@ restart:
/* Is this index the configured (or default) replica identity? */
isIDKey = (indexOid == relreplindex);
+ if (indexDesc->rd_indam->amsummarizing)
+ attrs = &summarizedattrs;
+ else
+ attrs = &hotblockingattrs;
+
/* Collect simple attribute references */
for (i = 0; i < indexDesc->rd_index->indnatts; i++)
{
@@ -5298,7 +5304,7 @@ restart:
* handle them accurately here. non-key columns must be added into
* hotblockingattrs, since they are in index, and HOT-update
* shouldn't miss them.
- *
+ *
* Summarizing indexes do not block HOT, but do need to be updated
* when the column value changes, thus require a separate
* attribute bitmapset.
@@ -5309,12 +5315,8 @@ restart:
*/
if (attrnum != 0)
{
- if (indexDesc->rd_indam->amsummarizing)
- summarizedattrs = bms_add_member(summarizedattrs,
- attrnum - FirstLowInvalidHeapAttributeNumber);
- else
- hotblockingattrs = bms_add_member(hotblockingattrs,
- attrnum - FirstLowInvalidHeapAttributeNumber);
+ *attrs = bms_add_member(*attrs,
+ attrnum - FirstLowInvalidHeapAttributeNumber);
if (isKey && i < indexDesc->rd_index->indnkeyatts)
uindexattrs = bms_add_member(uindexattrs,
@@ -5331,18 +5333,12 @@ restart:
}
/* Collect all attributes used in expressions, too */
- if (indexDesc->rd_indam->amsummarizing)
- pull_varattnos(indexExpressions, 1, &summarizedattrs);
- else
- pull_varattnos(indexExpressions, 1, &hotblockingattrs);
+ pull_varattnos(indexExpressions, 1, attrs);
/*
* Collect all attributes in the index predicate, too.
*/
- if (indexDesc->rd_indam->amsummarizing)
- pull_varattnos(indexPredicate, 1, &summarizedattrs);
- else
- pull_varattnos(indexPredicate, 1, &hotblockingattrs);
+ pull_varattnos(indexPredicate, 1, attrs);
index_close(indexDesc, AccessShareLock);
}
--
2.39.1