File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.23 2000/01/26 05:55:57 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.24 2000/03/14 23:52:01 tgl Exp $
12
12
*
13
13
* NOTES
14
14
* many of the old access method routines have been turned into
@@ -114,6 +114,9 @@ RelationGetIndexScan(Relation relation,
114
114
ItemPointerSetInvalid (& scan -> currentMarkData );
115
115
ItemPointerSetInvalid (& scan -> nextMarkData );
116
116
117
+ /* mark cached function lookup data invalid; it will be set on first use */
118
+ scan -> fn_getnext .fn_oid = InvalidOid ;
119
+
117
120
if (numberOfKeys > 0 )
118
121
scan -> keyData = (ScanKey ) palloc (sizeof (ScanKeyData ) * numberOfKeys );
119
122
else
Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.40 2000/01/26 05:55:57 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.41 2000/03/14 23:52:01 tgl Exp $
12
12
*
13
13
* INTERFACE ROUTINES
14
14
* index_open - open an index relation by relationId
@@ -329,17 +329,28 @@ RetrieveIndexResult
329
329
index_getnext (IndexScanDesc scan ,
330
330
ScanDirection direction )
331
331
{
332
- RegProcedure procedure ;
333
332
RetrieveIndexResult result ;
334
333
335
334
SCAN_CHECKS ;
336
- GET_SCAN_PROCEDURE (getnext , amgettuple );
335
+
336
+ /* ----------------
337
+ * Look up the access procedure only once per scan.
338
+ * ----------------
339
+ */
340
+ if (scan -> fn_getnext .fn_oid == InvalidOid )
341
+ {
342
+ RegProcedure procedure ;
343
+
344
+ GET_SCAN_PROCEDURE (getnext , amgettuple );
345
+ fmgr_info (procedure , & scan -> fn_getnext );
346
+ }
337
347
338
348
/* ----------------
339
349
* have the am's gettuple proc do all the work.
340
350
* ----------------
341
351
*/
342
- result = (RetrieveIndexResult ) fmgr (procedure , scan , direction );
352
+ result = (RetrieveIndexResult )
353
+ (* fmgr_faddr (& scan -> fn_getnext )) (scan , direction );
343
354
344
355
return result ;
345
356
}
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Id: relscan.h,v 1.18 2000/01/26 05:57:51 momjian Exp $
10
+ * $Id: relscan.h,v 1.19 2000/03/14 23:52:00 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -54,6 +54,7 @@ typedef struct IndexScanDescData
54
54
bool scanFromEnd ; /* restart scan at end? */
55
55
uint16 numberOfKeys ; /* number of key attributes */
56
56
ScanKey keyData ; /* key descriptor */
57
+ FmgrInfo fn_getnext ; /* cached lookup info for am's getnext fn */
57
58
} IndexScanDescData ;
58
59
59
60
typedef IndexScanDescData * IndexScanDesc ;
You can’t perform that action at this time.
0 commit comments