mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +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:
@@ -33,7 +33,7 @@
|
||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.22 2001/06/18 21:40:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.23 2001/10/06 23:21:44 tgl Exp $
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
@@ -171,18 +171,14 @@ static void plperl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
Reference in New Issue
Block a user