dynamic loading of c-functions

Started by TJ O'Donnellover 20 years ago2 messagesgeneral
Jump to latest
#1TJ O'Donnell
tjo@acm.org

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.

TJ

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: TJ O'Donnell (#1)
Re: dynamic loading of c-functions

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/

Show quoted text

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.