aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2014-11-14 17:04:44 +0100
committerAndres Freund <andres@anarazel.de>2014-11-14 17:04:44 +0100
commit0c5af0a537a2d6320eb8ef7f401401aa1f47b79e (patch)
tree0a3f4a89a1b3439641ee4c5cd636ac420afd0d8d
parent6c878edc1df9d4d9ad7ed4a7e1c34c0bf0f622b9 (diff)
downloadpostgresql-0c5af0a537a2d6320eb8ef7f401401aa1f47b79e.tar.gz
postgresql-0c5af0a537a2d6320eb8ef7f401401aa1f47b79e.zip
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...
-rw-r--r--src/backend/commands/vacuumlazy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 8dad8c269cc..6db6c5cf472 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -1754,6 +1754,7 @@ static bool
heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cutoff_xid)
{
Page page = BufferGetPage(buf);
+ BlockNumber blockno = BufferGetBlockNumber(buf);
OffsetNumber offnum,
maxoff;
bool all_visible = true;
@@ -1778,7 +1779,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut
if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid))
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