summaryrefslogtreecommitdiff
path: root/src/include/access/nbtree.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-08-24 01:18:34 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-08-24 01:18:34 +0000
commit08ae5edc5c883352018ef754562fc8edbd4177fd (patch)
treeef87fc45a4e1dc895b98c64fdb1d1d55295af24f /src/include/access/nbtree.h
parent7ad642d0b51fdb3a2fb4372f4b298d3f363b05ec (diff)
Optimize the case where a btree indexscan has current and mark positions
on the same index page; we can avoid data copying as well as buffer refcount manipulations in this common case. Makes for a small but noticeable improvement in mergejoin speed. Heikki Linnakangas
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r--src/include/access/nbtree.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index e460bbb0d50..33d295a71b2 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.103 2006/08/07 16:57:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.104 2006/08/24 01:18:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -438,6 +438,15 @@ typedef struct BTScanOpaqueData
int *killedItems; /* currPos.items indexes of killed items */
int numKilled; /* number of currently stored items */
+ /*
+ * If the marked position is on the same page as current position,
+ * we don't use markPos, but just keep the marked itemIndex in
+ * markItemIndex (all the rest of currPos is valid for the mark position).
+ * Hence, to determine if there is a mark, first look at markItemIndex,
+ * then at markPos.
+ */
+ int markItemIndex; /* itemIndex, or -1 if not valid */
+
/* keep these last in struct for efficiency */
BTScanPosData currPos; /* current position data */
BTScanPosData markPos; /* marked position, if any */