summaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree/nbtree.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-04-21 18:24:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-04-21 18:24:26 +0000
commit37fa3b6c89abc05f8c4691440a27427db3a6e03b (patch)
tree3a1ddb224fee306bab8ca6282b1fcfd9e7692975 /src/backend/access/nbtree/nbtree.c
parent95a03e9cdf7e0e33c2655dd20d2b64db191f3a21 (diff)
downloadpostgresql-37fa3b6c89abc05f8c4691440a27427db3a6e03b.tar.gz
Tweak indexscan and seqscan code to arrange that steps from one page to
the next are handled by ReleaseAndReadBuffer rather than separate ReleaseBuffer and ReadBuffer calls. This cuts the number of acquisitions of the BufMgrLock by a factor of 2 (possibly more, if an indexscan happens to pull successive rows from the same heap page). Unfortunately this doesn't seem enough to get us out of the recently discussed context-switch storm problem, but it's surely worth doing anyway.
Diffstat (limited to 'src/backend/access/nbtree/nbtree.c')
-rw-r--r--src/backend/access/nbtree/nbtree.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 79a69a7043..57074a0363 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.113 2004/02/10 03:42:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.114 2004/04/21 18:24:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -919,9 +919,7 @@ _bt_restscan(IndexScanDesc scan)
for (;;)
{
blkno = opaque->btpo_next;
- if (nextbuf != InvalidBuffer)
- _bt_relbuf(rel, nextbuf);
- nextbuf = _bt_getbuf(rel, blkno, BT_READ);
+ nextbuf = _bt_relandgetbuf(rel, nextbuf, blkno, BT_READ);
page = BufferGetPage(nextbuf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (!P_IGNORE(opaque))