summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/catcache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-10-06 23:21:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-10-06 23:21:45 +0000
commit85801a4dbdee22f230637311681b8b03a72979db (patch)
tree28054ba90fda332be0d5254e5bdaba5a2a51f1f2 /src/backend/utils/cache/catcache.c
parenta965750abf2504e266e5071dc90365be9485395a (diff)
downloadpostgresql-85801a4dbdee22f230637311681b8b03a72979db.tar.gz
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/backend/utils/cache/catcache.c')
-rw-r--r--src/backend/utils/cache/catcache.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index ce4363706b..77112a694e 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.82 2001/08/21 16:36:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.83 2001/10/06 23:21:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -269,23 +269,10 @@ CatalogCacheInitializeCache(CatCache *cache)
*/
cache->cc_skey[i].sk_procedure = EQPROC(keytype);
- /*
- * Note: to avoid any possible leakage of scan temporary data into
- * the cache context, we do not switch into CacheMemoryContext while
- * calling fmgr_info here. Instead set fn_mcxt on return. This
- * would fail to work correctly if fmgr_info allocated any subsidiary
- * data structures to attach to the FmgrInfo record; but it doesn't
- * do so for built-in functions, and all the comparator functions
- * for system caches should most assuredly be built-in functions.
- * Currently there's no real need to fix fn_mcxt either, but let's do
- * that anyway just to make sure it's not pointing to a dead context
- * later on.
- */
-
- fmgr_info(cache->cc_skey[i].sk_procedure,
- &cache->cc_skey[i].sk_func);
-
- cache->cc_skey[i].sk_func.fn_mcxt = CacheMemoryContext;
+ /* Do function lookup */
+ fmgr_info_cxt(cache->cc_skey[i].sk_procedure,
+ &cache->cc_skey[i].sk_func,
+ CacheMemoryContext);
/* Initialize sk_attno suitably for HeapKeyTest() and heap scans */
cache->cc_skey[i].sk_attno = cache->cc_key[i];