1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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
This commit is contained in:
Tom Lane
2006-08-24 01:18:34 +00:00
parent 7ad642d0b5
commit 08ae5edc5c
3 changed files with 67 additions and 26 deletions

View File

@ -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 */