Joe Conway <[EMAIL PROTECTED]> writes: > 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.
A similar situation arises with mod_perl. Because perl is quite heavy-weight and systems often need lots of packages with static data it's common to load a startup.pl script that just loads lots of packages before the Apache server forks. This reduces memory usage drastically. The main gotcha is that you have to be careful about resources that you don't want shared. The typical case is database handles which are sockets that wouldn't be happy having two processes writing and reading on them. At first blush it seemed unlikely you would have a database connection in an embedded perl script. But then, hm, that would be a sly way of doing interdatabase connections. In any case there are other situations where you might want to have open file descriptors or sockets lying around. So in short, not only is it useful, but it would be valuable to allow mechanism to cause the language to load modules before forking. But there have to be prominent caveats that no such shared packages should create resources that can't be safely shared. -- greg ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])