Skip to content

Commit c702d65

Browse files
committed
heap pruning: Only call BufferGetBlockNumber() once.
BufferGetBlockNumber() is not that cheap and obviously cannot change during one heap_prune_page(), so only call it once. We might be able to do better and pass the block number from the caller, but that'd be a larger change... Discussion: https://postgr.es/m/20211211045710.ljtuu4gfloh754rs@alap3.anarazel.de
1 parent 35b2803 commit c702d65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/access/heap/pruneheap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ heap_page_prune(Relation relation, Buffer buffer,
269269
{
270270
int ndeleted = 0;
271271
Page page = BufferGetPage(buffer);
272+
BlockNumber blockno = BufferGetBlockNumber(buffer);
272273
OffsetNumber offnum,
273274
maxoff;
274275
PruneState prstate;
@@ -335,7 +336,7 @@ heap_page_prune(Relation relation, Buffer buffer,
335336
htup = (HeapTupleHeader) PageGetItem(page, itemid);
336337
tup.t_data = htup;
337338
tup.t_len = ItemIdGetLength(itemid);
338-
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), offnum);
339+
ItemPointerSet(&(tup.t_self), blockno, offnum);
339340

340341
/*
341342
* Set the offset number so that we can display it along with any

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