Commit 0c5af0a5 authored by Andres Freund's avatar Andres Freund

Move BufferGetBlockNumber() out of heap_page_is_all_visible()'s inner loop.

In some workloads BufferGetBlockNumber() shows up in profiles due to
the sheer number of calls to it (and because it causes cache
misses). The compiler can't move it out of the loop because it's a
full extern function call...
parent 6c878edc
...@@ -1754,6 +1754,7 @@ static bool ...@@ -1754,6 +1754,7 @@ static bool
heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cutoff_xid) heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cutoff_xid)
{ {
Page page = BufferGetPage(buf); Page page = BufferGetPage(buf);
BlockNumber blockno = BufferGetBlockNumber(buf);
OffsetNumber offnum, OffsetNumber offnum,
maxoff; maxoff;
bool all_visible = true; bool all_visible = true;
...@@ -1778,7 +1779,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut ...@@ -1778,7 +1779,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut
if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid)) if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid))
continue; continue;
ItemPointerSet(&(tuple.t_self), BufferGetBlockNumber(buf), offnum); ItemPointerSet(&(tuple.t_self), blockno, offnum);
/* /*
* Dead line pointers can have index pointers pointing to them. So * Dead line pointers can have index pointers pointing to them. So
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment