Skip to content

Commit f0e72a2

Browse files
committed
Improve handling of dead tuples in hash indexes.
When squeezing a bucket during vacuum, it's not necessary to retain any tuples already marked as dead, so ignore them when deciding which tuples must be moved in order to empty a bucket page. Similarly, when splitting a bucket, relocating dead tuples to the new bucket is a waste of effort; instead, just ignore them. Amit Kapila, reviewed by me. Testing help provided by Ashutosh Sharma.
1 parent 650b967 commit f0e72a2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/backend/access/hash/hashovfl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ _hash_squeezebucket(Relation rel,
656656
IndexTuple itup;
657657
Size itemsz;
658658

659+
/* skip dead tuples */
660+
if (ItemIdIsDead(PageGetItemId(rpage, roffnum)))
661+
continue;
662+
659663
itup = (IndexTuple) PageGetItem(rpage,
660664
PageGetItemId(rpage, roffnum));
661665
itemsz = IndexTupleDSize(*itup);

src/backend/access/hash/hashpage.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,10 @@ _hash_splitbucket(Relation rel,
811811
Size itemsz;
812812
Bucket bucket;
813813

814+
/* skip dead tuples */
815+
if (ItemIdIsDead(PageGetItemId(opage, ooffnum)))
816+
continue;
817+
814818
/*
815819
* Fetch the item's hash key (conveniently stored in the item) and
816820
* determine which bucket it now belongs in.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy