summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-03-20 04:51:44 +0000
committerBruce Momjian <bruce@momjian.us>2003-03-20 04:51:44 +0000
commit15ce2d2e4a3e9ae70801a5caa07579200a66b510 (patch)
tree6adec7f9487d6af68091139a0f93c260cd54c869 /doc/src
parente733510d5d67a0b4fb1a9228df598034e487f194 (diff)
> I can see a couple possible downsides: (a) the library might have some
> weird behavior across fork boundaries; (b) the additional memory space > that has to be duplicated into child processes will cost something per > child launch, even if the child never uses it. But these are only > arguments that it might not *always* be a prudent thing to do, not that > we shouldn't give the DBA the tool to do it if he wants. So fire away. Here is a patch for the above, including a documentation update. It creates a new GUC variable "preload_libraries", that accepts a list in the form: preload_libraries = '$libdir/mylib1:initfunc,$libdir/mylib2' If ":initfunc" is omitted or not found, no initialization function is executed, but the library is still preloaded. If "$libdir/mylib" isn't found, the postmaster refuses to start. In my testing with PL/R, it reduces the first call to a PL/R function (after connecting) from almost 2 seconds, down to about 8 ms. Joe Conway
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/runtime.sgml31
1 files changed, 30 insertions, 1 deletions
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index 408c81e2ee5..0f53895fdcd 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.171 2003/03/20 03:34:55 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.172 2003/03/20 04:51:44 momjian Exp $
-->
<Chapter Id="runtime">
@@ -1800,6 +1800,35 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
</varlistentry>
<varlistentry>
+ <term><varname>PRELOAD_LIBRARIES</varname> (<type>string</type>)</term>
+ <indexterm><primary>preload_libraries</></>
+ <listitem>
+ <para>
+ This variable specifies one or more shared libraries that are to be
+ preloaded at Postmaster start. An initialization function can also be
+ optionally specified by adding a colon followed by the name of the
+ initialization function after the library name. For example
+ <literal>'$libdir/mylib:init_mylib'</literal> would cause <literal>mylib</>
+ to be preloaded and <literal>init_mylib</> to be executed. If more than
+ one library is to be loaded, they must be delimited with a comma.
+ </para>
+
+ <para>
+ If <literal>mylib</> is not found, the postmaster will fail to start.
+ However, if <literal>init_mylib</> is not found, <literal>mylib</> will
+ still be preloaded without executing the initialization function.
+ </para>
+
+ <para>
+ By preloading a shared library (and initializing it if applicable),
+ the library startup time is avoided when the library is used later in a
+ specific backend. However there is a cost in terms of memory duplication
+ as every backend is forked, whether or not the library is used.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>REGEX_FLAVOR</varname> (<type>string</type>)</term>
<indexterm><primary>regular expressions</></>
<listitem>