diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-10-06 23:21:45 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-10-06 23:21:45 +0000 |
| commit | 85801a4dbdee22f230637311681b8b03a72979db (patch) | |
| tree | 28054ba90fda332be0d5254e5bdaba5a2a51f1f2 /src/backend/utils/cache/fcache.c | |
| parent | a965750abf2504e266e5071dc90365be9485395a (diff) | |
| download | postgresql-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/fcache.c')
| -rw-r--r-- | src/backend/utils/cache/fcache.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c index bb1ac36f3e..92cf46a036 100644 --- a/src/backend/utils/cache/fcache.c +++ b/src/backend/utils/cache/fcache.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.40 2001/09/21 00:11:31 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.41 2001/10/06 23:21:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,26 +23,22 @@ FunctionCachePtr init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt) { - MemoryContext oldcontext; FunctionCachePtr retval; /* Safety check (should never fail, as parser should check sooner) */ if (nargs > FUNC_MAX_ARGS) elog(ERROR, "init_fcache: too many arguments"); - /* Switch to a context long-lived enough for the fcache entry */ - oldcontext = MemoryContextSwitchTo(fcacheCxt); - - retval = (FunctionCachePtr) palloc(sizeof(FunctionCache)); + /* Create fcache entry in the desired context */ + retval = (FunctionCachePtr) MemoryContextAlloc(fcacheCxt, + sizeof(FunctionCache)); MemSet(retval, 0, sizeof(FunctionCache)); /* Set up the primary fmgr lookup information */ - fmgr_info(foid, &(retval->func)); + fmgr_info_cxt(foid, &(retval->func), fcacheCxt); /* Initialize additional info */ retval->setArgsValid = false; - MemoryContextSwitchTo(oldcontext); - return retval; } |
