*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.23 2000/01/26 05:55:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.24 2000/03/14 23:52:01 tgl Exp $
*
* NOTES
* many of the old access method routines have been turned into
ItemPointerSetInvalid(&scan->currentMarkData);
ItemPointerSetInvalid(&scan->nextMarkData);
+ /* mark cached function lookup data invalid; it will be set on first use */
+ scan->fn_getnext.fn_oid = InvalidOid;
+
if (numberOfKeys > 0)
scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * numberOfKeys);
else
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.40 2000/01/26 05:55:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.41 2000/03/14 23:52:01 tgl Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
index_getnext(IndexScanDesc scan,
ScanDirection direction)
{
- RegProcedure procedure;
RetrieveIndexResult result;
SCAN_CHECKS;
- GET_SCAN_PROCEDURE(getnext, amgettuple);
+
+ /* ----------------
+ * Look up the access procedure only once per scan.
+ * ----------------
+ */
+ if (scan->fn_getnext.fn_oid == InvalidOid)
+ {
+ RegProcedure procedure;
+
+ GET_SCAN_PROCEDURE(getnext, amgettuple);
+ fmgr_info(procedure, &scan->fn_getnext);
+ }
/* ----------------
* have the am's gettuple proc do all the work.
* ----------------
*/
- result = (RetrieveIndexResult) fmgr(procedure, scan, direction);
+ result = (RetrieveIndexResult)
+ (*fmgr_faddr(&scan->fn_getnext)) (scan, direction);
return result;
}
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relscan.h,v 1.18 2000/01/26 05:57:51 momjian Exp $
+ * $Id: relscan.h,v 1.19 2000/03/14 23:52:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
bool scanFromEnd; /* restart scan at end? */
uint16 numberOfKeys; /* number of key attributes */
ScanKey keyData; /* key descriptor */
+ FmgrInfo fn_getnext; /* cached lookup info for am's getnext fn */
} IndexScanDescData;
typedef IndexScanDescData *IndexScanDesc;