diff options
author | Andres Freund <andres@anarazel.de> | 2022-01-17 15:31:28 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2022-01-17 15:35:11 -0800 |
commit | c702d656a28386cf5f642206b495c66775afc4ea (patch) | |
tree | ef659920a7e13699815946d52a7d433ad57e2627 /src/backend/access/heap/pruneheap.c | |
parent | 35b2803cf29a39b1adaf55b8b376b965837e9c50 (diff) | |
download | postgresql-c702d656a28386cf5f642206b495c66775afc4ea.tar.gz |
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
Diffstat (limited to 'src/backend/access/heap/pruneheap.c')
-rw-r--r-- | src/backend/access/heap/pruneheap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index 3201fcc52b..b3e2eec52f 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -269,6 +269,7 @@ heap_page_prune(Relation relation, Buffer buffer, { int ndeleted = 0; Page page = BufferGetPage(buffer); + BlockNumber blockno = BufferGetBlockNumber(buffer); OffsetNumber offnum, maxoff; PruneState prstate; @@ -335,7 +336,7 @@ heap_page_prune(Relation relation, Buffer buffer, htup = (HeapTupleHeader) PageGetItem(page, itemid); tup.t_data = htup; tup.t_len = ItemIdGetLength(itemid); - ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), offnum); + ItemPointerSet(&(tup.t_self), blockno, offnum); /* * Set the offset number so that we can display it along with any |