Re: dynamic loading of c-functions

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: TJ O'Donnell <tjo(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dynamic loading of c-functions
Date: 2005-07-21 18:30:05
Message-ID: 20050721183005.GF25926@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-07-21 19:01:28 Re: Converting MySQL tinyint to PostgreSQL
Previous Message TJ O'Donnell 2005-07-21 17:40:21 dynamic loading of c-functions