From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | loading libraries on Postmaster startup |
Date: | 2003-02-13 04:15:24 |
Message-ID: | 3E4B1BDC.405@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
While using PL/R in a web based application, I noticed that the library
load and initialization time is significant enough to be annoying. So I
wrote a quick hack to load and initialize the library on postmaster
startup. This way, the backends get a fully initialized copy of the
interpreter when they are forked. The hack was to postmaster.c just
after the SSL initialization code at about line 650 (just remembered
this is 7.3.2 though):
if (true) /* later use startup GUC var */
{
char *fullname = "$libdir/plr.so";
char *funcname = "start_interp";
func_ptr initfunc;
initfunc = (func_ptr)
load_external_function(fullname, funcname, true, NULL);
(*initfunc)();
}
(I also had to add a #define for func_ptr)
This brings me to a couple questions:
1. Is there anything inherently dangerous with this approach?
My light testing seems to show that it works quite well for
my purpose.
2. It seems to me that other libraries such as those for PL/Tcl,
PL/Perl, etc may have the same issue. Is there any merit in
a GUC variable to allow libraries such as this to be loaded
and initialized at postmaster start? I'll generalize this and
send in a patch if there is interest.
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-02-13 04:15:29 | Re: log_duration |
Previous Message | Kevin Brown | 2003-02-13 04:10:18 | Re: log_duration |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2003-02-13 04:29:39 | Re: loading libraries on Postmaster startup |
Previous Message | greg | 2003-02-12 21:47:01 | Re: FAQ addition: deleteing all but one unique row |