Re: dynamic loading of c-functions - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: dynamic loading of c-functions
Date
Msg-id 20050721183005.GF25926@svana.org
Whole thread Raw
In response to dynamic loading of c-functions  ("TJ O'Donnell" <tjo@acm.org>)
List pgsql-general
On Thu, Jul 21, 2005 at 10:40:21AM -0700, TJ O'Donnell wrote:
> It is clear from the manual that c-functions can cause the dynamic loading
> of .so's and that subsequent usage in the same database session will use
> the already loaded function.  But, when the session is done, will the loaded
> function remain in the server for subsequent sessions?
> When/how does a dynamically loaded .so get unloaded?
> I want to avoid preloading .so's at server startup, but also avoid dynamically
> loading them for ~every~ session.

PostgreSQL uses multiple process, so when you close your connection it
releases the address space, including the loaded library. There's no
way to preserve across multiple connections.

The two options are:
- Load at server startup, then they're ready to go as soon as you
connect.  preload_libraries option.
- Dynamic loading when you use the function. Default option.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: "TJ O'Donnell"
Date:
Subject: dynamic loading of c-functions
Next
From: Scott Marlowe
Date:
Subject: Re: Converting MySQL tinyint to PostgreSQL