diff options
author | Neil Conway <neilc@samurai.com> | 2004-11-17 03:13:38 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-11-17 03:13:38 +0000 |
commit | 5d1dd2bc55edaf9bd4f733e835e56cabbfe310cd (patch) | |
tree | 7c5e756adbaf02329cf9f32e2b22dce44667e73f /src/backend/access/nbtree/nbtree.c | |
parent | a51e54cf5b93de5943d2a28e2c4058b5be456aeb (diff) |
Micro-optimization of markpos() and restrpos() in btree and hash indexes.
Rather than using ReadBuffer() to increment the reference count on an
already-pinned buffer, we should use IncrBufferRefCount() as it is
faster and does not require acquiring the BufMgrLock.
Diffstat (limited to 'src/backend/access/nbtree/nbtree.c')
-rw-r--r-- | src/backend/access/nbtree/nbtree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 92cd0f09cec..771ff6cbe7c 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -12,7 +12,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.121 2004/11/11 00:32:50 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.122 2004/11/17 03:13:38 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -477,8 +477,8 @@ btmarkpos(PG_FUNCTION_ARGS) /* bump pin on current buffer for assignment to mark buffer */ if (ItemPointerIsValid(&(scan->currentItemData))) { - so->btso_mrkbuf = ReadBuffer(scan->indexRelation, - BufferGetBlockNumber(so->btso_curbuf)); + IncrBufferRefCount(so->btso_curbuf); + so->btso_mrkbuf = so->btso_curbuf; scan->currentMarkData = scan->currentItemData; so->mrkHeapIptr = so->curHeapIptr; } @@ -509,8 +509,8 @@ btrestrpos(PG_FUNCTION_ARGS) /* bump pin on marked buffer */ if (ItemPointerIsValid(&(scan->currentMarkData))) { - so->btso_curbuf = ReadBuffer(scan->indexRelation, - BufferGetBlockNumber(so->btso_mrkbuf)); + IncrBufferRefCount(so->btso_mrkbuf); + so->btso_curbuf = so->btso_mrkbuf; scan->currentItemData = scan->currentMarkData; so->curHeapIptr = so->mrkHeapIptr; } |