1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

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.
This commit is contained in:
Tom Lane
2001-10-06 23:21:45 +00:00
parent a965750abf
commit 85801a4dbd
31 changed files with 424 additions and 390 deletions

View File

@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.7 2001/10/04 15:45:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.8 2001/10/06 23:21:45 tgl Exp $
*
*********************************************************************
*/
@ -308,18 +308,14 @@ volatile int func_leave_calls = 0;
* data structures such as fmgr info records therefore must live forever
* as well. A better implementation would store all this stuff in a per-
* function memory context that could be reclaimed at need. In the meantime,
* fmgr_info must be called in TopMemoryContext so that whatever it might
* allocate, and whatever the eventual function might allocate using fn_mcxt,
* will live forever too.
* fmgr_info_cxt must be called specifying TopMemoryContext so that whatever
* it might allocate, and whatever the eventual function might allocate using
* fn_mcxt, will live forever too.
*/
static void
perm_fmgr_info(Oid functionId, FmgrInfo *finfo)
{
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
fmgr_info(functionId, finfo);
MemoryContextSwitchTo(oldcontext);
fmgr_info_cxt(functionId, finfo, TopMemoryContext);
}