aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2020-03-28 20:25:03 -0700
committerPeter Geoghegan <pg@bowt.ie>2020-03-28 20:25:03 -0700
commita7b9d24e4e00048bf9d99b197996476dcf9492de (patch)
treebef61fd82db7983b17e07e1b5880cb80e96779c6
parent9950c8aadf0edd31baec74a729d47d94af636c06 (diff)
downloadpostgresql-a7b9d24e4e00048bf9d99b197996476dcf9492de.tar.gz
postgresql-a7b9d24e4e00048bf9d99b197996476dcf9492de.zip
Make deduplication use number of key attributes.
Use IndexRelationGetNumberOfKeyAttributes() rather than IndexRelationGetNumberOfAttributes() when determining whether or not two index tuples are suitable for merging together into a single posting list tuple. This is a little bit tidier. It brings affected code in nbtdedup.c a little closer to similar, related code in nbtsplitloc.c.
-rw-r--r--src/backend/access/nbtree/nbtdedup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/nbtree/nbtdedup.c b/src/backend/access/nbtree/nbtdedup.c
index 2434ce134bf..b20faf693da 100644
--- a/src/backend/access/nbtree/nbtdedup.c
+++ b/src/backend/access/nbtree/nbtdedup.c
@@ -68,7 +68,7 @@ _bt_dedup_one_page(Relation rel, Buffer buf, Relation heapRel,
int ndeletable = 0;
Size pagesaving = 0;
bool singlevalstrat = false;
- int natts = IndexRelationGetNumberOfAttributes(rel);
+ int nkeyatts = IndexRelationGetNumberOfKeyAttributes(rel);
/*
* We can't assume that there are no LP_DEAD items. For one thing, VACUUM
@@ -182,7 +182,7 @@ _bt_dedup_one_page(Relation rel, Buffer buf, Relation heapRel,
_bt_dedup_start_pending(state, itup, offnum);
}
else if (state->deduplicate &&
- _bt_keep_natts_fast(rel, state->base, itup) > natts &&
+ _bt_keep_natts_fast(rel, state->base, itup) > nkeyatts &&
_bt_dedup_save_htid(state, itup))
{
/*
@@ -519,19 +519,19 @@ static bool
_bt_do_singleval(Relation rel, Page page, BTDedupState state,
OffsetNumber minoff, IndexTuple newitem)
{
- int natts = IndexRelationGetNumberOfAttributes(rel);
+ int nkeyatts = IndexRelationGetNumberOfKeyAttributes(rel);
ItemId itemid;
IndexTuple itup;
itemid = PageGetItemId(page, minoff);
itup = (IndexTuple) PageGetItem(page, itemid);
- if (_bt_keep_natts_fast(rel, newitem, itup) > natts)
+ if (_bt_keep_natts_fast(rel, newitem, itup) > nkeyatts)
{
itemid = PageGetItemId(page, PageGetMaxOffsetNumber(page));
itup = (IndexTuple) PageGetItem(page, itemid);
- if (_bt_keep_natts_fast(rel, newitem, itup) > natts)
+ if (_bt_keep_natts_fast(rel, newitem, itup) > nkeyatts)
return true;
}