summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorTom Lane2005-05-27 23:31:21 +0000
committerTom Lane2005-05-27 23:31:21 +0000
commit32e8fc4a28dd718aef16b9f617602c88b1f5f7e1 (patch)
tree7132d4430bebde31955c392787c1a7b829b0d023 /src/include/access
parentdd67cf365a76ee875d7bc3aa3788a243fce4776f (diff)
Arrange to cache fmgr lookup information for an index's access method
routines in the index's relcache entry, instead of doing a fresh fmgr_info on every index access. We were already doing this for the index's opclass support functions; not sure why we didn't think to do it for the AM functions too. This supersedes the former method of caching (only) amgettuple in indexscan scan descriptors; it's an improvement because the function lookup can be amortized across multiple statements instead of being repeated for each statement. Even though lookup for builtin functions is pretty cheap, this seems to drop a percent or two off some simple benchmarks.
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/genam.h4
-rw-r--r--src/include/access/relscan.h11
2 files changed, 6 insertions, 9 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 422e107ec51..3ad0a3d4b2c 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.50 2005/04/14 20:03:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.51 2005/05/27 23:31:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,7 +104,7 @@ extern IndexBulkDeleteResult *index_vacuum_cleanup(Relation indexRelation,
extern RegProcedure index_cost_estimator(Relation indexRelation);
extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
-extern struct FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
+extern FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
uint16 procnum);
/*
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 1cb40445ea4..f84a84b6f7e 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.38 2005/03/27 23:53:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.39 2005/05/27 23:31:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,9 +40,8 @@ typedef HeapScanDescData *HeapScanDesc;
/*
* We use the same IndexScanDescData structure for both amgettuple-based
- * and amgetmulti-based index scans. Which one is being used can be told
- * by looking at fn_getnext and fn_getmulti, only one of which will be
- * initialized. Some fields are only relevant in amgettuple-based scans.
+ * and amgetmulti-based index scans. Some fields are only relevant in
+ * amgettuple-based scans.
*/
typedef struct IndexScanDescData
{
@@ -52,6 +51,7 @@ typedef struct IndexScanDescData
Snapshot xs_snapshot; /* snapshot to see */
int numberOfKeys; /* number of scan keys */
ScanKey keyData; /* array of scan key descriptors */
+ bool is_multiscan; /* TRUE = using amgetmulti */
/* signaling to index AM about killing index tuples */
bool kill_prior_tuple; /* last-returned tuple is dead */
@@ -75,9 +75,6 @@ typedef struct IndexScanDescData
Buffer xs_cbuf; /* current heap buffer in scan, if any */
/* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
- FmgrInfo fn_getnext; /* cached lookup info for AM's getnext fn */
- FmgrInfo fn_getmulti; /* cached lookup info for AM's getmulti fn */
-
/*
* If keys_are_unique and got_tuple are both true, we stop calling the
* index AM; it is then necessary for index_getnext to keep track of