@@ -1252,66 +1252,6 @@ include 'filename'
12521252 </para>
12531253 </listitem>
12541254 </varlistentry>
1255-
1256- <varlistentry id="guc-shared-preload-libraries" xreflabel="shared_preload_libraries">
1257- <term><varname>shared_preload_libraries</varname> (<type>string</type>)</term>
1258- <indexterm>
1259- <primary><varname>shared_preload_libraries</> configuration parameter</primary>
1260- </indexterm>
1261- <listitem>
1262- <para>
1263- This variable specifies one or more shared libraries
1264- to be preloaded at server start. For example,
1265- <literal>'$libdir/mylib'</literal> would cause
1266- <literal>mylib.so</> (or on some platforms,
1267- <literal>mylib.sl</>) to be preloaded from the installation's
1268- standard library directory.
1269- All library names are converted to lower case unless double-quoted.
1270- If more than one library is to be loaded, separate their names
1271- with commas. This parameter can only be set at server start.
1272- </para>
1273-
1274- <para>
1275- <productname>PostgreSQL</productname> procedural language
1276- libraries can be preloaded in this way, typically by using the
1277- syntax <literal>'$libdir/plXXX'</literal> where
1278- <literal>XXX</literal> is <literal>pgsql</>, <literal>perl</>,
1279- <literal>tcl</>, or <literal>python</>.
1280- </para>
1281-
1282- <para>
1283- By preloading a shared library, the library startup time is avoided
1284- when the library is first used. However, the time to start each new
1285- server process might increase slightly, even if that process never
1286- uses the library. So this parameter is recommended only for
1287- libraries that will be used in most sessions.
1288- </para>
1289-
1290- <note>
1291- <para>
1292- On Windows hosts, preloading a library at server start will not reduce
1293- the time required to start each new server process; each server process
1294- will re-load all preload libraries. However, <varname>shared_preload_libraries
1295- </varname> is still useful on Windows hosts because some shared libraries may
1296- need to perform certain operations that only take place at postmaster start
1297- (for example, a shared library may need to reserve lightweight locks
1298- or shared memory and you can't do that after the postmaster has started).
1299- </para>
1300- </note>
1301- <para>
1302- If a specified library is not found,
1303- the server will fail to start.
1304- </para>
1305-
1306- <para>
1307- Every PostgreSQL-supported library has a <quote>magic
1308- block</> that is checked to guarantee compatibility.
1309- For this reason, non-PostgreSQL libraries cannot be
1310- loaded in this way.
1311- </para>
1312- </listitem>
1313- </varlistentry>
1314-
13151255 </variablelist>
13161256 </sect2>
13171257
@@ -5514,6 +5454,171 @@ SET XML OPTION { DOCUMENT | CONTENT };
55145454 </variablelist>
55155455
55165456 </sect2>
5457+
5458+ <sect2 id="runtime-config-client-preload">
5459+ <title>Shared Library Preloading</title>
5460+
5461+ <para>
5462+ Several settings are available for preloading shared libraries into the
5463+ server, in order to load additional functionality or achieve performance
5464+ benefits. For example, a setting of
5465+ <literal>'$libdir/mylib'</literal> would cause
5466+ <literal>mylib.so</> (or on some platforms,
5467+ <literal>mylib.sl</>) to be preloaded from the installation's standard
5468+ library directory. The differences between the settings are when they
5469+ take effect and what privileges are required to change them.
5470+ </para>
5471+
5472+ <para>
5473+ <productname>PostgreSQL</productname> procedural language libraries can
5474+ be preloaded in this way, typically by using the
5475+ syntax <literal>'$libdir/plXXX'</literal> where
5476+ <literal>XXX</literal> is <literal>pgsql</>, <literal>perl</>,
5477+ <literal>tcl</>, or <literal>python</>.
5478+ </para>
5479+
5480+ <para>
5481+ For each parameter, if more than one library is to be loaded, separate
5482+ their names with commas. All library names are converted to lower case
5483+ unless double-quoted.
5484+ </para>
5485+
5486+ <para>
5487+ Only shared libraries specifically intended to be used with PostgreSQL
5488+ can be loaded this way. Every PostgreSQL-supported library has
5489+ a <quote>magic block</> that is checked to guarantee compatibility. For
5490+ this reason, non-PostgreSQL libraries cannot be loaded in this way. You
5491+ might be able to use operating-system facilities such
5492+ as <envar>LD_PRELOAD</envar> for that.
5493+ </para>
5494+
5495+ <para>
5496+ In general, refer to the documentation of a specific module for the
5497+ recommended way to load that module.
5498+ </para>
5499+
5500+ <variablelist>
5501+ <varlistentry id="guc-local-preload-libraries" xreflabel="local_preload_libraries">
5502+ <term><varname>local_preload_libraries</varname> (<type>string</type>)</term>
5503+ <indexterm>
5504+ <primary><varname>local_preload_libraries</> configuration parameter</primary>
5505+ </indexterm>
5506+ <indexterm>
5507+ <primary><filename>$libdir/plugins</></primary>
5508+ </indexterm>
5509+ <listitem>
5510+ <para>
5511+ This variable specifies one or more shared libraries that are to be
5512+ preloaded at connection start. This parameter cannot be changed after
5513+ the start of a particular session. If a specified library is not
5514+ found, the connection attempt will fail.
5515+ </para>
5516+
5517+ <para>
5518+ This option can be set by any user. Because of that, the libraries
5519+ that can be loaded are restricted to those appearing in the
5520+ <filename>plugins</> subdirectory of the installation's
5521+ standard library directory. (It is the database administrator's
5522+ responsibility to ensure that only <quote>safe</> libraries
5523+ are installed there.) Entries in <varname>local_preload_libraries</>
5524+ can specify this directory explicitly, for example
5525+ <literal>$libdir/plugins/mylib</literal>, or just specify
5526+ the library name — <literal>mylib</literal> would have
5527+ the same effect as <literal>$libdir/plugins/mylib</literal>.
5528+ </para>
5529+
5530+ <para>
5531+ Unless a module is specifically designed to be used in this way by
5532+ non-superusers, this is usually not the right setting to use. Look
5533+ at <xref linkend="guc-session-preload-libraries"> instead.
5534+ </para>
5535+ </listitem>
5536+ </varlistentry>
5537+
5538+
5539+ <varlistentry id="guc-session-preload-libraries" xreflabel="session_preload_libraries">
5540+ <term><varname>session_preload_libraries</varname> (<type>string</type>)</term>
5541+ <indexterm>
5542+ <primary><varname>session_preload_libraries</> configuration parameter</primary>
5543+ </indexterm>
5544+ <listitem>
5545+ <para>
5546+ This variable specifies one or more shared libraries that are to be
5547+ preloaded at connection start. Only superusers can change this setting.
5548+ The parameter value only takes effect at the start of the connection.
5549+ Subsequent changes have no effect. If a specified library is not
5550+ found, the connection attempt will fail.
5551+ </para>
5552+
5553+ <para>
5554+ The intent of this feature is to allow debugging or
5555+ performance-measurement libraries to be loaded into specific sessions
5556+ without an explicit
5557+ <command>LOAD</> command being given. For
5558+ example, <xref linkend="auto-explain"> could be enabled for all
5559+ sessions under a given user name by setting this parameter
5560+ with <command>ALTER ROLE SET</>. Also, this parameter can be changed
5561+ without restarting the server (but changes only take effect when a new
5562+ session is started), so it is easier to add new modules this way, even
5563+ if they should apply to all sessions.
5564+ </para>
5565+
5566+ <para>
5567+ Unlike <xref linkend="guc-shared-preload-libraries">, there is no large
5568+ performance advantage to loading a library at session start rather than
5569+ when it is first used. There is some advantage, however, when
5570+ connection pooling is used.
5571+ </para>
5572+ </listitem>
5573+ </varlistentry>
5574+
5575+ <varlistentry id="guc-shared-preload-libraries" xreflabel="shared_preload_libraries">
5576+ <term><varname>shared_preload_libraries</varname> (<type>string</type>)</term>
5577+ <indexterm>
5578+ <primary><varname>shared_preload_libraries</> configuration parameter</primary>
5579+ </indexterm>
5580+ <listitem>
5581+ <para>
5582+ This variable specifies one or more shared libraries to be preloaded at
5583+ server start. with commas. This parameter can only be set at server
5584+ start. If a specified library is not found, the server will fail to
5585+ start.
5586+ </para>
5587+
5588+ <para>
5589+ Some libraries need to perform certain operations that can only take
5590+ place at postmaster start, such as allocating shared memory, reserving
5591+ light-weight locks, or starting background workers. Those libraries
5592+ must be loaded at server start through this parameter. See the
5593+ documentation of each library for details.
5594+ </para>
5595+
5596+ <para>
5597+ Other libraries can also be preloaded. By preloading a shared library,
5598+ the library startup time is avoided when the library is first used.
5599+ However, the time to start each new server process might increase
5600+ slightly, even if that process never uses the library. So this
5601+ parameter is recommended only for libraries that will be used in most
5602+ sessions. Also, changing this parameter requires a server restart, so
5603+ this is not the right setting to use for short-term debugging tasks,
5604+ say. Use <xref linkend="guc-session-preload-libraries"> for that
5605+ instead.
5606+ </para>
5607+
5608+ <note>
5609+ <para>
5610+ On Windows hosts, preloading a library at server start will not reduce
5611+ the time required to start each new server process; each server process
5612+ will re-load all preload libraries. However, <varname>shared_preload_libraries
5613+ </varname> is still useful on Windows hosts for libraries that need to
5614+ perform operations at postmaster start time..
5615+ </para>
5616+ </note>
5617+ </listitem>
5618+ </varlistentry>
5619+ </variablelist>
5620+ </sect2>
5621+
55175622 <sect2 id="runtime-config-client-other">
55185623 <title>Other Defaults</title>
55195624
@@ -5585,62 +5690,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
55855690 </listitem>
55865691 </varlistentry>
55875692
5588- <varlistentry id="guc-local-preload-libraries" xreflabel="local_preload_libraries">
5589- <term><varname>local_preload_libraries</varname> (<type>string</type>)</term>
5590- <indexterm>
5591- <primary><varname>local_preload_libraries</> configuration parameter</primary>
5592- </indexterm>
5593- <indexterm>
5594- <primary><filename>$libdir/plugins</></primary>
5595- </indexterm>
5596- <listitem>
5597- <para>
5598- This variable specifies one or more shared libraries that are
5599- to be preloaded at connection start. If more than one library
5600- is to be loaded, separate their names with commas. All library
5601- names are converted to lower case unless double-quoted.
5602- This parameter cannot be changed after the start of a particular
5603- session.
5604- </para>
5605-
5606- <para>
5607- Because this is not a superuser-only option, the libraries
5608- that can be loaded are restricted to those appearing in the
5609- <filename>plugins</> subdirectory of the installation's
5610- standard library directory. (It is the database administrator's
5611- responsibility to ensure that only <quote>safe</> libraries
5612- are installed there.) Entries in <varname>local_preload_libraries</>
5613- can specify this directory explicitly, for example
5614- <literal>$libdir/plugins/mylib</literal>, or just specify
5615- the library name — <literal>mylib</literal> would have
5616- the same effect as <literal>$libdir/plugins/mylib</literal>.
5617- </para>
5618-
5619- <para>
5620- Unlike <xref linkend="guc-shared-preload-libraries">, there is no
5621- performance advantage to loading a library at session
5622- start rather than when it is first used. Rather, the intent of
5623- this feature is to allow debugging or performance-measurement
5624- libraries to be loaded into specific sessions without an explicit
5625- <command>LOAD</> command being given. For example, debugging could
5626- be enabled for all sessions under a given user name by setting
5627- this parameter with <command>ALTER ROLE SET</>.
5628- </para>
5629-
5630- <para>
5631- If a specified library is not found,
5632- the connection attempt will fail.
5633- </para>
5634-
5635- <para>
5636- Every PostgreSQL-supported library has a <quote>magic
5637- block</> that is checked to guarantee compatibility.
5638- For this reason, non-PostgreSQL libraries cannot be
5639- loaded in this way.
5640- </para>
5641- </listitem>
5642- </varlistentry>
5643-
56445693 </variablelist>
56455694 </sect2>
56465695 </sect1>
0 commit comments