mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
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
This commit is contained in:
@ -269,6 +269,7 @@ heap_page_prune(Relation relation, Buffer buffer,
|
|||||||
{
|
{
|
||||||
int ndeleted = 0;
|
int ndeleted = 0;
|
||||||
Page page = BufferGetPage(buffer);
|
Page page = BufferGetPage(buffer);
|
||||||
|
BlockNumber blockno = BufferGetBlockNumber(buffer);
|
||||||
OffsetNumber offnum,
|
OffsetNumber offnum,
|
||||||
maxoff;
|
maxoff;
|
||||||
PruneState prstate;
|
PruneState prstate;
|
||||||
@ -335,7 +336,7 @@ heap_page_prune(Relation relation, Buffer buffer,
|
|||||||
htup = (HeapTupleHeader) PageGetItem(page, itemid);
|
htup = (HeapTupleHeader) PageGetItem(page, itemid);
|
||||||
tup.t_data = htup;
|
tup.t_data = htup;
|
||||||
tup.t_len = ItemIdGetLength(itemid);
|
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
|
* Set the offset number so that we can display it along with any
|
||||||
|
Reference in New Issue
Block a user