Re: [BUGS] Patch to allow C extension modules to initialize/finish - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: [BUGS] Patch to allow C extension modules to initialize/finish
Date
Msg-id 87mzakqdsb.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: [BUGS] Patch to allow C extension modules to initialize/finish  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] Patch to allow C extension modules to initialize/finish
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> No, my thought is that you'd rename PL/R's init function to PG_init, and
> then it'd get called automagically without needing to assume that the DBA
> remembers to specify it in preload_libraries.  If there's a reason *not*
> to do that then it'd be a strike against this whole proposal, methinks.

If I understand the question correctly it hinges on whether you want to do all
the initialization pre-fork or post-fork? I'm pretty sure you have to allow
for both possibilities.

I know when I was using mod_perl heavily we wanted to load as many perl
modules and code pre-fork as possible. The more we loaded pre-fork the more
memory was shared across processes and the more processes we could run on a
box without suffering from memory pressure.

On the other side the classic case of something that cannot be set up pre-fork
is actually database connections :) So, for example if for someone wanted to
have a persistent Oracle connection they could not open it pre-fork at library
load time but they might want to open it immediately after the fork rather
than when it's first used.


--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: 8.2 features status
Next
From: Lukas Smith
Date:
Subject: Re: 8.2 features status