summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2001-10-06 23:21:45 +0000
committerTom Lane2001-10-06 23:21:45 +0000
commit85801a4dbdee22f230637311681b8b03a72979db (patch)
tree28054ba90fda332be0d5254e5bdaba5a2a51f1f2 /src/include
parenta965750abf2504e266e5071dc90365be9485395a (diff)
Rearrange fmgr.c and relcache so that it's possible to keep FmgrInfo
lookup info in the relcache for index access method support functions. This makes a huge difference for dynamically loaded support functions, and should save a few cycles even for built-in ones. Also tweak dfmgr.c so that load_external_function is called only once, not twice, when doing fmgr_info for a dynamically loaded function. All per performance gripe from Teodor Sigaev, 5-Oct-01.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/genam.h4
-rw-r--r--src/include/access/skey.h5
-rw-r--r--src/include/catalog/index.h6
-rw-r--r--src/include/fmgr.h26
-rw-r--r--src/include/utils/rel.h25
-rw-r--r--src/include/utils/relcache.h5
6 files changed, 45 insertions, 26 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index db6795c093..0a70691e77 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: genam.h,v 1.26 2001/07/15 22:48:18 tgl Exp $
+ * $Id: genam.h,v 1.27 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,6 +56,8 @@ extern IndexBulkDeleteResult *index_bulk_delete(Relation relation,
extern RegProcedure index_cost_estimator(Relation relation);
extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
+extern struct FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
+ uint16 procnum);
/* in genam.c */
extern IndexScanDesc RelationGetIndexScan(Relation relation, bool scanFromEnd,
diff --git a/src/include/access/skey.h b/src/include/access/skey.h
index 4e49f51afb..304d5e4a46 100644
--- a/src/include/access/skey.h
+++ b/src/include/access/skey.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: skey.h,v 1.16 2001/06/09 18:16:59 tgl Exp $
+ * $Id: skey.h,v 1.17 2001/10/06 23:21:44 tgl Exp $
*
* Note:
* Needs more accessor/assignment routines.
@@ -44,5 +44,8 @@ typedef ScanKeyData *ScanKey;
extern void ScanKeyEntrySetIllegal(ScanKey entry);
extern void ScanKeyEntryInitialize(ScanKey entry, bits16 flags,
AttrNumber attributeNumber, RegProcedure procedure, Datum argument);
+extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, bits16 flags,
+ AttrNumber attributeNumber, FmgrInfo *finfo,
+ MemoryContext mcxt, Datum argument);
#endif /* SKEY_H */
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index d3e3bae704..52956f807b 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.39 2001/08/21 16:36:05 tgl Exp $
+ * $Id: index.h,v 1.40 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,10 +30,6 @@ typedef void (*IndexBuildCallback) (Relation index,
extern Form_pg_am AccessMethodObjectIdGetForm(Oid accessMethodObjectId,
MemoryContext resultCxt);
-extern void InitIndexStrategy(int numatts,
- Relation indexRelation,
- Oid accessMethodObjectId);
-
extern Oid index_create(char *heapRelationName,
char *indexRelationName,
IndexInfo *indexInfo,
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 44641bdcb1..0acb966f68 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: fmgr.h,v 1.14 2001/05/17 17:44:18 petere Exp $
+ * $Id: fmgr.h,v 1.15 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@ typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
* to be called multiple times, the lookup need be done only once and the
* info struct saved for re-use.
*/
-typedef struct
+typedef struct FmgrInfo
{
PGFunction fn_addr; /* pointer to function or handler to be
* called */
@@ -73,6 +73,20 @@ typedef struct FunctionCallInfoData
extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
/*
+ * Same, when the FmgrInfo struct is in a memory context longer-lived than
+ * CurrentMemoryContext. The specified context will be set as fn_mcxt
+ * and used to hold all subsidiary data of finfo.
+ */
+extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
+ MemoryContext mcxt);
+
+/*
+ * Copy an FmgrInfo struct
+ */
+extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
+ MemoryContext destcxt);
+
+/*
* This macro invokes a function given a filled-in FunctionCallInfoData
* struct. The macro result is the returned Datum --- but note that
* caller must still check fcinfo->isnull! Also, if function is strict,
@@ -341,16 +355,18 @@ extern Datum OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2,
/*
* Routines in fmgr.c
*/
-extern Pg_finfo_record *fetch_finfo_record(char *filename, char *funcname);
+extern Pg_finfo_record *fetch_finfo_record(void *filehandle, char *funcname);
extern Oid fmgr_internal_function(const char *proname);
/*
* Routines in dfmgr.c
*/
+extern char * Dynamic_library_path;
+
extern PGFunction load_external_function(char *filename, char *funcname,
- bool signalNotFound);
+ bool signalNotFound, void **filehandle);
+extern PGFunction lookup_external_function(void *filehandle, char *funcname);
extern void load_file(char *filename);
-extern char * Dynamic_library_path;
/*
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index ef74317fda..9cc7a2ecb4 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.51 2001/06/27 23:31:40 tgl Exp $
+ * $Id: rel.h,v 1.52 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,8 +23,6 @@
#include "storage/fd.h"
#include "storage/relfilenode.h"
-/* added to prevent circular dependency. bjm 1999/11/15 */
-extern char *get_temp_rel_by_physicalname(const char *relname);
/*
* LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
@@ -115,7 +113,7 @@ typedef struct RelationData
bool rd_isnailed; /* rel is nailed in cache */
bool rd_indexfound; /* true if rd_indexlist is valid */
bool rd_uniqueindex; /* true if rel is a UNIQUE index */
- Form_pg_am rd_am; /* AM tuple */
+ Form_pg_am rd_am; /* AM tuple (if an index) */
Form_pg_class rd_rel; /* RELATION tuple */
Oid rd_id; /* relation's object id */
List *rd_indexlist; /* list of OIDs of indexes on relation */
@@ -123,10 +121,16 @@ typedef struct RelationData
TupleDesc rd_att; /* tuple descriptor */
RuleLock *rd_rules; /* rewrite rules */
MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */
- IndexStrategy rd_istrat; /* info needed if rel is an index */
- RegProcedure *rd_support;
TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */
+ /* index access support info (used only for an index relation) */
+ MemoryContext rd_indexcxt; /* private memory cxt for this stuff */
+ IndexStrategy rd_istrat; /* operator strategy map */
+ RegProcedure *rd_support; /* OIDs of support procedures */
+ struct FmgrInfo *rd_supportinfo; /* lookup info for support procedures */
+ /* "struct FmgrInfo" avoids need to include fmgr.h here */
+
+ /* statistics collection area */
PgStat_Info pgstat_info;
} RelationData;
@@ -229,13 +233,6 @@ typedef Relation *RelationPtr;
#define RelationGetIndexStrategy(relation) ((relation)->rd_istrat)
/*
- * Routines in utils/cache/rel.c
- */
-extern void RelationSetIndexSupport(Relation relation,
- IndexStrategy strategy,
- RegProcedure *support);
-
-/*
* Handle temp relations
*/
#define PG_TEMP_REL_PREFIX "pg_temp"
@@ -279,5 +276,7 @@ extern void RelationSetIndexSupport(Relation relation,
RelationGetPhysicalRelationName(relation) \
)
+/* added to prevent circular dependency. bjm 1999/11/15 */
+extern char *get_temp_rel_by_physicalname(const char *relname);
#endif /* REL_H */
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h
index 160ee0f47c..861185cea9 100644
--- a/src/include/utils/relcache.h
+++ b/src/include/utils/relcache.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relcache.h,v 1.25 2001/06/29 21:08:25 tgl Exp $
+ * $Id: relcache.h,v 1.26 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,6 +33,8 @@ extern void RelationClose(Relation relation);
*/
extern List *RelationGetIndexList(Relation relation);
+extern void RelationInitIndexAccessInfo(Relation relation);
+
/*
* Routines for backend startup
*/
@@ -61,6 +63,7 @@ extern void RelationPurgeLocalRelation(bool xactComitted);
extern void RelationCacheAbort(void);
+/* XLOG support */
extern void CreateDummyCaches(void);
extern void DestroyDummyCaches(void);