]> granicus.if.org Git - postgresql/blob - doc/src/sgml/config.sgml
3a843217602d5debe3a53af4ba75239d0235a743
[postgresql] / doc / src / sgml / config.sgml
1 <!-- doc/src/sgml/config.sgml -->
2
3 <chapter id="runtime-config">
4   <title>Server Configuration</title>
5
6   <indexterm>
7    <primary>configuration</primary>
8    <secondary>of the server</secondary>
9   </indexterm>
10
11   <para>
12    There are many configuration parameters that affect the behavior of
13    the database system. In the first section of this chapter, we
14    describe how to set configuration parameters. The subsequent sections
15    discuss each parameter in detail.
16   </para>
17
18   <sect1 id="config-setting">
19    <title>Setting Parameters</title>
20
21    <para>
22     All parameter names are case-insensitive. Every parameter takes a
23     value of one of five types: Boolean, integer, floating point,
24     string or enum. Boolean values can be written as <literal>on</literal>,
25     <literal>off</literal>, <literal>true</literal>,
26     <literal>false</literal>, <literal>yes</literal>,
27     <literal>no</literal>, <literal>1</literal>, <literal>0</literal>
28     (all case-insensitive) or any unambiguous prefix of these.
29    </para>
30
31    <para>
32     Some settings specify a memory or time value.  Each of these has an
33     implicit unit, which is either kilobytes, blocks (typically eight
34     kilobytes), milliseconds, seconds, or minutes.  Default units can be
35     found by referencing <structname>pg_settings</>.<structfield>unit</>.
36     For convenience,
37     a different unit can also be specified explicitly.  Valid memory units
38     are <literal>kB</literal> (kilobytes), <literal>MB</literal>
39     (megabytes), and <literal>GB</literal> (gigabytes); valid time units
40     are <literal>ms</literal> (milliseconds), <literal>s</literal>
41     (seconds), <literal>min</literal> (minutes), <literal>h</literal>
42     (hours), and <literal>d</literal> (days).  Note that the multiplier
43     for memory units is 1024, not 1000.
44    </para>
45
46    <para>
47     Parameters of type <quote>enum</> are specified in the same way as string
48     parameters, but are restricted to a limited set of values.  The allowed
49     values can be found
50     from <structname>pg_settings</>.<structfield>enumvals</>.
51     Enum parameter values are case-insensitive.
52    </para>
53
54    <para>
55     One way to set these parameters is to edit the file
56     <filename>postgresql.conf</><indexterm><primary>postgresql.conf</></>,
57     which is normally kept in the data directory.  (A default copy is
58     installed there when the database cluster directory is
59     initialized.)  An example of what this file might look like is:
60 <programlisting>
61 # This is a comment
62 log_connections = yes
63 log_destination = 'syslog'
64 search_path = '"$user", public'
65 shared_buffers = 128MB
66 </programlisting>
67     One parameter is specified per line. The equal sign between name and
68     value is optional. Whitespace is insignificant and blank lines are
69     ignored. Hash marks (<literal>#</literal>) designate the rest of the
70     line as a comment.  Parameter values that are not simple identifiers or
71     numbers must be single-quoted.  To embed a single quote in a parameter
72     value, write either two quotes (preferred) or backslash-quote.
73    </para>
74
75    <para>
76     <indexterm>
77      <primary><literal>include</></primary>
78      <secondary>in configuration file</secondary>
79     </indexterm>
80     In addition to parameter settings, the <filename>postgresql.conf</>
81     file can contain <firstterm>include directives</>, which specify
82     another file to read and process as if it were inserted into the
83     configuration file at this point.  Include directives simply look like:
84 <programlisting>
85 include 'filename'
86 </programlisting>
87     If the file name is not an absolute path, it is taken as relative to
88     the directory containing the referencing configuration file.
89     Inclusions can be nested.
90    </para>
91
92    <para>
93     <indexterm>
94      <primary><literal>include_if_exists</></primary>
95      <secondary>in configuration file</secondary>
96     </indexterm>
97     Use the same approach as the <literal>include</> directive, continuing
98     normally if the file does not exist.  A regular <literal>include</>
99     will stop with an error if the referenced file is missing, while
100     <literal>include_if_exists</> does not.  A warning about the missing
101     file will be logged.
102    </para>
103
104    <para>
105     <indexterm>
106      <primary>SIGHUP</primary>
107     </indexterm>
108     The configuration file is reread whenever the main server process receives a
109     <systemitem>SIGHUP</> signal (which is most easily sent by means
110     of <literal>pg_ctl reload</>). The main server process
111     also propagates this signal to all currently running server
112     processes so that existing sessions also get the new
113     value. Alternatively, you can send the signal to a single server
114     process directly.  Some parameters can only be set at server start;
115     any changes to their entries in the configuration file will be ignored
116     until the server is restarted.  Invalid parameter settings in the
117     configuration file are likewise ignored (but logged) during
118     <systemitem>SIGHUP</> processing.
119    </para>
120
121    <para>
122     A second way to set these configuration parameters is to give them
123     as a command-line option to the <command>postgres</command> command, such as:
124 <programlisting>
125 postgres -c log_connections=yes -c log_destination='syslog'
126 </programlisting>
127     Command-line options override any conflicting settings in
128     <filename>postgresql.conf</filename>.  Note that this means you won't
129     be able to change the value on-the-fly by editing
130     <filename>postgresql.conf</filename>, so while the command-line
131     method might be convenient, it can cost you flexibility later.
132    </para>
133
134    <para>
135     Occasionally it is useful to give a command line option to
136     one particular session only. The environment variable
137     <envar>PGOPTIONS</envar> can be used for this purpose on the
138     client side:
139 <programlisting>
140 env PGOPTIONS='-c geqo=off' psql
141 </programlisting>
142     (This works for any <application>libpq</>-based client application, not
143     just <application>psql</application>.) Note that this won't work for
144     parameters that are fixed when the server is started or that must be
145     specified in <filename>postgresql.conf</filename>.
146    </para>
147
148    <para>
149     Furthermore, it is possible to assign a set of parameter settings to
150     a user or a database.  Whenever a session is started, the default
151     settings for the user and database involved are loaded.  The
152     commands <xref linkend="sql-alterrole">
153     and <xref linkend="sql-alterdatabase">,
154     respectively, are used to configure these settings.  Per-database
155     settings override anything received from the
156     <command>postgres</command> command-line or the configuration
157     file, and in turn are overridden by per-user settings; both are
158     overridden by per-session settings.
159    </para>
160
161    <para>
162     Some parameters can be changed in individual <acronym>SQL</acronym>
163     sessions with the <xref linkend="SQL-SET">
164     command, for example:
165 <screen>
166 SET ENABLE_SEQSCAN TO OFF;
167 </screen>
168     If <command>SET</> is allowed, it overrides all other sources of
169     values for the parameter. Some parameters cannot be changed via
170     <command>SET</command>: for example, if they control behavior that
171     cannot be changed without restarting the entire
172     <productname>PostgreSQL</productname> server.  Also,
173     some <command>SET</command> or <command>ALTER</> parameter modifications
174     require superuser permission.
175    </para>
176
177    <para>
178     The <xref linkend="SQL-SHOW">
179     command allows inspection of the current values of all parameters.
180    </para>
181
182    <para>
183     The virtual table <structname>pg_settings</structname> also allows
184     displaying and updating session run-time parameters;  see <xref
185     linkend="view-pg-settings"> for details and a description of the
186     different variable types and when they can be changed.
187     <structname>pg_settings</structname> is equivalent to <command>SHOW</>
188     and <command>SET</>, but can be more convenient
189     to use because it can be joined with other tables, or selected from using
190     any desired selection condition. It also contains more information about
191     what values are allowed for the parameters.
192    </para>
193   </sect1>
194
195    <sect1 id="runtime-config-file-locations">
196     <title>File Locations</title>
197
198      <para>
199       In addition to the <filename>postgresql.conf</filename> file
200       already mentioned, <productname>PostgreSQL</productname> uses
201       two other manually-edited configuration files, which control
202       client authentication (their use is discussed in <xref
203       linkend="client-authentication">).  By default, all three
204       configuration files are stored in the database cluster's data
205       directory.  The parameters described in this section allow the
206       configuration files to be placed elsewhere.  (Doing so can ease
207       administration.  In particular it is often easier to ensure that
208       the configuration files are properly backed-up when they are
209       kept separate.)
210      </para>
211
212      <variablelist>
213      <varlistentry id="guc-data-directory" xreflabel="data_directory">
214       <term><varname>data_directory</varname> (<type>string</type>)</term>
215       <indexterm>
216        <primary><varname>data_directory</> configuration parameter</primary>
217       </indexterm>
218       <listitem>
219        <para>
220          Specifies the directory to use for data storage.
221          This parameter can only be set at server start.
222        </para>
223       </listitem>
224      </varlistentry>
225
226      <varlistentry id="guc-config-file" xreflabel="config_file">
227       <term><varname>config_file</varname> (<type>string</type>)</term>
228       <indexterm>
229        <primary><varname>config_file</> configuration parameter</primary>
230       </indexterm>
231       <listitem>
232        <para>
233          Specifies the main server configuration file
234          (customarily called <filename>postgresql.conf</>).
235          This parameter can only be set on the <command>postgres</command> command line.
236        </para>
237       </listitem>
238      </varlistentry>
239
240      <varlistentry id="guc-hba-file" xreflabel="hba_file">
241       <term><varname>hba_file</varname> (<type>string</type>)</term>
242       <indexterm>
243        <primary><varname>hba_file</> configuration parameter</primary>
244       </indexterm>
245       <listitem>
246        <para>
247          Specifies the configuration file for host-based authentication
248          (customarily called <filename>pg_hba.conf</>).
249          This parameter can only be set at server start.
250        </para>
251       </listitem>
252      </varlistentry>
253
254      <varlistentry id="guc-ident-file" xreflabel="ident_file">
255       <term><varname>ident_file</varname> (<type>string</type>)</term>
256       <indexterm>
257        <primary><varname>ident_file</> configuration parameter</primary>
258       </indexterm>
259       <listitem>
260        <para>
261          Specifies the configuration file for
262          <xref linkend="auth-username-maps"> user name mapping
263          (customarily called <filename>pg_ident.conf</>).
264          This parameter can only be set at server start.
265        </para>
266       </listitem>
267      </varlistentry>
268
269      <varlistentry id="guc-external-pid-file" xreflabel="external_pid_file">
270       <term><varname>external_pid_file</varname> (<type>string</type>)</term>
271       <indexterm>
272        <primary><varname>external_pid_file</> configuration parameter</primary>
273       </indexterm>
274       <listitem>
275        <para>
276         Specifies the name of an additional process-ID (PID) file that the
277         server should create for use by server administration programs.
278         This parameter can only be set at server start.
279        </para>
280       </listitem>
281      </varlistentry>
282      </variablelist>
283
284      <para>
285       In a default installation, none of the above parameters are set
286       explicitly.  Instead, the
287       data directory is specified by the <option>-D</option> command-line
288       option or the <envar>PGDATA</envar> environment variable, and the
289       configuration files are all found within the data directory.
290      </para>
291
292      <para>
293       If you wish to keep the configuration files elsewhere than the
294       data directory, the <command>postgres</command> <option>-D</option>
295       command-line option or <envar>PGDATA</envar> environment variable
296       must point to the directory containing the configuration files,
297       and the <varname>data_directory</> parameter must be set in
298       <filename>postgresql.conf</filename> (or on the command line) to show
299       where the data directory is actually located.  Notice that
300       <varname>data_directory</> overrides <option>-D</option> and
301       <envar>PGDATA</envar> for the location
302       of the data directory, but not for the location of the configuration
303       files.
304      </para>
305
306      <para>
307       If you wish, you can specify the configuration file names and locations
308       individually using the parameters <varname>config_file</>,
309       <varname>hba_file</> and/or <varname>ident_file</>.
310       <varname>config_file</> can only be specified on the
311       <command>postgres</command> command line, but the others can be
312       set within the main configuration file.  If all three parameters plus
313       <varname>data_directory</> are explicitly set, then it is not necessary
314       to specify <option>-D</option> or <envar>PGDATA</envar>.
315      </para>
316
317      <para>
318       When setting any of these parameters, a relative path will be interpreted
319       with respect to the directory in which <command>postgres</command>
320       is started.
321      </para>
322    </sect1>
323
324    <sect1 id="runtime-config-connection">
325     <title>Connections and Authentication</title>
326
327     <sect2 id="runtime-config-connection-settings">
328      <title>Connection Settings</title>
329
330      <variablelist>
331
332      <varlistentry id="guc-listen-addresses" xreflabel="listen_addresses">
333       <term><varname>listen_addresses</varname> (<type>string</type>)</term>
334       <indexterm>
335        <primary><varname>listen_addresses</> configuration parameter</primary>
336       </indexterm>
337       <listitem>
338        <para>
339          Specifies the TCP/IP address(es) on which the server is
340          to listen for connections from client applications.
341          The value takes the form of a comma-separated list of host names
342          and/or numeric IP addresses.  The special entry <literal>*</>
343          corresponds to all available IP interfaces.  The entry
344          <literal>0.0.0.0</> allows listening for all IPv4 addresses and
345          <literal>::</> allows listening for all IPv6 addresses.
346          If the list is empty, the server does not listen on any IP interface
347          at all, in which case only Unix-domain sockets can be used to connect
348          to it.
349          The default value is <systemitem class="systemname">localhost</>,
350          which allows only local TCP/IP <quote>loopback</> connections to be
351          made.  While client authentication (<xref
352          linkend="client-authentication">) allows fine-grained control
353          over who can access the server, <varname>listen_addresses</varname>
354          controls which interfaces accept connection attempts, which
355          can help prevent repeated malicious connection requests on
356          insecure network interfaces.  This parameter can only be set
357          at server start.
358        </para>
359       </listitem>
360      </varlistentry>
361
362      <varlistentry id="guc-port" xreflabel="port">
363       <term><varname>port</varname> (<type>integer</type>)</term>
364       <indexterm>
365        <primary><varname>port</> configuration parameter</primary>
366       </indexterm>
367       <listitem>
368        <para>
369         The TCP port the server listens on; 5432 by default.  Note that the
370         same port number is used for all IP addresses the server listens on.
371         This parameter can only be set at server start.
372        </para>
373       </listitem>
374      </varlistentry>
375
376      <varlistentry id="guc-max-connections" xreflabel="max_connections">
377       <term><varname>max_connections</varname> (<type>integer</type>)</term>
378       <indexterm>
379        <primary><varname>max_connections</> configuration parameter</primary>
380       </indexterm>
381       <listitem>
382        <para>
383         Determines the maximum number of concurrent connections to the
384         database server. The default is typically 100 connections, but
385         might be less if your kernel settings will not support it (as
386         determined during <application>initdb</>).  This parameter can
387         only be set at server start.
388        </para>
389
390        <para>
391         Increasing this parameter might cause <productname>PostgreSQL</>
392         to request more <systemitem class="osname">System V</> shared
393         memory or semaphores than your operating system's default configuration
394         allows. See <xref linkend="sysvipc"> for information on how to
395         adjust those parameters, if necessary.
396        </para>
397
398        <para>
399         When running a standby server, you must set this parameter to the
400         same or higher value than on the master server. Otherwise, queries
401         will not be allowed in the standby server.
402        </para>
403       </listitem>
404      </varlistentry>
405
406      <varlistentry id="guc-superuser-reserved-connections"
407      xreflabel="superuser_reserved_connections">
408       <term><varname>superuser_reserved_connections</varname>
409       (<type>integer</type>)</term>
410       <indexterm>
411        <primary><varname>superuser_reserved_connections</> configuration parameter</primary>
412       </indexterm>
413       <listitem>
414        <para>
415         Determines the number of connection <quote>slots</quote> that
416         are reserved for connections by <productname>PostgreSQL</>
417         superusers.  At most <xref linkend="guc-max-connections">
418         connections can ever be active simultaneously.  Whenever the
419         number of active concurrent connections is at least
420         <varname>max_connections</> minus
421         <varname>superuser_reserved_connections</varname>, new
422         connections will be accepted only for superusers, and no
423         new replication connections will be accepted.
424        </para>
425
426        <para>
427         The default value is three connections. The value must be less
428         than the value of <varname>max_connections</varname>. This
429         parameter can only be set at server start.
430        </para>
431       </listitem>
432      </varlistentry>
433
434      <varlistentry id="guc-unix-socket-directory" xreflabel="unix_socket_directory">
435       <term><varname>unix_socket_directory</varname> (<type>string</type>)</term>
436       <indexterm>
437        <primary><varname>unix_socket_directory</> configuration parameter</primary>
438       </indexterm>
439       <listitem>
440        <para>
441         Specifies the directory of the Unix-domain socket on which the
442         server is to listen for
443         connections from client applications.  The default is normally
444         <filename>/tmp</filename>, but can be changed at build time.
445         This parameter can only be set at server start.
446        </para>
447
448        <para>
449         In addition to the socket file itself, which is named
450         <literal>.s.PGSQL.<replaceable>nnnn</></literal> where
451         <replaceable>nnnn</> is the server's port number, an ordinary file
452         named <literal>.s.PGSQL.<replaceable>nnnn</>.lock</literal> will be
453         created in the <varname>unix_socket_directory</> directory.  Neither
454         file should ever be removed manually.
455        </para>
456
457        <para>
458         This parameter is irrelevant on Windows, which does not have
459         Unix-domain sockets.
460        </para>
461       </listitem>
462      </varlistentry>
463
464      <varlistentry id="guc-unix-socket-group" xreflabel="unix_socket_group">
465       <term><varname>unix_socket_group</varname> (<type>string</type>)</term>
466       <indexterm>
467        <primary><varname>unix_socket_group</> configuration parameter</primary>
468       </indexterm>
469       <listitem>
470        <para>
471         Sets the owning group of the Unix-domain socket.  (The owning
472         user of the socket is always the user that starts the
473         server.)  In combination with the parameter
474         <varname>unix_socket_permissions</varname> this can be used as
475         an additional access control mechanism for Unix-domain connections.
476         By default this is the empty string, which uses the default
477         group of the server user.  This parameter can only be set at
478         server start.
479        </para>
480
481        <para>
482         This parameter is irrelevant on Windows, which does not have
483         Unix-domain sockets.
484        </para>
485       </listitem>
486      </varlistentry>
487
488      <varlistentry id="guc-unix-socket-permissions" xreflabel="unix_socket_permissions">
489       <term><varname>unix_socket_permissions</varname> (<type>integer</type>)</term>
490       <indexterm>
491        <primary><varname>unix_socket_permissions</> configuration parameter</primary>
492       </indexterm>
493       <listitem>
494        <para>
495         Sets the access permissions of the Unix-domain socket.  Unix-domain
496         sockets use the usual Unix file system permission set.
497         The parameter value is expected to be a numeric mode
498         specified in the format accepted by the
499         <function>chmod</function> and <function>umask</function>
500         system calls.  (To use the customary octal format the number
501         must start with a <literal>0</literal> (zero).)
502        </para>
503
504        <para>
505         The default permissions are <literal>0777</literal>, meaning
506         anyone can connect. Reasonable alternatives are
507         <literal>0770</literal> (only user and group, see also
508         <varname>unix_socket_group</varname>) and <literal>0700</literal>
509         (only user). (Note that for a Unix-domain socket, only write
510         permission matters, so there is no point in setting or revoking
511         read or execute permissions.)
512        </para>
513
514        <para>
515         This access control mechanism is independent of the one
516         described in <xref linkend="client-authentication">.
517        </para>
518
519        <para>
520         This parameter can only be set at server start.
521        </para>
522
523        <para>
524         This parameter is irrelevant on Windows, which does not have
525         Unix-domain sockets.
526        </para>
527       </listitem>
528      </varlistentry>
529
530      <varlistentry id="guc-bonjour" xreflabel="bonjour">
531       <term><varname>bonjour</varname> (<type>boolean</type>)</term>
532       <indexterm>
533        <primary><varname>bonjour</> configuration parameter</primary>
534       </indexterm>
535       <listitem>
536        <para>
537         Enables advertising the server's existence via
538         <productname>Bonjour</productname>.  The default is off.
539         This parameter can only be set at server start.
540        </para>
541       </listitem>
542      </varlistentry>
543
544      <varlistentry id="guc-bonjour-name" xreflabel="bonjour_name">
545       <term><varname>bonjour_name</varname> (<type>string</type>)</term>
546       <indexterm>
547        <primary><varname>bonjour_name</> configuration parameter</primary>
548       </indexterm>
549       <listitem>
550        <para>
551         Specifies the <productname>Bonjour</productname> service
552         name.  The computer name is used if this parameter is set to the
553         empty string <literal>''</> (which is the default).  This parameter is
554         ignored if the server was not compiled with
555         <productname>Bonjour</productname> support.
556         This parameter can only be set at server start.
557        </para>
558       </listitem>
559      </varlistentry>
560
561      <varlistentry id="guc-tcp-keepalives-idle" xreflabel="tcp_keepalives_idle">
562       <term><varname>tcp_keepalives_idle</varname> (<type>integer</type>)</term>
563       <indexterm>
564        <primary><varname>tcp_keepalives_idle</> configuration parameter</primary>
565       </indexterm>
566       <listitem>
567        <para>
568         Specifies the number of seconds before sending a keepalive packet on
569         an otherwise idle connection.  A value of 0 uses the system default.
570         This parameter is supported only on systems that support the
571         <symbol>TCP_KEEPIDLE</> or <symbol>TCP_KEEPALIVE</> symbols, and on
572         Windows; on other systems, it must be zero. This parameter is ignored
573         for connections made via a Unix-domain socket.
574        </para>
575        <note>
576         <para>
577          On Windows, a value of 0 will set this parameter to 2 hours,
578          since Windows does not provide a way to read the system default value.
579         </para>
580        </note>
581       </listitem>
582      </varlistentry>
583
584      <varlistentry id="guc-tcp-keepalives-interval" xreflabel="tcp_keepalives_interval">
585       <term><varname>tcp_keepalives_interval</varname> (<type>integer</type>)</term>
586       <indexterm>
587        <primary><varname>tcp_keepalives_interval</> configuration parameter</primary>
588       </indexterm>
589       <listitem>
590        <para>
591         Specifies the number of seconds between sending keepalives on an
592         otherwise idle connection.  A value of 0 uses the system default.
593         This parameter is supported only on systems that support the
594         <symbol>TCP_KEEPINTVL</> symbol, and on Windows; on other systems, it
595         must be zero. This parameter is ignored for connections made via a
596         Unix-domain socket.
597        </para>
598        <note>
599         <para>
600          On Windows, a value of 0 will set this parameter to 1 second,
601          since Windows does not provide a way to read the system default value.
602         </para>
603        </note>
604       </listitem>
605      </varlistentry>
606
607      <varlistentry id="guc-tcp-keepalives-count" xreflabel="tcp_keepalives_count">
608       <term><varname>tcp_keepalives_count</varname> (<type>integer</type>)</term>
609       <indexterm>
610        <primary><varname>tcp_keepalives_count</> configuration parameter</primary>
611       </indexterm>
612       <listitem>
613        <para>
614         Specifies the number of keepalive packets to send on an otherwise idle
615         connection.  A value of 0 uses the system default.  This parameter is
616         supported only on systems that support the <symbol>TCP_KEEPCNT</>
617         symbol; on other systems, it must be zero. This parameter is ignored
618         for connections made via a Unix-domain socket.
619        </para>
620        <note>
621         <para>
622          This parameter is not supported on Windows, and must be zero.
623         </para>
624        </note>
625       </listitem>
626      </varlistentry>
627
628      </variablelist>
629      </sect2>
630      <sect2 id="runtime-config-connection-security">
631      <title>Security and Authentication</title>
632
633      <variablelist>
634      <varlistentry id="guc-authentication-timeout" xreflabel="authentication_timeout">
635       <term><varname>authentication_timeout</varname> (<type>integer</type>)</term>
636       <indexterm><primary>timeout</><secondary>client authentication</></indexterm>
637       <indexterm><primary>client authentication</><secondary>timeout during</></indexterm>
638       <indexterm>
639        <primary><varname>authentication_timeout</> configuration parameter</primary>
640       </indexterm>
641
642       <listitem>
643        <para>
644         Maximum time to complete client authentication, in seconds. If a
645         would-be client has not completed the authentication protocol in
646         this much time, the server closes the connection. This prevents
647         hung clients from occupying a connection indefinitely.
648         The default is one minute (<literal>1m</>).
649         This parameter can only be set in the <filename>postgresql.conf</>
650         file or on the server command line.
651        </para>
652       </listitem>
653      </varlistentry>
654
655      <varlistentry id="guc-ssl" xreflabel="ssl">
656       <term><varname>ssl</varname> (<type>boolean</type>)</term>
657       <indexterm>
658        <primary><varname>ssl</> configuration parameter</primary>
659       </indexterm>
660       <listitem>
661        <para>
662         Enables <acronym>SSL</> connections. Please read
663         <xref linkend="ssl-tcp"> before using this. The default
664         is <literal>off</>. This parameter can only be set at server
665         start.  <acronym>SSL</> communication is only possible with
666         TCP/IP connections.
667        </para>
668       </listitem>
669      </varlistentry>
670
671      <varlistentry id="guc-ssl-renegotiation-limit" xreflabel="ssl_renegotiation_limit">
672       <term><varname>ssl_renegotiation_limit</varname> (<type>integer</type>)</term>
673       <indexterm>
674        <primary><varname>ssl_renegotiation_limit</> configuration parameter</primary>
675       </indexterm>
676       <listitem>
677        <para>
678         Specifies how much data can flow over an <acronym>SSL</>-encrypted
679         connection before renegotiation of the session keys will take
680         place. Renegotiation decreases an attacker's chances of doing
681         cryptanalysis when large amounts of traffic can be examined, but it
682         also carries a large performance penalty. The sum of sent and received
683         traffic is used to check the limit. If this parameter is set to 0,
684         renegotiation is disabled. The default is <literal>512MB</>.
685        </para>
686        <note>
687         <para>
688          SSL libraries from before November 2009 are insecure when using SSL
689          renegotiation, due to a vulnerability in the SSL protocol. As a
690          stop-gap fix for this vulnerability, some vendors shipped SSL
691          libraries incapable of doing renegotiation. If any such libraries
692          are in use on the client or server, SSL renegotiation should be
693          disabled.
694         </para>
695        </note>
696       </listitem>
697      </varlistentry>
698
699      <varlistentry id="guc-ssl-ciphers" xreflabel="ssl_ciphers">
700       <term><varname>ssl_ciphers</varname> (<type>string</type>)</term>
701       <indexterm>
702        <primary><varname>ssl_ciphers</> configuration parameter</primary>
703       </indexterm>
704       <listitem>
705        <para>
706         Specifies a list of <acronym>SSL</> ciphers that are allowed to be
707         used on secure connections. See the <application>openssl</>
708         manual page for a list of supported ciphers.
709        </para>
710       </listitem>
711      </varlistentry>
712
713      <varlistentry id="guc-password-encryption" xreflabel="password_encryption">
714       <term><varname>password_encryption</varname> (<type>boolean</type>)</term>
715       <indexterm>
716        <primary><varname>password_encryption</> configuration parameter</primary>
717       </indexterm>
718       <listitem>
719        <para>
720         When a password is specified in <xref
721         linkend="sql-createuser"> or
722         <xref linkend="sql-alterrole">
723         without writing either <literal>ENCRYPTED</> or
724         <literal>UNENCRYPTED</>, this parameter determines whether the
725         password is to be encrypted. The default is <literal>on</>
726         (encrypt the password).
727        </para>
728       </listitem>
729      </varlistentry>
730
731      <varlistentry id="guc-krb-server-keyfile" xreflabel="krb_server_keyfile">
732       <term><varname>krb_server_keyfile</varname> (<type>string</type>)</term>
733       <indexterm>
734        <primary><varname>krb_server_keyfile</> configuration parameter</primary>
735       </indexterm>
736       <listitem>
737        <para>
738         Sets the location of the Kerberos server key file. See
739         <xref linkend="kerberos-auth"> or <xref linkend="gssapi-auth">
740         for details. This parameter can only be set in the
741         <filename>postgresql.conf</> file or on the server command line.
742        </para>
743       </listitem>
744      </varlistentry>
745
746      <varlistentry id="guc-krb-srvname" xreflabel="krb_srvname">
747       <term><varname>krb_srvname</varname> (<type>string</type>)</term>
748       <indexterm>
749        <primary><varname>krb_srvname</> configuration parameter</primary>
750       </indexterm>
751       <listitem>
752        <para>
753         Sets the Kerberos service name. See <xref linkend="kerberos-auth">
754         for details. This parameter can only be set in the
755         <filename>postgresql.conf</> file or on the server command line.
756        </para>
757       </listitem>
758      </varlistentry>
759
760      <varlistentry id="guc-krb-caseins-users" xreflabel="krb_caseins_users">
761       <term><varname>krb_caseins_users</varname> (<type>boolean</type>)</term>
762       <indexterm>
763        <primary><varname>krb_caseins_users</varname> configuration parameter</primary>
764       </indexterm>
765       <listitem>
766        <para>
767         Sets whether Kerberos and GSSAPI user names should be treated
768         case-insensitively.
769         The default is <literal>off</> (case sensitive). This parameter can only be
770         set in the <filename>postgresql.conf</> file or on the server command line.
771        </para>
772       </listitem>
773      </varlistentry>
774
775      <varlistentry id="guc-db-user-namespace" xreflabel="db_user_namespace">
776       <term><varname>db_user_namespace</varname> (<type>boolean</type>)</term>
777       <indexterm>
778        <primary><varname>db_user_namespace</> configuration parameter</primary>
779       </indexterm>
780       <listitem>
781        <para>
782         This parameter enables per-database user names.  It is off by default.
783         This parameter can only be set in the <filename>postgresql.conf</>
784         file or on the server command line.
785        </para>
786
787        <para>
788         If this is on, you should create users as <literal>username@dbname</>.
789         When <literal>username</> is passed by a connecting client,
790         <literal>@</> and the database name are appended to the user
791         name and that database-specific user name is looked up by the
792         server. Note that when you create users with names containing
793         <literal>@</> within the SQL environment, you will need to
794         quote the user name.
795        </para>
796
797        <para>
798         With this parameter enabled, you can still create ordinary global
799         users.  Simply append <literal>@</> when specifying the user
800         name in the client, e.g. <literal>joe@</>.  The <literal>@</>
801         will be stripped off before the user name is looked up by the
802         server.
803        </para>
804
805        <para>
806         <varname>db_user_namespace</> causes the client's and
807         server's user name representation to differ.
808         Authentication checks are always done with the server's user name
809         so authentication methods must be configured for the
810         server's user name, not the client's.  Because
811         <literal>md5</> uses the user name as salt on both the
812         client and server, <literal>md5</> cannot be used with
813         <varname>db_user_namespace</>.
814        </para>
815
816        <note>
817         <para>
818          This feature is intended as a temporary measure until a
819          complete solution is found.  At that time, this option will
820          be removed.
821         </para>
822        </note>
823       </listitem>
824      </varlistentry>
825
826     </variablelist>
827     </sect2>
828    </sect1>
829
830    <sect1 id="runtime-config-resource">
831     <title>Resource Consumption</title>
832
833     <sect2 id="runtime-config-resource-memory">
834      <title>Memory</title>
835
836      <variablelist>
837      <varlistentry id="guc-shared-buffers" xreflabel="shared_buffers">
838       <term><varname>shared_buffers</varname> (<type>integer</type>)</term>
839       <indexterm>
840        <primary><varname>shared_buffers</> configuration parameter</primary>
841       </indexterm>
842       <listitem>
843        <para>
844         Sets the amount of memory the database server uses for shared
845         memory buffers.  The default is typically 32 megabytes
846         (<literal>32MB</>), but might be less if your kernel settings will
847         not support it (as determined during <application>initdb</>).
848         This setting must be at least 128 kilobytes.  (Non-default
849         values of <symbol>BLCKSZ</symbol> change the minimum.)  However,
850         settings significantly higher than the minimum are usually needed
851         for good performance.  This parameter can only be set at server start.
852        </para>
853
854        <para>
855         If you have a dedicated database server with 1GB or more of RAM, a
856         reasonable starting value for <varname>shared_buffers</varname> is 25%
857         of the memory in your system.  There are some workloads where even
858         large settings for <varname>shared_buffers</varname> are effective, but
859         because <productname>PostgreSQL</productname> also relies on the
860         operating system cache, it is unlikely that an allocation of more than
861         40% of RAM to <varname>shared_buffers</varname> will work better than a
862         smaller amount.  Larger settings for <varname>shared_buffers</varname>
863         usually require a corresponding increase in
864         <varname>checkpoint_segments</varname>, in order to spread out the
865         process of writing large quantities of new or changed data over a
866         longer period of time.
867        </para>
868
869        <para>
870         On systems with less than 1GB of RAM, a smaller percentage of RAM is
871         appropriate, so as to leave adequate space for the operating system.
872         Also, on Windows, large values for <varname>shared_buffers</varname>
873         aren't as effective.  You may find better results keeping the setting
874         relatively low and using the operating system cache more instead.  The
875         useful range for <varname>shared_buffers</varname> on Windows systems
876         is generally from 64MB to 512MB.
877        </para>
878
879        <para>
880         Increasing this parameter might cause <productname>PostgreSQL</>
881         to request more <systemitem class="osname">System V</> shared
882         memory than your operating system's default configuration
883         allows. See <xref linkend="sysvipc"> for information on how to
884         adjust those parameters, if necessary.
885        </para>
886       </listitem>
887      </varlistentry>
888
889      <varlistentry id="guc-temp-buffers" xreflabel="temp_buffers">
890       <term><varname>temp_buffers</varname> (<type>integer</type>)</term>
891       <indexterm>
892        <primary><varname>temp_buffers</> configuration parameter</primary>
893       </indexterm>
894       <listitem>
895        <para>
896         Sets the maximum number of temporary buffers used by each database
897         session.  These are session-local buffers used only for access to
898         temporary tables.  The default is eight megabytes
899         (<literal>8MB</>).  The setting can be changed within individual
900         sessions, but only before the first use of temporary tables
901         within the session; subsequent attempts to change the value will
902         have no effect on that session.
903        </para>
904
905        <para>
906         A session will allocate temporary buffers as needed up to the limit
907         given by <varname>temp_buffers</>.  The cost of setting a large
908         value in sessions that do not actually need many temporary
909         buffers is only a buffer descriptor, or about 64 bytes, per
910         increment in <varname>temp_buffers</>.  However if a buffer is
911         actually used an additional 8192 bytes will be consumed for it
912         (or in general, <symbol>BLCKSZ</symbol> bytes).
913        </para>
914       </listitem>
915      </varlistentry>
916
917      <varlistentry id="guc-max-prepared-transactions" xreflabel="max_prepared_transactions">
918       <term><varname>max_prepared_transactions</varname> (<type>integer</type>)</term>
919       <indexterm>
920        <primary><varname>max_prepared_transactions</> configuration parameter</primary>
921       </indexterm>
922       <listitem>
923        <para>
924         Sets the maximum number of transactions that can be in the
925         <quote>prepared</> state simultaneously (see <xref
926         linkend="sql-prepare-transaction">).
927         Setting this parameter to zero (which is the default)
928         disables the prepared-transaction feature.
929         This parameter can only be set at server start.
930        </para>
931
932        <para>
933         If you are not planning to use prepared transactions, this parameter
934         should be set to zero to prevent accidental creation of prepared
935         transactions.  If you are using prepared transactions, you will
936         probably want <varname>max_prepared_transactions</varname> to be at
937         least as large as <xref linkend="guc-max-connections">, so that every
938         session can have a prepared transaction pending.
939        </para>
940
941        <para>
942         Increasing this parameter might cause <productname>PostgreSQL</>
943         to request more <systemitem class="osname">System V</> shared
944         memory than your operating system's default configuration
945         allows. See <xref linkend="sysvipc"> for information on how to
946         adjust those parameters, if necessary.
947        </para>
948
949        <para>
950         When running a standby server, you must set this parameter to the
951         same or higher value than on the master server. Otherwise, queries
952         will not be allowed in the standby server.
953        </para>
954       </listitem>
955      </varlistentry>
956
957      <varlistentry id="guc-work-mem" xreflabel="work_mem">
958       <term><varname>work_mem</varname> (<type>integer</type>)</term>
959       <indexterm>
960        <primary><varname>work_mem</> configuration parameter</primary>
961       </indexterm>
962       <listitem>
963        <para>
964         Specifies the amount of memory to be used by internal sort operations
965         and hash tables before writing to temporary disk files. The value
966         defaults to one megabyte (<literal>1MB</>).
967         Note that for a complex query, several sort or hash operations might be
968         running in parallel; each operation will be allowed to use as much memory
969         as this value specifies before it starts to write data into temporary
970         files. Also, several running sessions could be doing such operations
971         concurrently.  Therefore, the total memory used could be many
972         times the value of <varname>work_mem</varname>; it is necessary to
973         keep this fact in mind when choosing the value. Sort operations are
974         used for <literal>ORDER BY</>, <literal>DISTINCT</>, and
975         merge joins.
976         Hash tables are used in hash joins, hash-based aggregation, and
977         hash-based processing of <literal>IN</> subqueries.
978        </para>
979       </listitem>
980      </varlistentry>
981
982      <varlistentry id="guc-maintenance-work-mem" xreflabel="maintenance_work_mem">
983       <term><varname>maintenance_work_mem</varname> (<type>integer</type>)</term>
984       <indexterm>
985        <primary><varname>maintenance_work_mem</> configuration parameter</primary>
986       </indexterm>
987       <listitem>
988        <para>
989         Specifies the maximum amount of memory to be used by maintenance
990         operations, such as <command>VACUUM</command>, <command>CREATE
991         INDEX</>, and <command>ALTER TABLE ADD FOREIGN KEY</>.  It defaults
992         to 16 megabytes (<literal>16MB</>).  Since only one of these
993         operations can be executed at a time by a database session, and
994         an installation normally doesn't have many of them running
995         concurrently, it's safe to set this value significantly larger
996         than <varname>work_mem</varname>.  Larger settings might improve
997         performance for vacuuming and for restoring database dumps.
998        </para>
999        <para>
1000         Note that when autovacuum runs, up to
1001         <xref linkend="guc-autovacuum-max-workers"> times this memory may be
1002         allocated, so be careful not to set the default value too high.
1003        </para>
1004       </listitem>
1005      </varlistentry>
1006
1007      <varlistentry id="guc-max-stack-depth" xreflabel="max_stack_depth">
1008       <term><varname>max_stack_depth</varname> (<type>integer</type>)</term>
1009       <indexterm>
1010        <primary><varname>max_stack_depth</> configuration parameter</primary>
1011       </indexterm>
1012       <listitem>
1013        <para>
1014         Specifies the maximum safe depth of the server's execution stack.
1015         The ideal setting for this parameter is the actual stack size limit
1016         enforced by the kernel (as set by <literal>ulimit -s</> or local
1017         equivalent), less a safety margin of a megabyte or so.  The safety
1018         margin is needed because the stack depth is not checked in every
1019         routine in the server, but only in key potentially-recursive routines
1020         such as expression evaluation.  The default setting is two
1021         megabytes (<literal>2MB</>), which is conservatively small and
1022         unlikely to risk crashes.  However, it might be too small to allow
1023         execution of complex functions.  Only superusers can change this
1024         setting.
1025        </para>
1026
1027        <para>
1028         Setting <varname>max_stack_depth</> higher than
1029         the actual kernel limit will mean that a runaway recursive function
1030         can crash an individual backend process.  On platforms where
1031         <productname>PostgreSQL</productname> can determine the kernel limit,
1032         the server will not allow this variable to be set to an unsafe
1033         value.  However, not all platforms provide the information,
1034         so caution is recommended in selecting a value.
1035        </para>
1036       </listitem>
1037      </varlistentry>
1038
1039      </variablelist>
1040      </sect2>
1041
1042      <sect2 id="runtime-config-resource-disk">
1043      <title>Disk</title>
1044
1045      <variablelist>
1046      <varlistentry id="guc-temp-file-limit" xreflabel="temp_file_limit">
1047       <term><varname>temp_file_limit</varname> (<type>integer</type>)</term>
1048       <indexterm>
1049        <primary><varname>temp_file_limit</> configuration parameter</primary>
1050       </indexterm>
1051       <listitem>
1052        <para>
1053         Specifies the maximum amount of disk space that a session can use
1054         for temporary files, such as sort and hash temporary files, or the
1055         storage file for a held cursor.
1056         The value is specified in kilobytes, and <literal>-1</> (the
1057         default) means no limit.
1058         Only superusers can change this setting.
1059        </para>
1060        <para>
1061         This setting constrains the total space used at any instant by all
1062         temporary files used by a given <productname>PostgreSQL</> session.
1063         It should be noted that disk space used for explicit temporary
1064         tables, as opposed to temporary files used behind-the-scenes in query
1065         execution, does <emphasis>not</emphasis> count against this limit.
1066        </para>
1067       </listitem>
1068      </varlistentry>
1069
1070      </variablelist>
1071      </sect2>
1072
1073      <sect2 id="runtime-config-resource-kernel">
1074      <title>Kernel Resource Usage</title>
1075
1076      <variablelist>
1077      <varlistentry id="guc-max-files-per-process" xreflabel="max_files_per_process">
1078       <term><varname>max_files_per_process</varname> (<type>integer</type>)</term>
1079       <indexterm>
1080        <primary><varname>max_files_per_process</> configuration parameter</primary>
1081       </indexterm>
1082       <listitem>
1083        <para>
1084         Sets the maximum number of simultaneously open files allowed to each
1085         server subprocess. The default is one thousand files. If the kernel is enforcing
1086         a safe per-process limit, you don't need to worry about this setting.
1087         But on some platforms (notably, most BSD systems), the kernel will
1088         allow individual processes to open many more files than the system
1089         can actually support if many processes all try to open
1090         that many files. If you find yourself seeing <quote>Too many open
1091         files</> failures, try reducing this setting.
1092         This parameter can only be set at server start.
1093        </para>
1094       </listitem>
1095      </varlistentry>
1096
1097      <varlistentry id="guc-shared-preload-libraries" xreflabel="shared_preload_libraries">
1098       <term><varname>shared_preload_libraries</varname> (<type>string</type>)</term>
1099       <indexterm>
1100        <primary><varname>shared_preload_libraries</> configuration parameter</primary>
1101       </indexterm>
1102       <listitem>
1103        <para>
1104         This variable specifies one or more shared libraries
1105         to be preloaded at server start. For example,
1106         <literal>'$libdir/mylib'</literal> would cause
1107         <literal>mylib.so</> (or on some platforms,
1108         <literal>mylib.sl</>) to be preloaded from the installation's
1109         standard library directory.
1110         All library names are converted to lower case unless double-quoted.
1111         If more than one library is to be loaded, separate their names
1112         with commas.  This parameter can only be set at server start.
1113        </para>
1114
1115        <para>
1116         <productname>PostgreSQL</productname> procedural language
1117         libraries can be preloaded in this way, typically by using the
1118         syntax <literal>'$libdir/plXXX'</literal> where
1119         <literal>XXX</literal> is <literal>pgsql</>, <literal>perl</>,
1120         <literal>tcl</>, or <literal>python</>.
1121        </para>
1122
1123        <para>
1124         By preloading a shared library, the library startup time is avoided
1125         when the library is first used.  However, the time to start each new
1126         server process might increase slightly, even if that process never
1127         uses the library.  So this parameter is recommended only for
1128         libraries that will be used in most sessions.
1129        </para>
1130
1131      <note>
1132       <para>
1133         On Windows hosts, preloading a library at server start will not reduce
1134         the time required to start each new server process; each server process
1135         will re-load all preload libraries.  However, <varname>shared_preload_libraries
1136         </varname> is still useful on Windows hosts because some shared libraries may
1137         need to perform certain operations that only take place at postmaster start
1138         (for example, a shared library may need to reserve lightweight locks
1139         or shared memory and you can't do that after the postmaster has started).
1140        </para>
1141       </note>
1142        <para>
1143         If a specified library is not found,
1144         the server will fail to start.
1145        </para>
1146
1147        <para>
1148         Every  PostgreSQL-supported library has a <quote>magic
1149         block</> that is checked to guarantee compatibility.
1150         For this reason, non-PostgreSQL libraries cannot be
1151         loaded in this way.
1152        </para>
1153       </listitem>
1154      </varlistentry>
1155
1156      </variablelist>
1157     </sect2>
1158
1159     <sect2 id="runtime-config-resource-vacuum-cost">
1160      <title>Cost-based Vacuum Delay</title>
1161
1162      <para>
1163       During the execution of <xref linkend="sql-vacuum">
1164       and <xref linkend="sql-analyze">
1165       commands, the system maintains an
1166       internal counter that keeps track of the estimated cost of the
1167       various I/O operations that are performed.  When the accumulated
1168       cost reaches a limit (specified by
1169       <varname>vacuum_cost_limit</varname>), the process performing
1170       the operation will sleep for a short period of time, as specified by
1171       <varname>vacuum_cost_delay</varname>. Then it will reset the
1172       counter and continue execution.
1173      </para>
1174
1175      <para>
1176       The intent of this feature is to allow administrators to reduce
1177       the I/O impact of these commands on concurrent database
1178       activity. There are many situations where it is not
1179       important that maintenance commands like
1180       <command>VACUUM</command> and <command>ANALYZE</command> finish
1181       quickly; however, it is usually very important that these
1182       commands do not significantly interfere with the ability of the
1183       system to perform other database operations. Cost-based vacuum
1184       delay provides a way for administrators to achieve this.
1185      </para>
1186
1187      <para>
1188       This feature is disabled by default for manually issued
1189       <command>VACUUM</command> commands. To enable it, set the
1190       <varname>vacuum_cost_delay</varname> variable to a nonzero
1191       value.
1192      </para>
1193
1194      <variablelist>
1195       <varlistentry id="guc-vacuum-cost-delay" xreflabel="vacuum_cost_delay">
1196        <term><varname>vacuum_cost_delay</varname> (<type>integer</type>)</term>
1197        <indexterm>
1198         <primary><varname>vacuum_cost_delay</> configuration parameter</primary>
1199        </indexterm>
1200        <listitem>
1201         <para>
1202          The length of time, in milliseconds, that the process will sleep
1203          when the cost limit has been exceeded.
1204          The default value is zero, which disables the cost-based vacuum
1205          delay feature.  Positive values enable cost-based vacuuming.
1206          Note that on many systems, the effective resolution
1207          of sleep delays is 10 milliseconds; setting
1208          <varname>vacuum_cost_delay</varname> to a value that is
1209          not a multiple of 10 might have the same results as setting it
1210          to the next higher multiple of 10.
1211         </para>
1212
1213         <para>
1214          When using cost-based vacuuming, appropriate values for
1215          <varname>vacuum_cost_delay</> are usually quite small, perhaps
1216          10 or 20 milliseconds.  Adjusting vacuum's resource consumption
1217          is best done by changing the other vacuum cost parameters.
1218         </para>
1219        </listitem>
1220       </varlistentry>
1221
1222       <varlistentry id="guc-vacuum-cost-page-hit" xreflabel="vacuum_cost_page_hit">
1223        <term><varname>vacuum_cost_page_hit</varname> (<type>integer</type>)</term>
1224        <indexterm>
1225         <primary><varname>vacuum_cost_page_hit</> configuration parameter</primary>
1226        </indexterm>
1227        <listitem>
1228         <para>
1229          The estimated cost for vacuuming a buffer found in the shared buffer
1230          cache. It represents the cost to lock the buffer pool, lookup
1231          the shared hash table and scan the content of the page. The
1232          default value is one.
1233         </para>
1234        </listitem>
1235       </varlistentry>
1236
1237       <varlistentry id="guc-vacuum-cost-page-miss" xreflabel="vacuum_cost_page_miss">
1238        <term><varname>vacuum_cost_page_miss</varname> (<type>integer</type>)</term>
1239        <indexterm>
1240         <primary><varname>vacuum_cost_page_miss</> configuration parameter</primary>
1241        </indexterm>
1242        <listitem>
1243         <para>
1244          The estimated cost for vacuuming a buffer that has to be read from
1245          disk.  This represents the effort to lock the buffer pool,
1246          lookup the shared hash table, read the desired block in from
1247          the disk and scan its content. The default value is 10.
1248         </para>
1249        </listitem>
1250       </varlistentry>
1251
1252       <varlistentry id="guc-vacuum-cost-page-dirty" xreflabel="vacuum_cost_page_dirty">
1253        <term><varname>vacuum_cost_page_dirty</varname> (<type>integer</type>)</term>
1254        <indexterm>
1255         <primary><varname>vacuum_cost_page_dirty</> configuration parameter</primary>
1256        </indexterm>
1257        <listitem>
1258         <para>
1259          The estimated cost charged when vacuum modifies a block that was
1260          previously clean. It represents the extra I/O required to
1261          flush the dirty block out to disk again. The default value is
1262          20.
1263         </para>
1264        </listitem>
1265       </varlistentry>
1266
1267       <varlistentry id="guc-vacuum-cost-limit" xreflabel="vacuum_cost_limit">
1268        <term><varname>vacuum_cost_limit</varname> (<type>integer</type>)</term>
1269        <indexterm>
1270         <primary><varname>vacuum_cost_limit</> configuration parameter</primary>
1271        </indexterm>
1272        <listitem>
1273         <para>
1274          The accumulated cost that will cause the vacuuming process to sleep.
1275          The default value is 200.
1276         </para>
1277        </listitem>
1278       </varlistentry>
1279      </variablelist>
1280
1281      <note>
1282       <para>
1283        There are certain operations that hold critical locks and should
1284        therefore complete as quickly as possible.  Cost-based vacuum
1285        delays do not occur during such operations.  Therefore it is
1286        possible that the cost accumulates far higher than the specified
1287        limit.  To avoid uselessly long delays in such cases, the actual
1288        delay is calculated as <varname>vacuum_cost_delay</varname> *
1289        <varname>accumulated_balance</varname> /
1290        <varname>vacuum_cost_limit</varname> with a maximum of
1291        <varname>vacuum_cost_delay</varname> * 4.
1292       </para>
1293      </note>
1294     </sect2>
1295
1296     <sect2 id="runtime-config-resource-background-writer">
1297      <title>Background Writer</title>
1298
1299      <para>
1300       There is a separate server
1301       process called the <firstterm>background writer</>, whose function
1302       is to issue writes of <quote>dirty</> (new or modified) shared
1303       buffers.  It writes shared buffers so server processes handling
1304       user queries seldom or never need to wait for a write to occur.
1305       However, the background writer does cause a net overall
1306       increase in I/O load, because while a repeatedly-dirtied page might
1307       otherwise be written only once per checkpoint interval, the
1308       background writer might write it several times as it is dirtied
1309       in the same interval.  The parameters discussed in this subsection
1310       can be used to tune the behavior for local needs.
1311      </para>
1312
1313      <variablelist>
1314       <varlistentry id="guc-bgwriter-delay" xreflabel="bgwriter_delay">
1315        <term><varname>bgwriter_delay</varname> (<type>integer</type>)</term>
1316        <indexterm>
1317         <primary><varname>bgwriter_delay</> configuration parameter</primary>
1318        </indexterm>
1319        <listitem>
1320         <para>
1321          Specifies the delay between activity rounds for the
1322          background writer.  In each round the writer issues writes
1323          for some number of dirty buffers (controllable by the
1324          following parameters).  It then sleeps for <varname>bgwriter_delay</>
1325          milliseconds, and repeats.  When there are no dirty buffers in the
1326          buffer pool, though, it goes into a longer sleep regardless of
1327          <varname>bgwriter_delay</>.  The default value is 200
1328          milliseconds (<literal>200ms</>). Note that on many systems, the
1329          effective resolution of sleep delays is 10 milliseconds; setting
1330          <varname>bgwriter_delay</> to a value that is not a multiple of 10
1331          might have the same results as setting it to the next higher multiple
1332          of 10.  This parameter can only be set in the
1333          <filename>postgresql.conf</> file or on the server command line.
1334         </para>
1335        </listitem>
1336       </varlistentry>
1337
1338       <varlistentry id="guc-bgwriter-lru-maxpages" xreflabel="bgwriter_lru_maxpages">
1339        <term><varname>bgwriter_lru_maxpages</varname> (<type>integer</type>)</term>
1340        <indexterm>
1341         <primary><varname>bgwriter_lru_maxpages</> configuration parameter</primary>
1342        </indexterm>
1343        <listitem>
1344         <para>
1345          In each round, no more than this many buffers will be written
1346          by the background writer.  Setting this to zero disables
1347          background writing.  (Note that checkpoints, which are managed by
1348          a separate, dedicated auxiliary process, are unaffected.)
1349          The default value is 100 buffers.
1350          This parameter can only be set in the <filename>postgresql.conf</>
1351          file or on the server command line.
1352         </para>
1353        </listitem>
1354       </varlistentry>
1355
1356       <varlistentry id="guc-bgwriter-lru-multiplier" xreflabel="bgwriter_lru_multiplier">
1357        <term><varname>bgwriter_lru_multiplier</varname> (<type>floating point</type>)</term>
1358        <indexterm>
1359         <primary><varname>bgwriter_lru_multiplier</> configuration parameter</primary>
1360        </indexterm>
1361        <listitem>
1362         <para>
1363          The number of dirty buffers written in each round is based on the
1364          number of new buffers that have been needed by server processes
1365          during recent rounds.  The average recent need is multiplied by
1366          <varname>bgwriter_lru_multiplier</> to arrive at an estimate of the
1367          number of buffers that will be needed during the next round.  Dirty
1368          buffers are written until there are that many clean, reusable buffers
1369          available.  (However, no more than <varname>bgwriter_lru_maxpages</>
1370          buffers will be written per round.)
1371          Thus, a setting of 1.0 represents a <quote>just in time</> policy
1372          of writing exactly the number of buffers predicted to be needed.
1373          Larger values provide some cushion against spikes in demand,
1374          while smaller values intentionally leave writes to be done by
1375          server processes.
1376          The default is 2.0.
1377          This parameter can only be set in the <filename>postgresql.conf</>
1378          file or on the server command line.
1379         </para>
1380        </listitem>
1381       </varlistentry>
1382      </variablelist>
1383
1384      <para>
1385       Smaller values of <varname>bgwriter_lru_maxpages</varname> and
1386       <varname>bgwriter_lru_multiplier</varname> reduce the extra I/O load
1387       caused by the background writer, but make it more likely that server
1388       processes will have to issue writes for themselves, delaying interactive
1389       queries.
1390      </para>
1391     </sect2>
1392
1393     <sect2 id="runtime-config-resource-async-behavior">
1394      <title>Asynchronous Behavior</title>
1395
1396      <variablelist>
1397       <varlistentry id="guc-effective-io-concurrency" xreflabel="effective_io_concurrency">
1398        <term><varname>effective_io_concurrency</varname> (<type>integer</type>)</term>
1399        <indexterm>
1400         <primary><varname>effective_io_concurrency</> configuration parameter</primary>
1401        </indexterm>
1402        <listitem>
1403         <para>
1404          Sets the number of concurrent disk I/O operations that
1405          <productname>PostgreSQL</> expects can be executed
1406          simultaneously.  Raising this value will increase the number of I/O
1407          operations that any individual <productname>PostgreSQL</> session
1408          attempts to initiate in parallel.  The allowed range is 1 to 1000,
1409          or zero to disable issuance of asynchronous I/O requests. Currently,
1410          this setting only affects bitmap heap scans.
1411         </para>
1412
1413         <para>
1414          A good starting point for this setting is the number of separate
1415          drives comprising a RAID 0 stripe or RAID 1 mirror being used for the
1416          database.  (For RAID 5 the parity drive should not be counted.)
1417          However, if the database is often busy with multiple queries issued in
1418          concurrent sessions, lower values may be sufficient to keep the disk
1419          array busy.  A value higher than needed to keep the disks busy will
1420          only result in extra CPU overhead.
1421         </para>
1422
1423         <para>
1424          For more exotic systems, such as memory-based storage or a RAID array
1425          that is limited by bus bandwidth, the correct value might be the
1426          number of I/O paths available.  Some experimentation may be needed
1427          to find the best value.
1428         </para>
1429
1430         <para>
1431          Asynchronous I/O depends on an effective <function>posix_fadvise</>
1432          function, which some operating systems lack.  If the function is not
1433          present then setting this parameter to anything but zero will result
1434          in an error.  On some operating systems (e.g., Solaris), the function
1435          is present but does not actually do anything.
1436         </para>
1437        </listitem>
1438       </varlistentry>
1439      </variablelist>
1440     </sect2>
1441    </sect1>
1442
1443    <sect1 id="runtime-config-wal">
1444     <title>Write Ahead Log</title>
1445
1446    <para>
1447     See also <xref linkend="wal-configuration"> for details on WAL
1448     and checkpoint tuning.
1449    </para>
1450
1451     <sect2 id="runtime-config-wal-settings">
1452      <title>Settings</title>
1453      <variablelist>
1454
1455      <varlistentry id="guc-wal-level" xreflabel="wal_level">
1456       <term><varname>wal_level</varname> (<type>enum</type>)</term>
1457       <indexterm>
1458        <primary><varname>wal_level</> configuration parameter</primary>
1459       </indexterm>
1460       <listitem>
1461        <para>
1462         <varname>wal_level</> determines how much information is written
1463         to the WAL. The default value is <literal>minimal</>, which writes
1464         only the information needed to recover from a crash or immediate
1465         shutdown. <literal>archive</> adds logging required for WAL archiving,
1466         and <literal>hot_standby</> further adds information required to run
1467         read-only queries on a standby server.
1468         This parameter can only be set at server start.
1469        </para>
1470        <para>
1471         In <literal>minimal</> level, WAL-logging of some bulk
1472         operations can be safely skipped, which can make those
1473         operations much faster (see <xref linkend="populate-pitr">).
1474         Operations in which this optimization can be applied include:
1475         <simplelist>
1476          <member><command>CREATE TABLE AS</></member>
1477          <member><command>CREATE INDEX</></member>
1478          <member><command>CLUSTER</></member>
1479          <member><command>COPY</> into tables that were created or truncated in the same
1480          transaction</member>
1481         </simplelist>
1482         But minimal WAL does not contain
1483         enough information to reconstruct the data from a base backup and the
1484         WAL logs, so either <literal>archive</> or <literal>hot_standby</>
1485         level must be used to enable
1486         WAL archiving (<xref linkend="guc-archive-mode">) and streaming
1487         replication.
1488        </para>
1489        <para>
1490         In <literal>hot_standby</> level, the same information is logged as
1491         with <literal>archive</>, plus information needed to reconstruct
1492         the status of running transactions from the WAL. To enable read-only
1493         queries on a standby server, <varname>wal_level</> must be set to
1494         <literal>hot_standby</> on the primary, and
1495         <xref linkend="guc-hot-standby"> must be enabled in the standby. It is
1496         thought that there is
1497         little measurable difference in performance between using
1498         <literal>hot_standby</> and <literal>archive</> levels, so feedback
1499         is welcome if any production impacts are noticeable.
1500        </para>
1501       </listitem>
1502      </varlistentry>
1503
1504      <varlistentry id="guc-fsync" xreflabel="fsync">
1505       <indexterm>
1506        <primary><varname>fsync</> configuration parameter</primary>
1507       </indexterm>
1508       <term><varname>fsync</varname> (<type>boolean</type>)</term>
1509       <listitem>
1510        <para>
1511         If this parameter is on, the <productname>PostgreSQL</> server
1512         will try to make sure that updates are physically written to
1513         disk, by issuing <function>fsync()</> system calls or various
1514         equivalent methods (see <xref linkend="guc-wal-sync-method">).
1515         This ensures that the database cluster can recover to a
1516         consistent state after an operating system or hardware crash.
1517        </para>
1518
1519        <para>
1520         While turning off <varname>fsync</varname> is often a performance
1521         benefit, this can result in unrecoverable data corruption in
1522         the event of a power failure or system crash.  Thus it
1523         is only advisable to turn off <varname>fsync</varname> if
1524         you can easily recreate your entire database from external
1525         data.
1526        </para>
1527
1528        <para>
1529         Examples of safe circumstances for turning off
1530         <varname>fsync</varname> include the initial loading of a new
1531         database cluster from a backup file, using a database cluster
1532         for processing a batch of data after which the database
1533         will be thrown away and recreated,
1534         or for a read-only database clone which
1535         gets recreated frequently and is not used for failover.  High
1536         quality hardware alone is not a sufficient justification for
1537         turning off <varname>fsync</varname>.
1538        </para>
1539
1540        <para>
1541         In many situations, turning off <xref linkend="guc-synchronous-commit">
1542         for noncritical transactions can provide much of the potential
1543         performance benefit of turning off <varname>fsync</varname>, without
1544         the attendant risks of data corruption.
1545        </para>
1546
1547        <para>
1548         <varname>fsync</varname> can only be set in the <filename>postgresql.conf</>
1549         file or on the server command line.
1550         If you turn this parameter off, also consider turning off
1551         <xref linkend="guc-full-page-writes">.
1552        </para>
1553       </listitem>
1554      </varlistentry>
1555
1556      <varlistentry id="guc-synchronous-commit" xreflabel="synchronous_commit">
1557       <term><varname>synchronous_commit</varname> (<type>enum</type>)</term>
1558       <indexterm>
1559        <primary><varname>synchronous_commit</> configuration parameter</primary>
1560       </indexterm>
1561       <listitem>
1562        <para>
1563         Specifies whether transaction commit will wait for WAL records
1564         to be written to disk before the command returns a <quote>success</>
1565         indication to the client.  Valid values are <literal>on</>, <literal>write</>,
1566         <literal>local</>, and <literal>off</>.  The default, and safe, value
1567         is <literal>on</>.  When <literal>off</>, there can be a delay between
1568         when success is reported to the client and when the transaction is
1569         really guaranteed to be safe against a server crash.  (The maximum
1570         delay is three times <xref linkend="guc-wal-writer-delay">.)  Unlike
1571         <xref linkend="guc-fsync">, setting this parameter to <literal>off</>
1572         does not create any risk of database inconsistency: an operating
1573         system or database crash might
1574         result in some recent allegedly-committed transactions being lost, but
1575         the database state will be just the same as if those transactions had
1576         been aborted cleanly.  So, turning <varname>synchronous_commit</> off
1577         can be a useful alternative when performance is more important than
1578         exact certainty about the durability of a transaction.  For more
1579         discussion see <xref linkend="wal-async-commit">.
1580        </para>
1581        <para>
1582         If <xref linkend="guc-synchronous-standby-names"> is set, this
1583         parameter also controls whether or not transaction commit will wait
1584         for the transaction's WAL records to be flushed to disk and replicated
1585         to the standby server.  When <literal>write</>, the commit wait will
1586         last until a reply from the current synchronous standby indicates
1587         it has received the commit record of the transaction to memory.
1588         Normally this causes no data loss at the time of failover. However,
1589         if both primary and standby crash, and the database cluster of
1590         the primary gets corrupted, recent committed transactions might
1591         be lost. When <literal>on</>,  the commit wait will last until a reply
1592         from the current synchronous standby indicates it has flushed
1593         the commit record of the transaction to durable storage. This
1594         avoids any data loss unless the database cluster of both primary and
1595         standby gets corrupted simultaneously. If synchronous
1596         replication is in use, it will normally be sensible either to wait
1597         for both local flush and replication of WAL records, or
1598         to allow the transaction to commit asynchronously.  However, the
1599         special value <literal>local</> is available for transactions that
1600         wish to wait for local flush to disk, but not synchronous replication.
1601        </para>
1602        <para>
1603         This parameter can be changed at any time; the behavior for any
1604         one transaction is determined by the setting in effect when it
1605         commits.  It is therefore possible, and useful, to have some
1606         transactions commit synchronously and others asynchronously.
1607         For example, to make a single multistatement transaction commit
1608         asynchronously when the default is the opposite, issue <command>SET
1609         LOCAL synchronous_commit TO OFF</> within the transaction.
1610        </para>
1611       </listitem>
1612      </varlistentry>
1613
1614      <varlistentry id="guc-wal-sync-method" xreflabel="wal_sync_method">
1615       <term><varname>wal_sync_method</varname> (<type>enum</type>)</term>
1616       <indexterm>
1617        <primary><varname>wal_sync_method</> configuration parameter</primary>
1618       </indexterm>
1619       <listitem>
1620        <para>
1621         Method used for forcing WAL updates out to disk.
1622         If <varname>fsync</varname> is off then this setting is irrelevant,
1623         since WAL file updates will not be forced out at all.
1624         Possible values are:
1625        </para>
1626        <itemizedlist>
1627         <listitem>
1628         <para>
1629          <literal>open_datasync</> (write WAL files with <function>open()</> option <symbol>O_DSYNC</>)
1630         </para>
1631         </listitem>
1632         <listitem>
1633         <para>
1634          <literal>fdatasync</> (call <function>fdatasync()</> at each commit)
1635         </para>
1636         </listitem>
1637         <listitem>
1638         <para>
1639          <literal>fsync</> (call <function>fsync()</> at each commit)
1640         </para>
1641         </listitem>
1642         <listitem>
1643         <para>
1644          <literal>fsync_writethrough</> (call <function>fsync()</> at each commit, forcing write-through of any disk write cache)
1645         </para>
1646         </listitem>
1647         <listitem>
1648         <para>
1649          <literal>open_sync</> (write WAL files with <function>open()</> option <symbol>O_SYNC</>)
1650         </para>
1651         </listitem>
1652        </itemizedlist>
1653        <para>
1654         The <literal>open_</>* options also use <literal>O_DIRECT</> if available.
1655         Not all of these choices are available on all platforms.
1656         The default is the first method in the above list that is supported
1657         by the platform, except that <literal>fdatasync</> is the default on
1658         Linux.  The default is not necessarily ideal; it might be
1659         necessary to change this setting or other aspects of your system
1660         configuration in order to create a crash-safe configuration or
1661         achieve optimal performance.
1662         These aspects are discussed in <xref linkend="wal-reliability">.
1663         This parameter can only be set in the <filename>postgresql.conf</>
1664         file or on the server command line.
1665        </para>
1666       </listitem>
1667      </varlistentry>
1668
1669      <varlistentry id="guc-full-page-writes" xreflabel="full_page_writes">
1670       <indexterm>
1671        <primary><varname>full_page_writes</> configuration parameter</primary>
1672       </indexterm>
1673       <term><varname>full_page_writes</varname> (<type>boolean</type>)</term>
1674       <listitem>
1675        <para>
1676         When this parameter is on, the <productname>PostgreSQL</> server
1677         writes the entire content of each disk page to WAL during the
1678         first modification of that page after a checkpoint.
1679         This is needed because
1680         a page write that is in process during an operating system crash might
1681         be only partially completed, leading to an on-disk page
1682         that contains a mix of old and new data.  The row-level change data
1683         normally stored in WAL will not be enough to completely restore
1684         such a page during post-crash recovery.  Storing the full page image
1685         guarantees that the page can be correctly restored, but at the price
1686         of increasing the amount of data that must be written to WAL.
1687         (Because WAL replay always starts from a checkpoint, it is sufficient
1688         to do this during the first change of each page after a checkpoint.
1689         Therefore, one way to reduce the cost of full-page writes is to
1690         increase the checkpoint interval parameters.)
1691        </para>
1692
1693        <para>
1694         Turning this parameter off speeds normal operation, but
1695         might lead to either unrecoverable data corruption, or silent
1696         data corruption, after a system failure. The risks are similar to turning off
1697         <varname>fsync</varname>, though smaller, and it should be turned off
1698         only based on the same circumstances recommended for that parameter.
1699        </para>
1700
1701        <para>
1702         Turning off this parameter does not affect use of
1703         WAL archiving for point-in-time recovery (PITR)
1704         (see <xref linkend="continuous-archiving">).
1705        </para>
1706
1707        <para>
1708         This parameter can only be set in the <filename>postgresql.conf</>
1709         file or on the server command line.
1710         The default is <literal>on</>.
1711        </para>
1712       </listitem>
1713      </varlistentry>
1714
1715      <varlistentry id="guc-wal-buffers" xreflabel="wal_buffers">
1716       <term><varname>wal_buffers</varname> (<type>integer</type>)</term>
1717       <indexterm>
1718        <primary><varname>wal_buffers</> configuration parameter</primary>
1719       </indexterm>
1720       <listitem>
1721        <para>
1722         The amount of shared memory used for WAL data that has not yet been
1723         written to disk.  The default setting of -1 selects a size equal to
1724         1/32nd (about 3%) of <xref linkend="guc-shared-buffers">, but not less
1725         than <literal>64kB</literal> nor more than the size of one WAL
1726         segment, typically <literal>16MB</literal>.  This value can be set
1727         manually if the automatic choice is too large or too small,
1728         but any positive value less than <literal>32kB</literal> will be
1729         treated as <literal>32kB</literal>.
1730         This parameter can only be set at server start.
1731        </para>
1732
1733        <para>
1734         The contents of the WAL buffers are written out to disk at every
1735         transaction commit, so extremely large values are unlikely to
1736         provide a significant benefit.  However, setting this value to at
1737         least a few megabytes can improve write performance on a busy
1738         server where many clients are committing at once.  The auto-tuning
1739         selected by the default setting of -1 should give reasonable
1740         results in most cases.
1741        </para>
1742
1743        <para>
1744         Increasing this parameter might cause <productname>PostgreSQL</>
1745         to request more <systemitem class="osname">System V</> shared
1746         memory than your operating system's default configuration
1747         allows. See <xref linkend="sysvipc"> for information on how to
1748         adjust those parameters, if necessary.
1749        </para>
1750       </listitem>
1751      </varlistentry>
1752
1753      <varlistentry id="guc-wal-writer-delay" xreflabel="wal_writer_delay">
1754       <term><varname>wal_writer_delay</varname> (<type>integer</type>)</term>
1755       <indexterm>
1756        <primary><varname>wal_writer_delay</> configuration parameter</primary>
1757       </indexterm>
1758       <listitem>
1759        <para>
1760         Specifies the delay between activity rounds for the WAL writer.
1761         In each round the writer will flush WAL to disk. It then sleeps for
1762         <varname>wal_writer_delay</> milliseconds, and repeats.  The default
1763         value is 200 milliseconds (<literal>200ms</>).  Note that on many
1764         systems, the effective resolution of sleep delays is 10 milliseconds;
1765         setting <varname>wal_writer_delay</> to a value that is not a multiple
1766         of 10 might have the same results as setting it to the next higher
1767         multiple of 10. This parameter can only be set in the
1768         <filename>postgresql.conf</> file or on the server command line.
1769        </para>
1770       </listitem>
1771      </varlistentry>
1772
1773      <varlistentry id="guc-commit-delay" xreflabel="commit_delay">
1774       <term><varname>commit_delay</varname> (<type>integer</type>)</term>
1775       <indexterm>
1776        <primary><varname>commit_delay</> configuration parameter</primary>
1777       </indexterm>
1778       <listitem>
1779        <para>
1780         When the commit data for a transaction is flushed to disk, any
1781         additional commits ready at that time are also flushed out.
1782         <varname>commit_delay</varname> adds a time delay, set in
1783         microseconds, before a transaction attempts to
1784         flush the WAL buffer out to disk.  A nonzero delay can allow more
1785         transactions to be committed with only one flush operation, if
1786         system load is high enough that additional transactions become
1787         ready to commit within the given interval. But the delay is
1788         just wasted if no other transactions become ready to
1789         commit. Therefore, the delay is only performed if at least
1790         <varname>commit_siblings</varname> other transactions are
1791         active at the instant that a server process has written its
1792         commit record.
1793         The default <varname>commit_delay</> is zero (no delay).
1794         Since all pending commit data will be written at every flush
1795         regardless of this setting, it is rare that adding delay
1796         by increasing this parameter will actually improve performance.
1797        </para>
1798       </listitem>
1799      </varlistentry>
1800
1801      <varlistentry id="guc-commit-siblings" xreflabel="commit_siblings">
1802       <term><varname>commit_siblings</varname> (<type>integer</type>)</term>
1803       <indexterm>
1804        <primary><varname>commit_siblings</> configuration parameter</primary>
1805       </indexterm>
1806       <listitem>
1807        <para>
1808         Minimum number of concurrent open transactions to require
1809         before performing the <varname>commit_delay</> delay. A larger
1810         value makes it more probable that at least one other
1811         transaction will become ready to commit during the delay
1812         interval. The default is five transactions.
1813        </para>
1814       </listitem>
1815      </varlistentry>
1816
1817      </variablelist>
1818      </sect2>
1819      <sect2 id="runtime-config-wal-checkpoints">
1820      <title>Checkpoints</title>
1821
1822     <variablelist>
1823      <varlistentry id="guc-checkpoint-segments" xreflabel="checkpoint_segments">
1824       <term><varname>checkpoint_segments</varname> (<type>integer</type>)</term>
1825       <indexterm>
1826        <primary><varname>checkpoint_segments</> configuration parameter</primary>
1827       </indexterm>
1828       <listitem>
1829        <para>
1830         Maximum number of log file segments between automatic WAL
1831         checkpoints (each segment is normally 16 megabytes). The default
1832         is three segments.  Increasing this parameter can increase the
1833         amount of time needed for crash recovery.
1834         This parameter can only be set in the <filename>postgresql.conf</>
1835         file or on the server command line.
1836        </para>
1837       </listitem>
1838      </varlistentry>
1839
1840      <varlistentry id="guc-checkpoint-timeout" xreflabel="checkpoint_timeout">
1841       <term><varname>checkpoint_timeout</varname> (<type>integer</type>)</term>
1842       <indexterm>
1843        <primary><varname>checkpoint_timeout</> configuration parameter</primary>
1844       </indexterm>
1845       <listitem>
1846        <para>
1847         Maximum time between automatic WAL checkpoints, in
1848         seconds. The default is five minutes (<literal>5min</>).
1849         Increasing this parameter can increase the amount of time needed
1850         for crash recovery.
1851         This parameter can only be set in the <filename>postgresql.conf</>
1852         file or on the server command line.
1853        </para>
1854       </listitem>
1855      </varlistentry>
1856
1857      <varlistentry id="guc-checkpoint-completion-target" xreflabel="checkpoint_completion_target">
1858       <term><varname>checkpoint_completion_target</varname> (<type>floating point</type>)</term>
1859       <indexterm>
1860        <primary><varname>checkpoint_completion_target</> configuration parameter</primary>
1861       </indexterm>
1862       <listitem>
1863        <para>
1864         Specifies the target of checkpoint completion, as a fraction of
1865         total time between checkpoints. The default is 0.5.
1866
1867         This parameter can only be set in the <filename>postgresql.conf</>
1868         file or on the server command line.
1869        </para>
1870       </listitem>
1871      </varlistentry>
1872
1873      <varlistentry id="guc-checkpoint-warning" xreflabel="checkpoint_warning">
1874       <term><varname>checkpoint_warning</varname> (<type>integer</type>)</term>
1875       <indexterm>
1876        <primary><varname>checkpoint_warning</> configuration parameter</primary>
1877       </indexterm>
1878       <listitem>
1879        <para>
1880         Write a message to the server log if checkpoints caused by
1881         the filling of checkpoint segment files happen closer together
1882         than this many seconds (which suggests that
1883         <varname>checkpoint_segments</> ought to be raised).  The default is
1884         30 seconds (<literal>30s</>).  Zero disables the warning.
1885         This parameter can only be set in the <filename>postgresql.conf</>
1886         file or on the server command line.
1887        </para>
1888       </listitem>
1889      </varlistentry>
1890
1891      </variablelist>
1892      </sect2>
1893      <sect2 id="runtime-config-wal-archiving">
1894      <title>Archiving</title>
1895
1896     <variablelist>
1897      <varlistentry id="guc-archive-mode" xreflabel="archive_mode">
1898       <term><varname>archive_mode</varname> (<type>boolean</type>)</term>
1899       <indexterm>
1900        <primary><varname>archive_mode</> configuration parameter</primary>
1901       </indexterm>
1902       <listitem>
1903        <para>
1904         When <varname>archive_mode</> is enabled, completed WAL segments
1905         are sent to archive storage by setting
1906         <xref linkend="guc-archive-command">.
1907         <varname>archive_mode</> and <varname>archive_command</> are
1908         separate variables so that <varname>archive_command</> can be
1909         changed without leaving archiving mode.
1910         This parameter can only be set at server start.
1911         <varname>archive_mode</> cannot be enabled when
1912         <varname>wal_level</> is set to <literal>minimal</>.
1913        </para>
1914       </listitem>
1915      </varlistentry>
1916
1917      <varlistentry id="guc-archive-command" xreflabel="archive_command">
1918       <term><varname>archive_command</varname> (<type>string</type>)</term>
1919       <indexterm>
1920        <primary><varname>archive_command</> configuration parameter</primary>
1921       </indexterm>
1922       <listitem>
1923        <para>
1924         The shell command to execute to archive a completed WAL file
1925         segment.  Any <literal>%p</> in the string is
1926         replaced by the path name of the file to archive, and any
1927         <literal>%f</> is replaced by only the file name.
1928         (The path name is relative to the working directory of the server,
1929         i.e., the cluster's data directory.)
1930         Use <literal>%%</> to embed an actual <literal>%</> character in the
1931         command.  It is important for the command to return a zero
1932         exit status only if it succeeds. For more information see
1933         <xref linkend="backup-archiving-wal">.
1934        </para>
1935        <para>
1936         This parameter can only be set in the <filename>postgresql.conf</>
1937         file or on the server command line.  It is ignored unless
1938         <varname>archive_mode</> was enabled at server start.
1939         If <varname>archive_command</> is an empty string (the default) while
1940         <varname>archive_mode</> is enabled, WAL archiving is temporarily
1941         disabled, but the server continues to accumulate WAL segment files in
1942         the expectation that a command will soon be provided.  Setting
1943         <varname>archive_command</> to a command that does nothing but
1944         return true, e.g. <literal>/bin/true</> (<literal>REM</> on
1945         Windows), effectively disables
1946         archiving, but also breaks the chain of WAL files needed for
1947         archive recovery, so it should only be used in unusual circumstances.
1948        </para>
1949       </listitem>
1950      </varlistentry>
1951
1952      <varlistentry id="guc-archive-timeout" xreflabel="archive_timeout">
1953       <term><varname>archive_timeout</varname> (<type>integer</type>)</term>
1954       <indexterm>
1955        <primary><varname>archive_timeout</> configuration parameter</primary>
1956       </indexterm>
1957       <listitem>
1958        <para>
1959         The <xref linkend="guc-archive-command"> is only invoked for
1960         completed WAL segments. Hence, if your server generates little WAL
1961         traffic (or has slack periods where it does so), there could be a
1962         long delay between the completion of a transaction and its safe
1963         recording in archive storage.  To limit how old unarchived
1964         data can be, you can set <varname>archive_timeout</> to force the
1965         server to switch to a new WAL segment file periodically.  When this
1966         parameter is greater than zero, the server will switch to a new
1967         segment file whenever this many seconds have elapsed since the last
1968         segment file switch, and there has been any database activity,
1969         including a single checkpoint.  (Increasing
1970         <varname>checkpoint_timeout</> will reduce unnecessary
1971         checkpoints on an idle system.)
1972         Note that archived files that are closed early
1973         due to a forced switch are still the same length as completely full
1974         files.  Therefore, it is unwise to use a very short
1975         <varname>archive_timeout</> &mdash; it will bloat your archive
1976         storage.  <varname>archive_timeout</> settings of a minute or so are
1977         usually reasonable.  You should consider using streaming replication,
1978         instead of archiving, if you want data to be copied off the master
1979         server more quickly than that.
1980         This parameter can only be set in the
1981         <filename>postgresql.conf</> file or on the server command line.
1982        </para>
1983       </listitem>
1984      </varlistentry>
1985
1986      </variablelist>
1987     </sect2>
1988
1989    </sect1>
1990
1991    <sect1 id="runtime-config-replication">
1992     <title>Replication</title>
1993
1994     <para>
1995      These settings control the behavior of the built-in
1996      <firstterm>streaming replication</> feature (see
1997      <xref linkend="streaming-replication">).  Servers will be either a
1998      Master or a Standby server.  Masters can send data, while Standby(s)
1999      are always receivers of replicated data.  When cascading replication
2000      (see <xref linkend="cascading-replication">) is used, Standby server(s)
2001      can also be senders, as well as receivers.
2002      Parameters are mainly for Sending and Standby servers, though some
2003      parameters have meaning only on the Master server.  Settings may vary
2004      across the cluster without problems if that is required.
2005     </para>
2006
2007     <sect2 id="runtime-config-replication-sender">
2008      <title>Sending Server(s)</title>
2009
2010      <para>
2011       These parameters can be set on any server that is
2012       to send replication data to one or more standby servers.
2013       The master is always a sending server, so these parameters must
2014       always be set on the master.
2015       The role and meaning of these parameters does not change after a
2016       standby becomes the master.
2017      </para>
2018
2019      <variablelist>
2020       <varlistentry id="guc-max-wal-senders" xreflabel="max_wal_senders">
2021        <term><varname>max_wal_senders</varname> (<type>integer</type>)</term>
2022        <indexterm>
2023         <primary><varname>max_wal_senders</> configuration parameter</primary>
2024        </indexterm>
2025        <listitem>
2026        <para>
2027         Specifies the maximum number of concurrent connections from standby
2028         servers or streaming base backup clients (i.e., the maximum number of
2029         simultaneously running WAL sender
2030         processes). The default is zero. This parameter can only be set at
2031         server start. <varname>wal_level</> must be set to <literal>archive</>
2032         or <literal>hot_standby</> to allow connections from standby servers.
2033        </para>
2034        </listitem>
2035       </varlistentry>
2036
2037       <varlistentry id="guc-wal-keep-segments" xreflabel="wal_keep_segments">
2038        <term><varname>wal_keep_segments</varname> (<type>integer</type>)</term>
2039        <indexterm>
2040         <primary><varname>wal_keep_segments</> configuration parameter</primary>
2041        </indexterm>
2042        <listitem>
2043        <para>
2044         Specifies the minimum number of past log file segments kept in the
2045         <filename>pg_xlog</>
2046         directory, in case a standby server needs to fetch them for streaming
2047         replication. Each segment is normally 16 megabytes. If a standby
2048         server connected to the sending server falls behind by more than
2049         <varname>wal_keep_segments</> segments, the sending server might remove
2050         a WAL segment still needed by the standby, in which case the
2051         replication connection will be terminated.  Downstream connections
2052         will also eventually fail as a result.  (However, the standby
2053         server can recover by fetching the segment from archive, if WAL
2054         archiving is in use.)
2055        </para>
2056
2057        <para>
2058         This sets only the minimum number of segments retained in
2059         <filename>pg_xlog</>; the system might need to retain more segments
2060         for WAL archival or to recover from a checkpoint. If
2061         <varname>wal_keep_segments</> is zero (the default), the system
2062         doesn't keep any extra segments for standby purposes, so the number
2063         of old WAL segments available to standby servers is a function of
2064         the location of the previous checkpoint and status of WAL
2065         archiving.
2066         This parameter can only be set in the
2067         <filename>postgresql.conf</> file or on the server command line.
2068        </para>
2069        </listitem>
2070       </varlistentry>
2071
2072      <varlistentry id="guc-replication-timeout" xreflabel="replication_timeout">
2073       <term><varname>replication_timeout</varname> (<type>integer</type>)</term>
2074       <indexterm>
2075        <primary><varname>replication_timeout</> configuration parameter</primary>
2076       </indexterm>
2077       <listitem>
2078        <para>
2079         Terminate replication connections that are inactive longer
2080         than the specified number of milliseconds. This is useful for
2081         the sending server to detect a standby crash or network outage.
2082         A value of zero disables the timeout mechanism.  This parameter
2083         can only be set in
2084         the <filename>postgresql.conf</> file or on the server command line.
2085         The default value is 60 seconds.
2086        </para>
2087        <para>
2088         To prevent connections from being terminated prematurely,
2089         <xref linkend="guc-wal-receiver-status-interval">
2090         must be enabled on the standby, and its value must be less than the
2091         value of <varname>replication_timeout</>.
2092        </para>
2093       </listitem>
2094      </varlistentry>
2095
2096      </variablelist>
2097     </sect2>
2098
2099     <sect2 id="runtime-config-replication-master">
2100      <title>Master Server</title>
2101
2102      <para>
2103       These parameters can be set on the master/primary server that is
2104       to send replication data to one or more standby servers.
2105       Note that in addition to these parameters,
2106       <xref linkend="guc-wal-level"> must be set appropriately on the master
2107       server, and optionally WAL archiving can be enabled as
2108       well (see <xref linkend="runtime-config-wal-archiving">).
2109       The values of these parameters on standby servers are irrelevant,
2110       although you may wish to set them there in preparation for the
2111       possibility of a standby becoming the master.
2112      </para>
2113
2114     <variablelist>
2115
2116      <varlistentry id="guc-synchronous-standby-names" xreflabel="synchronous_standby_names">
2117       <term><varname>synchronous_standby_names</varname> (<type>string</type>)</term>
2118       <indexterm>
2119        <primary><varname>synchronous_standby_names</> configuration parameter</primary>
2120       </indexterm>
2121       <listitem>
2122        <para>
2123         Specifies a comma-separated list of standby names that can support
2124         <firstterm>synchronous replication</>, as described in
2125         <xref linkend="synchronous-replication">.
2126         At any one time there will be at most one active synchronous standby;
2127         transactions waiting for commit will be allowed to proceed after
2128         this standby server confirms receipt of their data.
2129         The synchronous standby will be the first standby named in this list
2130         that is both currently connected and streaming data in real-time
2131         (as shown by a state of <literal>streaming</literal> in the
2132         <link linkend="monitoring-stats-views-table">
2133         <literal>pg_stat_replication</></link> view).
2134         Other standby servers appearing later in this list represent potential
2135         synchronous standbys.
2136         If the current synchronous standby disconnects for whatever reason,
2137         it will be replaced immediately with the next-highest-priority standby.
2138         Specifying more than one standby name can allow very high availability.
2139        </para>
2140        <para>
2141         The name of a standby server for this purpose is the
2142         <varname>application_name</> setting of the standby, as set in the
2143         <varname>primary_conninfo</> of the standby's walreceiver.  There is
2144         no mechanism to enforce uniqueness. In case of duplicates one of the
2145         matching standbys will be chosen to be the synchronous standby, though
2146         exactly which one is indeterminate.
2147         The special entry <literal>*</> matches any
2148         <varname>application_name</>, including the default application name
2149         of <literal>walreceiver</>.
2150        </para>
2151        <para>
2152         If no synchronous standby names are specified here, then synchronous
2153         replication is not enabled and transaction commits will not wait for
2154         replication.  This is the default configuration.  Even when
2155         synchronous replication is enabled, individual transactions can be
2156         configured not to wait for replication by setting the
2157         <xref linkend="guc-synchronous-commit"> parameter to
2158         <literal>local</> or <literal>off</>.
2159        </para>
2160        <para>
2161         This parameter can only be set in the <filename>postgresql.conf</>
2162         file or on the server command line.
2163        </para>
2164       </listitem>
2165      </varlistentry>
2166
2167      <varlistentry id="guc-vacuum-defer-cleanup-age" xreflabel="vacuum_defer_cleanup_age">
2168       <term><varname>vacuum_defer_cleanup_age</varname> (<type>integer</type>)</term>
2169       <indexterm>
2170        <primary><varname>vacuum_defer_cleanup_age</> configuration parameter</primary>
2171       </indexterm>
2172       <listitem>
2173        <para>
2174         Specifies the number of transactions by which <command>VACUUM</> and
2175         <acronym>HOT</> updates will defer cleanup of dead row versions. The
2176         default is zero transactions, meaning that dead row versions can be
2177         removed as soon as possible, that is, as soon as they are no longer
2178         visible to any open transaction.  You may wish to set this to a
2179         non-zero value on a primary server that is supporting hot standby
2180         servers, as described in <xref linkend="hot-standby">.  This allows
2181         more time for queries on the standby to complete without incurring
2182         conflicts due to early cleanup of rows.  However, since the value
2183         is measured in terms of number of write transactions occurring on the
2184         primary server, it is difficult to predict just how much additional
2185         grace time will be made available to standby queries.
2186         This parameter can only be set in the <filename>postgresql.conf</>
2187         file or on the server command line.
2188        </para>
2189        <para>
2190         You should also consider setting <varname>hot_standby_feedback</>
2191         on standby server(s) as an alternative to using this parameter.
2192        </para>
2193       </listitem>
2194      </varlistentry>
2195
2196      </variablelist>
2197     </sect2>
2198
2199     <sect2 id="runtime-config-replication-standby">
2200      <title>Standby Servers</title>
2201
2202      <para>
2203       These settings control the behavior of a standby server that is
2204       to receive replication data.  Their values on the master server
2205       are irrelevant.
2206      </para>
2207
2208     <variablelist>
2209
2210      <varlistentry id="guc-hot-standby" xreflabel="hot_standby">
2211       <term><varname>hot_standby</varname> (<type>boolean</type>)</term>
2212       <indexterm>
2213        <primary><varname>hot_standby</> configuration parameter</primary>
2214       </indexterm>
2215       <listitem>
2216        <para>
2217         Specifies whether or not you can connect and run queries during
2218         recovery, as described in <xref linkend="hot-standby">.
2219         The default value is <literal>off</literal>.
2220         This parameter can only be set at server start. It only has effect
2221         during archive recovery or in standby mode.
2222        </para>
2223       </listitem>
2224      </varlistentry>
2225
2226      <varlistentry id="guc-max-standby-archive-delay" xreflabel="max_standby_archive_delay">
2227       <term><varname>max_standby_archive_delay</varname> (<type>integer</type>)</term>
2228       <indexterm>
2229        <primary><varname>max_standby_archive_delay</> configuration parameter</primary>
2230       </indexterm>
2231       <listitem>
2232        <para>
2233         When Hot Standby is active, this parameter determines how long the
2234         standby server should wait before canceling standby queries that
2235         conflict with about-to-be-applied WAL entries, as described in
2236         <xref linkend="hot-standby-conflict">.
2237         <varname>max_standby_archive_delay</> applies when WAL data is
2238         being read from WAL archive (and is therefore not current).
2239         The default is 30 seconds. Units are milliseconds if not specified.
2240         A value of -1 allows the standby to wait forever for conflicting
2241         queries to complete.
2242         This parameter can only be set in the <filename>postgresql.conf</>
2243         file or on the server command line.
2244        </para>
2245        <para>
2246         Note that <varname>max_standby_archive_delay</> is not the same as the
2247         maximum length of time a query can run before cancellation; rather it
2248         is the maximum total time allowed to apply any one WAL segment's data.
2249         Thus, if one query has resulted in significant delay earlier in the
2250         WAL segment, subsequent conflicting queries will have much less grace
2251         time.
2252        </para>
2253       </listitem>
2254      </varlistentry>
2255
2256      <varlistentry id="guc-max-standby-streaming-delay" xreflabel="max_standby_streaming_delay">
2257       <term><varname>max_standby_streaming_delay</varname> (<type>integer</type>)</term>
2258       <indexterm>
2259        <primary><varname>max_standby_streaming_delay</> configuration parameter</primary>
2260       </indexterm>
2261       <listitem>
2262        <para>
2263         When Hot Standby is active, this parameter determines how long the
2264         standby server should wait before canceling standby queries that
2265         conflict with about-to-be-applied WAL entries, as described in
2266         <xref linkend="hot-standby-conflict">.
2267         <varname>max_standby_streaming_delay</> applies when WAL data is
2268         being received via streaming replication.
2269         The default is 30 seconds. Units are milliseconds if not specified.
2270         A value of -1 allows the standby to wait forever for conflicting
2271         queries to complete.
2272         This parameter can only be set in the <filename>postgresql.conf</>
2273         file or on the server command line.
2274        </para>
2275        <para>
2276         Note that <varname>max_standby_streaming_delay</> is not the same as
2277         the maximum length of time a query can run before cancellation; rather
2278         it is the maximum total time allowed to apply WAL data once it has
2279         been received from the primary server.  Thus, if one query has
2280         resulted in significant delay, subsequent conflicting queries will
2281         have much less grace time until the standby server has caught up
2282         again.
2283        </para>
2284       </listitem>
2285      </varlistentry>
2286
2287      <varlistentry id="guc-wal-receiver-status-interval" xreflabel="wal_receiver_status_interval">
2288       <term><varname>wal_receiver_status_interval</varname> (<type>integer</type>)</term>
2289       <indexterm>
2290        <primary><varname>wal_receiver_status_interval</> configuration parameter</primary>
2291       </indexterm>
2292       <listitem>
2293       <para>
2294        Specifies the minimum frequency for the WAL receiver
2295        process on the standby to send information about replication progress
2296        to the primary or upstream standby, where it can be seen using the
2297        <link linkend="monitoring-stats-views-table">
2298        <literal>pg_stat_replication</></link> view.  The standby will report
2299        the last transaction log position it has written, the last position it
2300        has flushed to disk, and the last position it has applied.
2301        This parameter's
2302        value is the maximum interval, in seconds, between reports.  Updates are
2303        sent each time the write or flush positions change, or at least as
2304        often as specified by this parameter.  Thus, the apply position may
2305        lag slightly behind the true position.  Setting this parameter to zero
2306        disables status updates completely.  This parameter can only be set in
2307        the <filename>postgresql.conf</> file or on the server command line.
2308        The default value is 10 seconds.
2309       </para>
2310       <para>
2311        When <xref linkend="guc-replication-timeout"> is enabled on a sending server,
2312        <varname>wal_receiver_status_interval</> must be enabled, and its value
2313        must be less than the value of <varname>replication_timeout</>.
2314       </para>
2315       </listitem>
2316      </varlistentry>
2317
2318      <varlistentry id="guc-hot-standby-feedback" xreflabel="hot_standby">
2319       <term><varname>hot_standby_feedback</varname> (<type>boolean</type>)</term>
2320       <indexterm>
2321        <primary><varname>hot_standby_feedback</> configuration parameter</primary>
2322       </indexterm>
2323       <listitem>
2324        <para>
2325         Specifies whether or not a hot standby will send feedback to the primary
2326         or upstream standby
2327         about queries currently executing on the standby. This parameter can
2328         be used to eliminate query cancels caused by cleanup records, but
2329         can cause database bloat on the primary for some workloads.
2330         Feedback messages will not be sent more frequently than once per
2331         <varname>wal_receiver_status_interval</>. The default value is
2332         <literal>off</literal>. This parameter can only be set in the
2333         <filename>postgresql.conf</> file or on the server command line.
2334        </para>
2335        <para>
2336         If cascaded replication is in use the feedback is passed upstream
2337         until it eventually reaches the primary.  Standbys make no other use
2338         of feedback they receive other than to pass upstream.
2339        </para>
2340       </listitem>
2341      </varlistentry>
2342
2343      </variablelist>
2344     </sect2>
2345    </sect1>
2346
2347    <sect1 id="runtime-config-query">
2348     <title>Query Planning</title>
2349
2350     <sect2 id="runtime-config-query-enable">
2351      <title>Planner Method Configuration</title>
2352
2353       <para>
2354        These configuration parameters provide a crude method of
2355        influencing the query plans chosen by the query optimizer. If
2356        the default plan chosen by the optimizer for a particular query
2357        is not optimal, a <emphasis>temporary</> solution is to use one
2358        of these configuration parameters to force the optimizer to
2359        choose a different plan.
2360        Better ways to improve the quality of the
2361        plans chosen by the optimizer include adjusting the planer cost
2362        constants (see <xref linkend="runtime-config-query-constants">),
2363        running <xref linkend="sql-analyze"> manually, increasing
2364        the value of the <xref
2365        linkend="guc-default-statistics-target"> configuration parameter,
2366        and increasing the amount of statistics collected for
2367        specific columns using <command>ALTER TABLE SET
2368        STATISTICS</command>.
2369       </para>
2370
2371      <variablelist>
2372      <varlistentry id="guc-enable-bitmapscan" xreflabel="enable_bitmapscan">
2373       <term><varname>enable_bitmapscan</varname> (<type>boolean</type>)</term>
2374       <indexterm>
2375        <primary>bitmap scan</primary>
2376       </indexterm>
2377       <indexterm>
2378        <primary><varname>enable_bitmapscan</> configuration parameter</primary>
2379       </indexterm>
2380       <listitem>
2381        <para>
2382         Enables or disables the query planner's use of bitmap-scan plan
2383         types. The default is <literal>on</>.
2384        </para>
2385       </listitem>
2386      </varlistentry>
2387
2388      <varlistentry id="guc-enable-hashagg" xreflabel="enable_hashagg">
2389       <term><varname>enable_hashagg</varname> (<type>boolean</type>)</term>
2390       <indexterm>
2391        <primary><varname>enable_hashagg</> configuration parameter</primary>
2392       </indexterm>
2393       <listitem>
2394        <para>
2395         Enables or disables the query planner's use of hashed
2396         aggregation plan types. The default is <literal>on</>.
2397        </para>
2398       </listitem>
2399      </varlistentry>
2400
2401      <varlistentry id="guc-enable-hashjoin" xreflabel="enable_hashjoin">
2402       <term><varname>enable_hashjoin</varname> (<type>boolean</type>)</term>
2403       <indexterm>
2404        <primary><varname>enable_hashjoin</> configuration parameter</primary>
2405       </indexterm>
2406       <listitem>
2407        <para>
2408         Enables or disables the query planner's use of hash-join plan
2409         types. The default is <literal>on</>.
2410        </para>
2411       </listitem>
2412      </varlistentry>
2413
2414      <varlistentry id="guc-enable-indexscan" xreflabel="enable_indexscan">
2415       <term><varname>enable_indexscan</varname> (<type>boolean</type>)</term>
2416       <indexterm>
2417        <primary>index scan</primary>
2418       </indexterm>
2419       <indexterm>
2420        <primary><varname>enable_indexscan</> configuration parameter</primary>
2421       </indexterm>
2422       <listitem>
2423        <para>
2424         Enables or disables the query planner's use of index-scan plan
2425         types. The default is <literal>on</>.
2426        </para>
2427       </listitem>
2428      </varlistentry>
2429
2430      <varlistentry id="guc-enable-indexonlyscan" xreflabel="enable_indexonlyscan">
2431       <term><varname>enable_indexonlyscan</varname> (<type>boolean</type>)</term>
2432       <indexterm>
2433        <primary>index-only scan</primary>
2434       </indexterm>
2435       <indexterm>
2436        <primary><varname>enable_indexonlyscan</> configuration parameter</primary>
2437       </indexterm>
2438       <listitem>
2439        <para>
2440         Enables or disables the query planner's use of index-only-scan plan
2441         types. The default is <literal>on</>.
2442        </para>
2443       </listitem>
2444      </varlistentry>
2445
2446      <varlistentry id="guc-enable-material" xreflabel="enable_material">
2447       <term><varname>enable_material</varname> (<type>boolean</type>)</term>
2448       <indexterm>
2449        <primary><varname>enable_material</> configuration parameter</primary>
2450       </indexterm>
2451       <listitem>
2452        <para>
2453         Enables or disables the query planner's use of materialization.
2454         It is impossible to suppress materialization entirely,
2455         but turning this variable off prevents the planner from inserting
2456         materialize nodes except in cases where it is required for correctness.
2457         The default is <literal>on</>.
2458        </para>
2459       </listitem>
2460      </varlistentry>
2461
2462      <varlistentry id="guc-enable-mergejoin" xreflabel="enable_mergejoin">
2463       <term><varname>enable_mergejoin</varname> (<type>boolean</type>)</term>
2464       <indexterm>
2465        <primary><varname>enable_mergejoin</> configuration parameter</primary>
2466       </indexterm>
2467       <listitem>
2468        <para>
2469         Enables or disables the query planner's use of merge-join plan
2470         types. The default is <literal>on</>.
2471        </para>
2472       </listitem>
2473      </varlistentry>
2474
2475      <varlistentry id="guc-enable-nestloop" xreflabel="enable_nestloop">
2476       <term><varname>enable_nestloop</varname> (<type>boolean</type>)</term>
2477       <indexterm>
2478        <primary><varname>enable_nestloop</> configuration parameter</primary>
2479       </indexterm>
2480       <listitem>
2481        <para>
2482         Enables or disables the query planner's use of nested-loop join
2483         plans. It is impossible to suppress nested-loop joins entirely,
2484         but turning this variable off discourages the planner from using
2485         one if there are other methods available. The default is
2486         <literal>on</>.
2487        </para>
2488       </listitem>
2489      </varlistentry>
2490
2491      <varlistentry id="guc-enable-seqscan" xreflabel="enable_seqscan">
2492       <term><varname>enable_seqscan</varname> (<type>boolean</type>)</term>
2493       <indexterm>
2494        <primary>sequential scan</primary>
2495       </indexterm>
2496       <indexterm>
2497        <primary><varname>enable_seqscan</> configuration parameter</primary>
2498       </indexterm>
2499       <listitem>
2500        <para>
2501         Enables or disables the query planner's use of sequential scan
2502         plan types. It is impossible to suppress sequential scans
2503         entirely, but turning this variable off discourages the planner
2504         from using one if there are other methods available. The
2505         default is <literal>on</>.
2506        </para>
2507       </listitem>
2508      </varlistentry>
2509
2510      <varlistentry id="guc-enable-sort" xreflabel="enable_sort">
2511       <term><varname>enable_sort</varname> (<type>boolean</type>)</term>
2512       <indexterm>
2513        <primary><varname>enable_sort</> configuration parameter</primary>
2514       </indexterm>
2515       <listitem>
2516        <para>
2517         Enables or disables the query planner's use of explicit sort
2518         steps. It is impossible to suppress explicit sorts entirely,
2519         but turning this variable off discourages the planner from
2520         using one if there are other methods available. The default
2521         is <literal>on</>.
2522        </para>
2523       </listitem>
2524      </varlistentry>
2525
2526      <varlistentry id="guc-enable-tidscan" xreflabel="enable_tidscan">
2527       <term><varname>enable_tidscan</varname> (<type>boolean</type>)</term>
2528       <indexterm>
2529        <primary><varname>enable_tidscan</> configuration parameter</primary>
2530       </indexterm>
2531       <listitem>
2532        <para>
2533         Enables or disables the query planner's use of <acronym>TID</>
2534         scan plan types. The default is <literal>on</>.
2535        </para>
2536       </listitem>
2537      </varlistentry>
2538
2539      </variablelist>
2540      </sect2>
2541      <sect2 id="runtime-config-query-constants">
2542      <title>Planner Cost Constants</title>
2543
2544     <para>
2545      The <firstterm>cost</> variables described in this section are measured
2546      on an arbitrary scale.  Only their relative values matter, hence
2547      scaling them all up or down by the same factor will result in no change
2548      in the planner's choices.  By default, these cost variables are based on
2549      the cost of sequential page fetches; that is,
2550      <varname>seq_page_cost</> is conventionally set to <literal>1.0</>
2551      and the other cost variables are set with reference to that.  But
2552      you can use a different scale if you prefer, such as actual execution
2553      times in milliseconds on a particular machine.
2554     </para>
2555
2556    <note>
2557     <para>
2558      Unfortunately, there is no well-defined method for determining ideal
2559      values for the cost variables.  They are best treated as averages over
2560      the entire mix of queries that a particular installation will receive.  This
2561      means that changing them on the basis of just a few experiments is very
2562      risky.
2563     </para>
2564    </note>
2565
2566      <variablelist>
2567
2568      <varlistentry id="guc-seq-page-cost" xreflabel="seq_page_cost">
2569       <term><varname>seq_page_cost</varname> (<type>floating point</type>)</term>
2570       <indexterm>
2571        <primary><varname>seq_page_cost</> configuration parameter</primary>
2572       </indexterm>
2573       <listitem>
2574        <para>
2575         Sets the planner's estimate of the cost of a disk page fetch
2576         that is part of a series of sequential fetches.  The default is 1.0.
2577         This value can be overridden for tables and indexes in a particular
2578         tablespace by setting the tablespace parameter of the same name
2579         (see <xref linkend="sql-altertablespace">).
2580        </para>
2581       </listitem>
2582      </varlistentry>
2583
2584      <varlistentry id="guc-random-page-cost" xreflabel="random_page_cost">
2585       <term><varname>random_page_cost</varname> (<type>floating point</type>)</term>
2586       <indexterm>
2587        <primary><varname>random_page_cost</> configuration parameter</primary>
2588       </indexterm>
2589       <listitem>
2590        <para>
2591         Sets the planner's estimate of the cost of a
2592         non-sequentially-fetched disk page.  The default is 4.0.
2593         This value can be overridden for tables and indexes in a particular
2594         tablespace by setting the tablespace parameter of the same name
2595         (see <xref linkend="sql-altertablespace">).
2596        </para>
2597
2598        <para>
2599         Reducing this value relative to <varname>seq_page_cost</>
2600         will cause the system to prefer index scans; raising it will
2601         make index scans look relatively more expensive.  You can raise
2602         or lower both values together to change the importance of disk I/O
2603         costs relative to CPU costs, which are described by the following
2604         parameters.
2605        </para>
2606
2607        <tip>
2608         <para>
2609          Although the system will let you set <varname>random_page_cost</> to
2610          less than <varname>seq_page_cost</>, it is not physically sensible
2611          to do so.  However, setting them equal makes sense if the database
2612          is entirely cached in RAM, since in that case there is no penalty
2613          for touching pages out of sequence.  Also, in a heavily-cached
2614          database you should lower both values relative to the CPU parameters,
2615          since the cost of fetching a page already in RAM is much smaller
2616          than it would normally be.
2617         </para>
2618        </tip>
2619       </listitem>
2620      </varlistentry>
2621
2622      <varlistentry id="guc-cpu-tuple-cost" xreflabel="cpu_tuple_cost">
2623       <term><varname>cpu_tuple_cost</varname> (<type>floating point</type>)</term>
2624       <indexterm>
2625        <primary><varname>cpu_tuple_cost</> configuration parameter</primary>
2626       </indexterm>
2627       <listitem>
2628        <para>
2629         Sets the planner's estimate of the cost of processing
2630         each row during a query.
2631         The default is 0.01.
2632        </para>
2633       </listitem>
2634      </varlistentry>
2635
2636      <varlistentry id="guc-cpu-index-tuple-cost" xreflabel="cpu_index_tuple_cost">
2637       <term><varname>cpu_index_tuple_cost</varname> (<type>floating point</type>)</term>
2638       <indexterm>
2639        <primary><varname>cpu_index_tuple_cost</> configuration parameter</primary>
2640       </indexterm>
2641       <listitem>
2642        <para>
2643         Sets the planner's estimate of the cost of processing
2644         each index entry during an index scan.
2645         The default is 0.005.
2646        </para>
2647       </listitem>
2648      </varlistentry>
2649
2650      <varlistentry id="guc-cpu-operator-cost" xreflabel="cpu_operator_cost">
2651       <term><varname>cpu_operator_cost</varname> (<type>floating point</type>)</term>
2652       <indexterm>
2653        <primary><varname>cpu_operator_cost</> configuration parameter</primary>
2654       </indexterm>
2655       <listitem>
2656        <para>
2657         Sets the planner's estimate of the cost of processing each
2658         operator or function executed during a query.
2659         The default is 0.0025.
2660        </para>
2661       </listitem>
2662      </varlistentry>
2663
2664      <varlistentry id="guc-effective-cache-size" xreflabel="effective_cache_size">
2665       <term><varname>effective_cache_size</varname> (<type>integer</type>)</term>
2666       <indexterm>
2667        <primary><varname>effective_cache_size</> configuration parameter</primary>
2668       </indexterm>
2669       <listitem>
2670        <para>
2671         Sets the planner's assumption about the effective size of the
2672         disk cache that is available to a single query.  This is
2673         factored into estimates of the cost of using an index; a
2674         higher value makes it more likely index scans will be used, a
2675         lower value makes it more likely sequential scans will be
2676         used. When setting this parameter you should consider both
2677         <productname>PostgreSQL</productname>'s shared buffers and the
2678         portion of the kernel's disk cache that will be used for
2679         <productname>PostgreSQL</productname> data files.  Also, take
2680         into account the expected number of concurrent queries on different
2681         tables, since they will have to share the available
2682         space.  This parameter has no effect on the size of shared
2683         memory allocated by <productname>PostgreSQL</productname>, nor
2684         does it reserve kernel disk cache; it is used only for estimation
2685         purposes.  The system also does not assume data remains in
2686         the disk cache between queries.  The default is 128 megabytes
2687         (<literal>128MB</>).
2688        </para>
2689       </listitem>
2690      </varlistentry>
2691
2692      </variablelist>
2693
2694     </sect2>
2695      <sect2 id="runtime-config-query-geqo">
2696      <title>Genetic Query Optimizer</title>
2697
2698      <para>
2699       The genetic query optimizer (GEQO) is an algorithm that does query
2700       planning using heuristic searching.  This reduces planning time for
2701       complex queries (those joining many relations), at the cost of producing
2702       plans that are sometimes inferior to those found by the normal
2703       exhaustive-search algorithm.  Also, GEQO's searching is randomized and
2704       therefore its plans may vary nondeterministically.
2705       For more information see <xref linkend="geqo">.
2706      </para>
2707
2708      <variablelist>
2709
2710      <varlistentry id="guc-geqo" xreflabel="geqo">
2711       <indexterm>
2712        <primary>genetic query optimization</primary>
2713       </indexterm>
2714       <indexterm>
2715        <primary>GEQO</primary>
2716        <see>genetic query optimization</see>
2717       </indexterm>
2718       <indexterm>
2719        <primary><varname>geqo</> configuration parameter</primary>
2720       </indexterm>
2721       <term><varname>geqo</varname> (<type>boolean</type>)</term>
2722       <listitem>
2723        <para>
2724         Enables or disables genetic query optimization.
2725         This is on by default.  It is usually best not to turn it off in
2726         production; the <varname>geqo_threshold</varname> variable provides
2727         more granular control of GEQO.
2728        </para>
2729       </listitem>
2730      </varlistentry>
2731
2732      <varlistentry id="guc-geqo-threshold" xreflabel="geqo_threshold">
2733       <term><varname>geqo_threshold</varname> (<type>integer</type>)</term>
2734       <indexterm>
2735        <primary><varname>geqo_threshold</> configuration parameter</primary>
2736       </indexterm>
2737       <listitem>
2738        <para>
2739         Use genetic query optimization to plan queries with at least
2740         this many <literal>FROM</> items involved. (Note that a
2741         <literal>FULL OUTER JOIN</> construct counts as only one <literal>FROM</>
2742         item.) The default is 12. For simpler queries it is usually best
2743         to use the deterministic, exhaustive planner, but for queries with
2744         many tables the deterministic planner takes too long, often
2745         longer than the penalty of executing a suboptimal plan.
2746        </para>
2747       </listitem>
2748      </varlistentry>
2749
2750      <varlistentry id="guc-geqo-effort" xreflabel="geqo_effort">
2751       <term><varname>geqo_effort</varname>
2752       (<type>integer</type>)</term>
2753       <indexterm>
2754        <primary><varname>geqo_effort</> configuration parameter</primary>
2755       </indexterm>
2756       <listitem>
2757        <para>
2758         Controls the trade-off between planning time and query plan
2759         quality in GEQO. This variable must be an integer in the
2760         range from 1 to 10. The default value is five. Larger values
2761         increase the time spent doing query planning, but also
2762         increase the likelihood that an efficient query plan will be
2763         chosen.
2764        </para>
2765
2766        <para>
2767         <varname>geqo_effort</varname> doesn't actually do anything
2768         directly; it is only used to compute the default values for
2769         the other variables that influence GEQO behavior (described
2770         below). If you prefer, you can set the other parameters by
2771         hand instead.
2772        </para>
2773       </listitem>
2774      </varlistentry>
2775
2776      <varlistentry id="guc-geqo-pool-size" xreflabel="geqo_pool_size">
2777       <term><varname>geqo_pool_size</varname> (<type>integer</type>)</term>
2778       <indexterm>
2779        <primary><varname>geqo_pool_size</> configuration parameter</primary>
2780       </indexterm>
2781       <listitem>
2782        <para>
2783         Controls the pool size used by GEQO, that is the
2784         number of individuals in the genetic population.  It must be
2785         at least two, and useful values are typically 100 to 1000.  If
2786         it is set to zero (the default setting) then a suitable
2787         value is chosen based on <varname>geqo_effort</varname> and
2788         the number of tables in the query.
2789        </para>
2790       </listitem>
2791      </varlistentry>
2792
2793      <varlistentry id="guc-geqo-generations" xreflabel="geqo_generations">
2794       <term><varname>geqo_generations</varname> (<type>integer</type>)</term>
2795       <indexterm>
2796        <primary><varname>geqo_generations</> configuration parameter</primary>
2797       </indexterm>
2798       <listitem>
2799        <para>
2800         Controls the number of generations used by GEQO, that is
2801         the number of iterations of the algorithm.  It must
2802         be at least one, and useful values are in the same range as
2803         the pool size.  If it is set to zero (the default setting)
2804         then a suitable value is chosen based on
2805         <varname>geqo_pool_size</varname>.
2806        </para>
2807       </listitem>
2808      </varlistentry>
2809
2810      <varlistentry id="guc-geqo-selection-bias" xreflabel="geqo_selection_bias">
2811       <term><varname>geqo_selection_bias</varname> (<type>floating point</type>)</term>
2812       <indexterm>
2813        <primary><varname>geqo_selection_bias</> configuration parameter</primary>
2814       </indexterm>
2815       <listitem>
2816        <para>
2817         Controls the selection bias used by GEQO. The selection bias
2818         is the selective pressure within the population. Values can be
2819         from 1.50 to 2.00; the latter is the default.
2820        </para>
2821       </listitem>
2822      </varlistentry>
2823
2824      <varlistentry id="guc-geqo-seed" xreflabel="geqo_seed">
2825       <term><varname>geqo_seed</varname> (<type>floating point</type>)</term>
2826       <indexterm>
2827        <primary><varname>geqo_seed</> configuration parameter</primary>
2828       </indexterm>
2829       <listitem>
2830        <para>
2831         Controls the initial value of the random number generator used
2832         by GEQO to select random paths through the join order search space.
2833         The value can range from zero (the default) to one.  Varying the
2834         value changes the set of join paths explored, and may result in a
2835         better or worse best path being found.
2836        </para>
2837       </listitem>
2838      </varlistentry>
2839
2840      </variablelist>
2841     </sect2>
2842      <sect2 id="runtime-config-query-other">
2843      <title>Other Planner Options</title>
2844
2845      <variablelist>
2846
2847      <varlistentry id="guc-default-statistics-target" xreflabel="default_statistics_target">
2848       <term><varname>default_statistics_target</varname> (<type>integer</type>)</term>
2849       <indexterm>
2850        <primary><varname>default_statistics_target</> configuration parameter</primary>
2851       </indexterm>
2852       <listitem>
2853        <para>
2854         Sets the default statistics target for table columns without
2855         a column-specific target set via <command>ALTER TABLE
2856         SET STATISTICS</>.  Larger values increase the time needed to
2857         do <command>ANALYZE</>, but might improve the quality of the
2858         planner's estimates. The default is 100. For more information
2859         on the use of statistics by the <productname>PostgreSQL</>
2860         query planner, refer to <xref linkend="planner-stats">.
2861        </para>
2862       </listitem>
2863      </varlistentry>
2864
2865      <varlistentry id="guc-constraint-exclusion" xreflabel="constraint_exclusion">
2866       <term><varname>constraint_exclusion</varname> (<type>enum</type>)</term>
2867       <indexterm>
2868        <primary>constraint exclusion</primary>
2869       </indexterm>
2870       <indexterm>
2871        <primary><varname>constraint_exclusion</> configuration parameter</primary>
2872       </indexterm>
2873       <listitem>
2874        <para>
2875         Controls the query planner's use of table constraints to
2876         optimize queries.
2877         The allowed values of <varname>constraint_exclusion</> are
2878         <literal>on</> (examine constraints for all tables),
2879         <literal>off</> (never examine constraints), and
2880         <literal>partition</> (examine constraints only for inheritance child
2881         tables and <literal>UNION ALL</> subqueries).
2882         <literal>partition</> is the default setting.
2883         It is often used with inheritance and partitioned tables to
2884         improve performance.
2885       </para>
2886
2887        <para>
2888         When this parameter allows it for a particular table, the planner
2889         compares query conditions with the table's <literal>CHECK</>
2890         constraints, and omits scanning tables for which the conditions
2891         contradict the constraints.  For example:
2892
2893 <programlisting>
2894 CREATE TABLE parent(key integer, ...);
2895 CREATE TABLE child1000(check (key between 1000 and 1999)) INHERITS(parent);
2896 CREATE TABLE child2000(check (key between 2000 and 2999)) INHERITS(parent);
2897 ...
2898 SELECT * FROM parent WHERE key = 2400;
2899 </programlisting>
2900
2901         With constraint exclusion enabled, this <command>SELECT</>
2902         will not scan <structname>child1000</> at all, improving performance.
2903        </para>
2904
2905        <para>
2906         Currently, constraint exclusion is enabled by default
2907         only for cases that are often used to implement table partitioning.
2908         Turning it on for all tables imposes extra planning overhead that is
2909         quite noticeable on simple queries, and most often will yield no
2910         benefit for simple queries.  If you have no partitioned tables
2911         you might prefer to turn it off entirely.
2912        </para>
2913
2914        <para>
2915         Refer to <xref linkend="ddl-partitioning-constraint-exclusion"> for
2916         more information on using constraint exclusion and partitioning.
2917        </para>
2918       </listitem>
2919      </varlistentry>
2920
2921      <varlistentry id="guc-cursor-tuple-fraction" xreflabel="cursor_tuple_fraction">
2922       <term><varname>cursor_tuple_fraction</varname> (<type>floating point</type>)</term>
2923       <indexterm>
2924        <primary><varname>cursor_tuple_fraction</> configuration parameter</primary>
2925       </indexterm>
2926       <listitem>
2927        <para>
2928         Sets the planner's estimate of the fraction of a cursor's rows that
2929         will be retrieved.  The default is 0.1.  Smaller values of this
2930         setting bias the planner towards using <quote>fast start</> plans
2931         for cursors, which will retrieve the first few rows quickly while
2932         perhaps taking a long time to fetch all rows.  Larger values
2933         put more emphasis on the total estimated time.  At the maximum
2934         setting of 1.0, cursors are planned exactly like regular queries,
2935         considering only the total estimated time and not how soon the
2936         first rows might be delivered.
2937        </para>
2938       </listitem>
2939      </varlistentry>
2940
2941      <varlistentry id="guc-from-collapse-limit" xreflabel="from_collapse_limit">
2942       <term><varname>from_collapse_limit</varname> (<type>integer</type>)</term>
2943       <indexterm>
2944        <primary><varname>from_collapse_limit</> configuration parameter</primary>
2945       </indexterm>
2946       <listitem>
2947        <para>
2948         The planner will merge sub-queries into upper queries if the
2949         resulting <literal>FROM</literal> list would have no more than
2950         this many items.  Smaller values reduce planning time but might
2951         yield inferior query plans.  The default is eight.
2952         For more information see <xref linkend="explicit-joins">.
2953        </para>
2954
2955        <para>
2956         Setting this value to <xref linkend="guc-geqo-threshold"> or more
2957         may trigger use of the GEQO planner, resulting in nondeterministic
2958         plans.  See <xref linkend="runtime-config-query-geqo">.
2959        </para>
2960       </listitem>
2961      </varlistentry>
2962
2963      <varlistentry id="guc-join-collapse-limit" xreflabel="join_collapse_limit">
2964       <term><varname>join_collapse_limit</varname> (<type>integer</type>)</term>
2965       <indexterm>
2966        <primary><varname>join_collapse_limit</> configuration parameter</primary>
2967       </indexterm>
2968       <listitem>
2969        <para>
2970         The planner will rewrite explicit <literal>JOIN</>
2971         constructs (except <literal>FULL JOIN</>s) into lists of
2972         <literal>FROM</> items whenever a list of no more than this many items
2973         would result.  Smaller values reduce planning time but might
2974         yield inferior query plans.
2975        </para>
2976
2977        <para>
2978         By default, this variable is set the same as
2979         <varname>from_collapse_limit</varname>, which is appropriate
2980         for most uses. Setting it to 1 prevents any reordering of
2981         explicit <literal>JOIN</>s. Thus, the explicit join order
2982         specified in the query will be the actual order in which the
2983         relations are joined. Because the query planner does not always choose
2984         the optimal join order, advanced users can elect to
2985         temporarily set this variable to 1, and then specify the join
2986         order they desire explicitly.
2987         For more information see <xref linkend="explicit-joins">.
2988        </para>
2989
2990        <para>
2991         Setting this value to <xref linkend="guc-geqo-threshold"> or more
2992         may trigger use of the GEQO planner, resulting in nondeterministic
2993         plans.  See <xref linkend="runtime-config-query-geqo">.
2994        </para>
2995       </listitem>
2996      </varlistentry>
2997
2998      </variablelist>
2999     </sect2>
3000    </sect1>
3001
3002    <sect1 id="runtime-config-logging">
3003     <title>Error Reporting and Logging</title>
3004
3005     <indexterm zone="runtime-config-logging">
3006      <primary>server log</primary>
3007     </indexterm>
3008
3009     <sect2 id="runtime-config-logging-where">
3010      <title>Where To Log</title>
3011
3012      <indexterm zone="runtime-config-logging-where">
3013       <primary>where to log</primary>
3014      </indexterm>
3015
3016      <variablelist>
3017
3018      <varlistentry id="guc-log-destination" xreflabel="log_destination">
3019       <term><varname>log_destination</varname> (<type>string</type>)</term>
3020       <indexterm>
3021        <primary><varname>log_destination</> configuration parameter</primary>
3022       </indexterm>
3023       <listitem>
3024        <para>
3025         <productname>PostgreSQL</productname> supports several methods
3026          for logging server messages, including
3027          <systemitem>stderr</systemitem>, <systemitem>csvlog</systemitem> and
3028          <systemitem>syslog</systemitem>. On Windows,
3029          <systemitem>eventlog</systemitem> is also supported. Set this
3030          parameter to a list of desired log destinations separated by
3031          commas. The default is to log to <systemitem>stderr</systemitem>
3032          only.
3033          This parameter can only be set in the <filename>postgresql.conf</>
3034          file or on the server command line.
3035        </para>
3036        <para>
3037         If <systemitem>csvlog</> is included in <varname>log_destination</>,
3038         log entries are output in <quote>comma separated
3039         value</> (<acronym>CSV</>) format, which is convenient for
3040         loading logs into programs.
3041         See <xref linkend="runtime-config-logging-csvlog"> for details.
3042         <varname>logging_collector</varname> must be enabled to generate
3043         CSV-format log output.
3044        </para>
3045
3046        <note>
3047         <para>
3048          On most Unix systems, you will need to alter the configuration of
3049          your system's <application>syslog</application> daemon in order
3050          to make use of the <systemitem>syslog</systemitem> option for
3051          <varname>log_destination</>.  <productname>PostgreSQL</productname>
3052          can log to <application>syslog</application> facilities
3053          <literal>LOCAL0</> through <literal>LOCAL7</> (see <xref
3054          linkend="guc-syslog-facility">), but the default
3055          <application>syslog</application> configuration on most platforms
3056          will discard all such messages.  You will need to add something like:
3057 <programlisting>
3058 local0.*    /var/log/postgresql
3059 </programlisting>
3060          to the  <application>syslog</application> daemon's configuration file
3061          to make it work.
3062         </para>
3063         <para>
3064          On Windows, when you use the <literal>eventlog</literal>
3065          option for <varname>log_destination</>, you should
3066          register an event source and its library with the operating
3067          system so that the Windows Event Viewer can display event
3068          log messages cleanly.
3069          See <xref linkend="event-log-registration"> for details.
3070         </para>
3071        </note>
3072       </listitem>
3073      </varlistentry>
3074
3075      <varlistentry id="guc-logging-collector" xreflabel="logging_collector">
3076       <term><varname>logging_collector</varname> (<type>boolean</type>)</term>
3077       <indexterm>
3078        <primary><varname>logging_collector</> configuration parameter</primary>
3079       </indexterm>
3080       <listitem>
3081        <para>
3082          This parameter captures plain and CSV-format log messages
3083          sent to <application>stderr</> and redirects them into log files.
3084          This approach is often more useful than
3085          logging to <application>syslog</>, since some types of messages
3086          might not appear in <application>syslog</> output (a common example
3087          is dynamic-linker failure messages).
3088          This parameter can only be set at server start.
3089        </para>
3090
3091        <note>
3092         <para>
3093           The logging collector is designed to never lose messages.  This means
3094           that in case of extremely high load, server processes could be
3095           blocked due to trying to send additional log messages when the
3096           collector has fallen behind.  In contrast, <application>syslog</>
3097           prefers to drop messages if it cannot write them, which means it's
3098           less reliable in those cases but it will not block the rest of the
3099           system.
3100         </para>
3101        </note>
3102
3103       </listitem>
3104      </varlistentry>
3105
3106      <varlistentry id="guc-log-directory" xreflabel="log_directory">
3107       <term><varname>log_directory</varname> (<type>string</type>)</term>
3108       <indexterm>
3109        <primary><varname>log_directory</> configuration parameter</primary>
3110       </indexterm>
3111       <listitem>
3112        <para>
3113         When <varname>logging_collector</> is enabled,
3114         this parameter determines the directory in which log files will be created.
3115         It can be specified as an absolute path, or relative to the
3116         cluster data directory.
3117         This parameter can only be set in the <filename>postgresql.conf</>
3118         file or on the server command line.
3119        </para>
3120       </listitem>
3121      </varlistentry>
3122
3123      <varlistentry id="guc-log-filename" xreflabel="log_filename">
3124       <term><varname>log_filename</varname> (<type>string</type>)</term>
3125       <indexterm>
3126        <primary><varname>log_filename</> configuration parameter</primary>
3127       </indexterm>
3128       <listitem>
3129        <para>
3130         When <varname>logging_collector</varname> is enabled,
3131         this parameter sets the file names of the created log files.  The value
3132         is treated as a <systemitem>strftime</systemitem> pattern,
3133         so <literal>%</literal>-escapes can be used to specify time-varying
3134         file names.  (Note that if there are
3135         any time-zone-dependent <literal>%</literal>-escapes, the computation
3136         is done in the zone specified
3137         by <xref linkend="guc-log-timezone">.)
3138         The supported <literal>%</literal>-escapes are similar to those
3139         listed in the Open Group's <ulink
3140         url="http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime
3141         </ulink> specification.
3142         Note that the system's <systemitem>strftime</systemitem> is not used
3143         directly, so platform-specific (nonstandard) extensions do not work.
3144        </para>
3145        <para>
3146         If you specify a file name without escapes, you should plan to
3147         use a log rotation utility to avoid eventually filling the
3148         entire disk.  In releases prior to 8.4, if
3149         no <literal>%</literal> escapes were
3150         present, <productname>PostgreSQL</productname> would append
3151         the epoch of the new log file's creation time, but this is no
3152         longer the case.
3153        </para>
3154        <para>
3155         If CSV-format output is enabled in <varname>log_destination</>,
3156         <literal>.csv</> will be appended to the timestamped
3157         log file name to create the file name for CSV-format output.
3158         (If <varname>log_filename</> ends in <literal>.log</>, the suffix is
3159         replaced instead.)
3160         In the case of the example above, the CSV
3161         file name will be <literal>server_log.1093827753.csv</literal>.
3162        </para>
3163        <para>
3164         This parameter can only be set in the <filename>postgresql.conf</>
3165         file or on the server command line.
3166        </para>
3167       </listitem>
3168      </varlistentry>
3169
3170      <varlistentry id="guc-log-file-mode" xreflabel="log_file_mode">
3171       <term><varname>log_file_mode</varname> (<type>integer</type>)</term>
3172       <indexterm>
3173        <primary><varname>log_file_mode</> configuration parameter</primary>
3174       </indexterm>
3175       <listitem>
3176        <para>
3177         On Unix systems this parameter sets the permissions for log files
3178         when <varname>logging_collector</varname> is enabled. (On Microsoft
3179         Windows this parameter is ignored.)
3180         The parameter value is expected to be a numeric mode
3181         specified in the format accepted by the
3182         <function>chmod</function> and <function>umask</function>
3183         system calls.  (To use the customary octal format the number
3184         must start with a <literal>0</literal> (zero).)
3185        </para>
3186        <para>
3187         The default permissions are <literal>0600</>, meaning only the
3188         server owner can read or write the log files.  The other commonly
3189         useful setting is <literal>0640</>, allowing members of the owner's
3190         group to read the files.  Note however that to make use of such a
3191         setting, you'll need to alter <xref linkend="guc-log-directory"> to
3192         store the files somewhere outside the cluster data directory.  In
3193         any case, it's unwise to make the log files world-readable, since
3194         they might contain sensitive data.
3195        </para>
3196        <para>
3197         This parameter can only be set in the <filename>postgresql.conf</>
3198         file or on the server command line.
3199        </para>
3200       </listitem>
3201      </varlistentry>
3202
3203      <varlistentry id="guc-log-rotation-age" xreflabel="log_rotation_age">
3204       <term><varname>log_rotation_age</varname> (<type>integer</type>)</term>
3205       <indexterm>
3206        <primary><varname>log_rotation_age</> configuration parameter</primary>
3207       </indexterm>
3208       <listitem>
3209        <para>
3210         When <varname>logging_collector</varname> is enabled,
3211         this parameter determines the maximum lifetime of an individual log file.
3212         After this many minutes have elapsed, a new log file will
3213         be created.  Set to zero to disable time-based creation of
3214         new log files.
3215         This parameter can only be set in the <filename>postgresql.conf</>
3216         file or on the server command line.
3217        </para>
3218       </listitem>
3219      </varlistentry>
3220
3221      <varlistentry id="guc-log-rotation-size" xreflabel="log_rotation_size">
3222       <term><varname>log_rotation_size</varname> (<type>integer</type>)</term>
3223       <indexterm>
3224        <primary><varname>log_rotation_size</> configuration parameter</primary>
3225       </indexterm>
3226       <listitem>
3227        <para>
3228         When <varname>logging_collector</varname> is enabled,
3229         this parameter determines the maximum size of an individual log file.
3230         After this many kilobytes have been emitted into a log file,
3231         a new log file will be created.  Set to zero to disable size-based
3232         creation of new log files.
3233         This parameter can only be set in the <filename>postgresql.conf</>
3234         file or on the server command line.
3235        </para>
3236       </listitem>
3237      </varlistentry>
3238
3239      <varlistentry id="guc-log-truncate-on-rotation" xreflabel="log_truncate_on_rotation">
3240       <term><varname>log_truncate_on_rotation</varname> (<type>boolean</type>)</term>
3241       <indexterm>
3242        <primary><varname>log_truncate_on_rotation</> configuration parameter</primary>
3243       </indexterm>
3244       <listitem>
3245        <para>
3246         When <varname>logging_collector</varname> is enabled,
3247         this parameter will cause <productname>PostgreSQL</productname> to truncate (overwrite),
3248         rather than append to, any existing log file of the same name.
3249         However, truncation will occur only when a new file is being opened
3250         due to time-based rotation, not during server startup or size-based
3251         rotation.  When off, pre-existing files will be appended to in
3252         all cases.  For example, using this setting in combination with
3253         a <varname>log_filename</varname> like <literal>postgresql-%H.log</literal>
3254         would result in generating twenty-four hourly log files and then
3255         cyclically overwriting them.
3256         This parameter can only be set in the <filename>postgresql.conf</>
3257         file or on the server command line.
3258        </para>
3259        <para>
3260         Example:  To keep 7 days of logs, one log file per day named
3261         <literal>server_log.Mon</literal>, <literal>server_log.Tue</literal>,
3262         etc, and automatically overwrite last week's log with this week's log,
3263         set <varname>log_filename</varname> to <literal>server_log.%a</literal>,
3264         <varname>log_truncate_on_rotation</varname> to <literal>on</literal>, and
3265         <varname>log_rotation_age</varname> to <literal>1440</literal>.
3266        </para>
3267        <para>
3268         Example: To keep 24 hours of logs, one log file per hour, but
3269         also rotate sooner if the log file size exceeds 1GB, set
3270         <varname>log_filename</varname> to <literal>server_log.%H%M</literal>,
3271         <varname>log_truncate_on_rotation</varname> to <literal>on</literal>,
3272         <varname>log_rotation_age</varname> to <literal>60</literal>, and
3273         <varname>log_rotation_size</varname> to <literal>1000000</literal>.
3274         Including <literal>%M</> in <varname>log_filename</varname> allows
3275         any size-driven rotations that might occur to select a file name
3276         different from the hour's initial file name.
3277        </para>
3278       </listitem>
3279      </varlistentry>
3280
3281      <varlistentry id="guc-syslog-facility" xreflabel="syslog_facility">
3282       <term><varname>syslog_facility</varname> (<type>enum</type>)</term>
3283       <indexterm>
3284        <primary><varname>syslog_facility</> configuration parameter</primary>
3285       </indexterm>
3286       <listitem>
3287        <para>
3288         When logging to <application>syslog</> is enabled, this parameter
3289         determines the <application>syslog</application>
3290         <quote>facility</quote> to be used.  You can choose
3291         from <literal>LOCAL0</>, <literal>LOCAL1</>,
3292         <literal>LOCAL2</>, <literal>LOCAL3</>, <literal>LOCAL4</>,
3293         <literal>LOCAL5</>, <literal>LOCAL6</>, <literal>LOCAL7</>;
3294         the default is <literal>LOCAL0</>. See also the
3295         documentation of your system's
3296         <application>syslog</application> daemon.
3297         This parameter can only be set in the <filename>postgresql.conf</>
3298         file or on the server command line.
3299        </para>
3300       </listitem>
3301      </varlistentry>
3302
3303      <varlistentry id="guc-syslog-ident" xreflabel="syslog_ident">
3304       <term><varname>syslog_ident</varname> (<type>string</type>)</term>
3305       <indexterm>
3306        <primary><varname>syslog_identity</> configuration parameter</primary>
3307       </indexterm>
3308        <listitem>
3309         <para>
3310          When logging to <application>syslog</> is enabled, this parameter
3311          determines the program name used to identify
3312          <productname>PostgreSQL</productname> messages in
3313          <application>syslog</application> logs. The default is
3314          <literal>postgres</literal>.
3315          This parameter can only be set in the <filename>postgresql.conf</>
3316          file or on the server command line.
3317         </para>
3318        </listitem>
3319       </varlistentry>
3320
3321      <varlistentry id="guc-event-source" xreflabel="event_source">
3322       <term><varname>event_source</varname> (<type>string</type>)</term>
3323       <indexterm>
3324        <primary><varname>event_source</> configuration parameter</primary>
3325       </indexterm>
3326       <listitem>
3327        <para>
3328         When logging to <application>event log</> is enabled, this parameter
3329         determines the program name used to identify
3330         <productname>PostgreSQL</productname> messages in
3331         the log. The default is <literal>PostgreSQL</literal>.
3332         This parameter can only be set in the <filename>postgresql.conf</>
3333         file or on the server command line.
3334        </para>
3335       </listitem>
3336      </varlistentry>
3337
3338       </variablelist>
3339     </sect2>
3340      <sect2 id="runtime-config-logging-when">
3341      <title>When To Log</title>
3342
3343      <variablelist>
3344
3345      <varlistentry id="guc-client-min-messages" xreflabel="client_min_messages">
3346       <term><varname>client_min_messages</varname> (<type>enum</type>)</term>
3347       <indexterm>
3348        <primary><varname>client_min_messages</> configuration parameter</primary>
3349       </indexterm>
3350       <listitem>
3351        <para>
3352         Controls which message levels are sent to the client.
3353         Valid values are <literal>DEBUG5</>,
3354         <literal>DEBUG4</>, <literal>DEBUG3</>, <literal>DEBUG2</>,
3355         <literal>DEBUG1</>, <literal>LOG</>, <literal>NOTICE</>,
3356         <literal>WARNING</>, <literal>ERROR</>, <literal>FATAL</>,
3357         and <literal>PANIC</>.  Each level
3358         includes all the levels that follow it.  The later the level,
3359         the fewer messages are sent.  The default is
3360         <literal>NOTICE</>.  Note that <literal>LOG</> has a different
3361         rank here than in <varname>log_min_messages</>.
3362        </para>
3363       </listitem>
3364      </varlistentry>
3365
3366      <varlistentry id="guc-log-min-messages" xreflabel="log_min_messages">
3367       <term><varname>log_min_messages</varname> (<type>enum</type>)</term>
3368       <indexterm>
3369        <primary><varname>log_min_messages</> configuration parameter</primary>
3370       </indexterm>
3371       <listitem>
3372        <para>
3373         Controls which message levels are written to the server log.
3374         Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
3375         <literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>,
3376         <literal>INFO</>, <literal>NOTICE</>, <literal>WARNING</>,
3377         <literal>ERROR</>, <literal>LOG</>, <literal>FATAL</>, and
3378         <literal>PANIC</>.  Each level includes all the levels that
3379         follow it.  The later the level, the fewer messages are sent
3380         to the log.  The default is <literal>WARNING</>.  Note that
3381         <literal>LOG</> has a different rank here than in
3382         <varname>client_min_messages</>.
3383         Only superusers can change this setting.
3384        </para>
3385       </listitem>
3386      </varlistentry>
3387
3388      <varlistentry id="guc-log-min-error-statement" xreflabel="log_min_error_statement">
3389       <term><varname>log_min_error_statement</varname> (<type>enum</type>)</term>
3390       <indexterm>
3391        <primary><varname>log_min_error_statement</> configuration parameter</primary>
3392       </indexterm>
3393       <listitem>
3394        <para>
3395         Controls which SQL statements that cause an error
3396         condition are recorded in the server log.  The current
3397         SQL statement is included in the log entry for any message of
3398         the specified severity or higher.
3399         Valid values are <literal>DEBUG5</literal>,
3400         <literal>DEBUG4</literal>, <literal>DEBUG3</literal>,
3401         <literal>DEBUG2</literal>, <literal>DEBUG1</literal>,
3402         <literal>INFO</literal>, <literal>NOTICE</literal>,
3403         <literal>WARNING</literal>, <literal>ERROR</literal>,
3404         <literal>LOG</literal>,
3405         <literal>FATAL</literal>, and <literal>PANIC</literal>.
3406         The default is <literal>ERROR</literal>, which means statements
3407         causing errors, log messages, fatal errors, or panics will be logged.
3408         To effectively turn off logging of failing statements,
3409         set this parameter to <literal>PANIC</literal>.
3410         Only superusers can change this setting.
3411        </para>
3412       </listitem>
3413      </varlistentry>
3414
3415      <varlistentry id="guc-log-min-duration-statement" xreflabel="log_min_duration_statement">
3416       <term><varname>log_min_duration_statement</varname> (<type>integer</type>)</term>
3417       <indexterm>
3418        <primary><varname>log_min_duration_statement</> configuration parameter</primary>
3419       </indexterm>
3420        <listitem>
3421         <para>
3422          Causes the duration of each completed statement to be logged
3423          if the statement ran for at least the specified number of
3424          milliseconds.  Setting this to zero prints all statement durations.
3425          Minus-one (the default) disables logging statement durations.
3426          For example, if you set it to <literal>250ms</literal>
3427          then all SQL statements that run 250ms or longer will be
3428          logged.  Enabling this parameter can be helpful in tracking down
3429          unoptimized queries in your applications.
3430          Only superusers can change this setting.
3431         </para>
3432
3433         <para>
3434          For clients using extended query protocol, durations of the Parse,
3435          Bind, and Execute steps are logged independently.
3436         </para>
3437
3438        <note>
3439         <para>
3440          When using this option together with
3441          <xref linkend="guc-log-statement">,
3442          the text of statements that are logged because of
3443          <varname>log_statement</> will not be repeated in the
3444          duration log message.
3445          If you are not using <application>syslog</>, it is recommended
3446          that you log the PID or session ID using
3447          <xref linkend="guc-log-line-prefix">
3448          so that you can link the statement message to the later
3449          duration message using the process ID or session ID.
3450         </para>
3451        </note>
3452        </listitem>
3453       </varlistentry>
3454
3455      </variablelist>
3456
3457     <para>
3458      <xref linkend="runtime-config-severity-levels"> explains the message
3459      severity levels used by <productname>PostgreSQL</>.  If logging output
3460      is sent to <systemitem>syslog</systemitem> or Windows'
3461      <systemitem>eventlog</systemitem>, the severity levels are translated
3462      as shown in the table.
3463     </para>
3464
3465     <table id="runtime-config-severity-levels">
3466      <title>Message Severity Levels</title>
3467      <tgroup cols="4">
3468       <thead>
3469        <row>
3470         <entry>Severity</entry>
3471         <entry>Usage</entry>
3472         <entry><systemitem>syslog</></entry>
3473         <entry><systemitem>eventlog</></entry>
3474        </row>
3475       </thead>
3476
3477       <tbody>
3478        <row>
3479         <entry><literal>DEBUG1..DEBUG5</></entry>
3480         <entry>Provides successively-more-detailed information for use by
3481          developers.</entry>
3482         <entry><literal>DEBUG</></entry>
3483         <entry><literal>INFORMATION</></entry>
3484        </row>
3485
3486        <row>
3487         <entry><literal>INFO</></entry>
3488         <entry>Provides information implicitly requested by the user,
3489          e.g., output from <command>VACUUM VERBOSE</>.</entry>
3490         <entry><literal>INFO</></entry>
3491         <entry><literal>INFORMATION</></entry>
3492        </row>
3493
3494        <row>
3495         <entry><literal>NOTICE</></entry>
3496         <entry>Provides information that might be helpful to users, e.g.,
3497          notice of truncation of long identifiers.</entry>
3498         <entry><literal>NOTICE</></entry>
3499         <entry><literal>INFORMATION</></entry>
3500        </row>
3501
3502        <row>
3503         <entry><literal>WARNING</></entry>
3504         <entry>Provides warnings of likely problems, e.g., <command>COMMIT</>
3505          outside a transaction block.</entry>
3506         <entry><literal>NOTICE</></entry>
3507         <entry><literal>WARNING</></entry>
3508        </row>
3509
3510        <row>
3511         <entry><literal>ERROR</></entry>
3512         <entry>Reports an error that caused the current command to
3513          abort.</entry>
3514         <entry><literal>WARNING</></entry>
3515         <entry><literal>ERROR</></entry>
3516        </row>
3517
3518        <row>
3519         <entry><literal>LOG</></entry>
3520         <entry>Reports information of interest to administrators, e.g.,
3521          checkpoint activity.</entry>
3522         <entry><literal>INFO</></entry>
3523         <entry><literal>INFORMATION</></entry>
3524        </row>
3525
3526        <row>
3527         <entry><literal>FATAL</></entry>
3528         <entry>Reports an error that caused the current session to
3529          abort.</entry>
3530         <entry><literal>ERR</></entry>
3531         <entry><literal>ERROR</></entry>
3532        </row>
3533
3534        <row>
3535         <entry><literal>PANIC</></entry>
3536         <entry>Reports an error that caused all database sessions to abort.</entry>
3537         <entry><literal>CRIT</></entry>
3538         <entry><literal>ERROR</></entry>
3539        </row>
3540       </tbody>
3541      </tgroup>
3542     </table>
3543
3544     </sect2>
3545      <sect2 id="runtime-config-logging-what">
3546      <title>What To Log</title>
3547
3548      <variablelist>
3549
3550      <varlistentry id="guc-application-name" xreflabel="application_name">
3551       <term><varname>application_name</varname> (<type>string</type>)</term>
3552       <indexterm>
3553        <primary><varname>application_name</> configuration parameter</primary>
3554       </indexterm>
3555       <listitem>
3556        <para>
3557         The <varname>application_name</varname> can be any string of less than
3558         <symbol>NAMEDATALEN</> characters (64 characters in a standard build).
3559         It is typically set by an application upon connection to the server.
3560         The name will be displayed in the <structname>pg_stat_activity</> view
3561         and included in CSV log entries.  It can also be included in regular
3562         log entries via the <xref linkend="guc-log-line-prefix"> parameter.
3563         Only printable ASCII characters may be used in the
3564         <varname>application_name</varname> value. Other characters will be
3565         replaced with question marks (<literal>?</literal>).
3566        </para>
3567       </listitem>
3568      </varlistentry>
3569
3570      <varlistentry>
3571       <term><varname>debug_print_parse</varname> (<type>boolean</type>)</term>
3572       <term><varname>debug_print_rewritten</varname> (<type>boolean</type>)</term>
3573       <term><varname>debug_print_plan</varname> (<type>boolean</type>)</term>
3574       <indexterm>
3575        <primary><varname>debug_print_parse</> configuration parameter</primary>
3576       </indexterm>
3577       <indexterm>
3578        <primary><varname>debug_print_rewritten</> configuration parameter</primary>
3579       </indexterm>
3580       <indexterm>
3581        <primary><varname>debug_print_plan</> configuration parameter</primary>
3582       </indexterm>
3583       <listitem>
3584        <para>
3585         These parameters enable various debugging output to be emitted.
3586         When set, they print the resulting parse tree, the query rewriter
3587         output, or the execution plan for each executed query.
3588         These messages are emitted at <literal>LOG</> message level, so by
3589         default they will appear in the server log but will not be sent to the
3590         client.  You can change that by adjusting
3591         <xref linkend="guc-client-min-messages"> and/or
3592         <xref linkend="guc-log-min-messages">.
3593         These parameters are off by default.
3594        </para>
3595       </listitem>
3596      </varlistentry>
3597
3598      <varlistentry>
3599       <term><varname>debug_pretty_print</varname> (<type>boolean</type>)</term>
3600       <indexterm>
3601        <primary><varname>debug_pretty_print</> configuration parameter</primary>
3602       </indexterm>
3603       <listitem>
3604        <para>
3605         When set, <varname>debug_pretty_print</varname> indents the messages
3606         produced by <varname>debug_print_parse</varname>,
3607         <varname>debug_print_rewritten</varname>, or
3608         <varname>debug_print_plan</varname>.  This results in more readable
3609         but much longer output than the <quote>compact</> format used when
3610         it is off.  It is on by default.
3611        </para>
3612       </listitem>
3613      </varlistentry>
3614
3615      <varlistentry id="guc-log-checkpoints" xreflabel="log_checkpoints">
3616       <term><varname>log_checkpoints</varname> (<type>boolean</type>)</term>
3617       <indexterm>
3618        <primary><varname>log_checkpoints</> configuration parameter</primary>
3619       </indexterm>
3620       <listitem>
3621        <para>
3622         Causes checkpoints and restartpoints to be logged in the server log.
3623         Some statistics are included in the log messages, including the number
3624         of buffers written and the time spent writing them.
3625         This parameter can only be set in the <filename>postgresql.conf</>
3626         file or on the server command line. The default is off.
3627        </para>
3628       </listitem>
3629      </varlistentry>
3630
3631      <varlistentry id="guc-log-connections" xreflabel="log_connections">
3632       <term><varname>log_connections</varname> (<type>boolean</type>)</term>
3633       <indexterm>
3634        <primary><varname>log_connections</> configuration parameter</primary>
3635       </indexterm>
3636       <listitem>
3637        <para>
3638         Causes each attempted connection to the server to be logged,
3639         as well as successful completion of client authentication.
3640         This parameter cannot be changed after session start.
3641         The default is off.
3642        </para>
3643
3644        <note>
3645         <para>
3646          Some client programs, like <application>psql</>, attempt
3647          to connect twice while determining if a password is required, so
3648          duplicate <quote>connection received</> messages do not
3649          necessarily indicate a problem.
3650         </para>
3651        </note>
3652       </listitem>
3653      </varlistentry>
3654
3655      <varlistentry id="guc-log-disconnections" xreflabel="log_disconnections">
3656       <term><varname>log_disconnections</varname> (<type>boolean</type>)</term>
3657       <indexterm>
3658        <primary><varname>log_disconnections</> configuration parameter</primary>
3659       </indexterm>
3660       <listitem>
3661        <para>
3662         This outputs a line in the server log similar to
3663         <varname>log_connections</varname> but at session termination,
3664         and includes the duration of the session.  This is off by
3665         default.
3666         This parameter cannot be changed after session start.
3667        </para>
3668       </listitem>
3669      </varlistentry>
3670
3671
3672      <varlistentry id="guc-log-duration" xreflabel="log_duration">
3673       <term><varname>log_duration</varname> (<type>boolean</type>)</term>
3674       <indexterm>
3675        <primary><varname>log_duration</> configuration parameter</primary>
3676       </indexterm>
3677       <listitem>
3678        <para>
3679         Causes the duration of every completed statement to be logged.
3680         The default is <literal>off</>.
3681         Only superusers can change this setting.
3682        </para>
3683
3684        <para>
3685         For clients using extended query protocol, durations of the Parse,
3686         Bind, and Execute steps are logged independently.
3687        </para>
3688
3689        <note>
3690         <para>
3691          The difference between setting this option and setting
3692          <xref linkend="guc-log-min-duration-statement"> to zero is that
3693          exceeding <varname>log_min_duration_statement</> forces the text of
3694          the query to be logged, but this option doesn't.  Thus, if
3695          <varname>log_duration</> is <literal>on</> and
3696          <varname>log_min_duration_statement</> has a positive value, all
3697          durations are logged but the query text is included only for
3698          statements exceeding the threshold.  This behavior can be useful for
3699          gathering statistics in high-load installations.
3700         </para>
3701        </note>
3702       </listitem>
3703      </varlistentry>
3704
3705      <varlistentry id="guc-log-error-verbosity" xreflabel="log_error_verbosity">
3706       <term><varname>log_error_verbosity</varname> (<type>enum</type>)</term>
3707       <indexterm>
3708        <primary><varname>log_error_verbosity</> configuration parameter</primary>
3709       </indexterm>
3710       <listitem>
3711        <para>
3712         Controls the amount of detail written in the server log for each
3713         message that is logged.  Valid values are <literal>TERSE</>,
3714         <literal>DEFAULT</>, and <literal>VERBOSE</>, each adding more
3715         fields to displayed messages.  <literal>TERSE</> excludes
3716         the logging of <literal>DETAIL</>, <literal>HINT</>,
3717         <literal>QUERY</>, and <literal>CONTEXT</> error information.
3718         <literal>VERBOSE</> output includes the <symbol>SQLSTATE</> error
3719         code (see also <xref linkend="errcodes-appendix">) and the source code file name, function name,
3720         and line number that generated the error.
3721         Only superusers can change this setting.
3722        </para>
3723       </listitem>
3724      </varlistentry>
3725
3726      <varlistentry id="guc-log-hostname" xreflabel="log_hostname">
3727       <term><varname>log_hostname</varname> (<type>boolean</type>)</term>
3728       <indexterm>
3729        <primary><varname>log_hostname</> configuration parameter</primary>
3730       </indexterm>
3731       <listitem>
3732        <para>
3733         By default, connection log messages only show the IP address of the
3734         connecting host. Turning this parameter on causes logging of the
3735         host name as well.  Note that depending on your host name resolution
3736         setup this might impose a non-negligible performance penalty.
3737         This parameter can only be set in the <filename>postgresql.conf</>
3738         file or on the server command line.
3739        </para>
3740       </listitem>
3741      </varlistentry>
3742
3743      <varlistentry id="guc-log-line-prefix" xreflabel="log_line_prefix">
3744       <term><varname>log_line_prefix</varname> (<type>string</type>)</term>
3745       <indexterm>
3746        <primary><varname>log_line_prefix</> configuration parameter</primary>
3747       </indexterm>
3748       <listitem>
3749        <para>
3750          This is a <function>printf</>-style string that is output at the
3751          beginning of each log line.
3752          <literal>%</> characters begin <quote>escape sequences</>
3753          that are replaced with status information as outlined below.
3754          Unrecognized escapes are ignored. Other
3755          characters are copied straight to the log line. Some escapes are
3756          only recognized by session processes, and are ignored by
3757          background processes such as the main server process.
3758          This parameter can only be set in the <filename>postgresql.conf</>
3759          file or on the server command line. The default is an empty string.
3760
3761          <informaltable>
3762           <tgroup cols="3">
3763            <thead>
3764             <row>
3765              <entry>Escape</entry>
3766              <entry>Effect</entry>
3767              <entry>Session only</entry>
3768              </row>
3769             </thead>
3770            <tbody>
3771             <row>
3772              <entry><literal>%a</literal></entry>
3773              <entry>Application name</entry>
3774              <entry>yes</entry>
3775             </row>
3776             <row>
3777              <entry><literal>%u</literal></entry>
3778              <entry>User name</entry>
3779              <entry>yes</entry>
3780             </row>
3781             <row>
3782              <entry><literal>%d</literal></entry>
3783              <entry>Database name</entry>
3784              <entry>yes</entry>
3785             </row>
3786             <row>
3787              <entry><literal>%r</literal></entry>
3788              <entry>Remote host name or IP address, and remote port</entry>
3789              <entry>yes</entry>
3790             </row>
3791             <row>
3792              <entry><literal>%h</literal></entry>
3793              <entry>Remote host name or IP address</entry>
3794              <entry>yes</entry>
3795             </row>
3796             <row>
3797              <entry><literal>%p</literal></entry>
3798              <entry>Process ID</entry>
3799              <entry>no</entry>
3800             </row>
3801             <row>
3802              <entry><literal>%t</literal></entry>
3803              <entry>Time stamp without milliseconds</entry>
3804              <entry>no</entry>
3805             </row>
3806             <row>
3807              <entry><literal>%m</literal></entry>
3808              <entry>Time stamp with milliseconds</entry>
3809              <entry>no</entry>
3810             </row>
3811             <row>
3812              <entry><literal>%i</literal></entry>
3813              <entry>Command tag: type of session's current command</entry>
3814              <entry>yes</entry>
3815             </row>
3816             <row>
3817              <entry><literal>%e</literal></entry>
3818              <entry>SQLSTATE error code</entry>
3819              <entry>no</entry>
3820             </row>
3821             <row>
3822              <entry><literal>%c</literal></entry>
3823              <entry>Session ID: see below</entry>
3824              <entry>no</entry>
3825             </row>
3826             <row>
3827              <entry><literal>%l</literal></entry>
3828              <entry>Number of the log line for each session or process, starting at 1</entry>
3829              <entry>no</entry>
3830             </row>
3831             <row>
3832              <entry><literal>%s</literal></entry>
3833              <entry>Process start time stamp</entry>
3834              <entry>no</entry>
3835             </row>
3836             <row>
3837              <entry><literal>%v</literal></entry>
3838              <entry>Virtual transaction ID (backendID/localXID)</entry>
3839              <entry>no</entry>
3840             </row>
3841             <row>
3842              <entry><literal>%x</literal></entry>
3843              <entry>Transaction ID (0 if none is assigned)</entry>
3844              <entry>no</entry>
3845             </row>
3846             <row>
3847              <entry><literal>%q</literal></entry>
3848              <entry>Produces no output, but tells non-session
3849              processes to stop at this point in the string; ignored by
3850              session processes</entry>
3851              <entry>no</entry>
3852             </row>
3853             <row>
3854              <entry><literal>%%</literal></entry>
3855              <entry>Literal <literal>%</></entry>
3856              <entry>no</entry>
3857             </row>
3858            </tbody>
3859           </tgroup>
3860          </informaltable>
3861
3862          The <literal>%c</> escape prints a quasi-unique session identifier,
3863          consisting of two 4-byte hexadecimal numbers (without leading zeros)
3864          separated by a dot.  The numbers are the process start time and the
3865          process ID, so <literal>%c</> can also be used as a space saving way
3866          of printing those items.  For example, to generate the session
3867          identifier from <literal>pg_stat_activity</>, use this query:
3868 <programlisting>
3869 SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
3870        to_hex(pid)
3871 FROM pg_stat_activity;
3872 </programlisting>
3873
3874        </para>
3875
3876        <tip>
3877         <para>
3878          If you set a nonempty value for <varname>log_line_prefix</>,
3879          you should usually make its last character be a space, to provide
3880          visual separation from the rest of the log line.  A punctuation
3881          character can be used too.
3882         </para>
3883        </tip>
3884
3885        <tip>
3886         <para>
3887          <application>Syslog</> produces its own
3888          time stamp and process ID information, so you probably do not want to
3889          include those escapes if you are logging to <application>syslog</>.
3890         </para>
3891        </tip>
3892       </listitem>
3893      </varlistentry>
3894
3895      <varlistentry id="guc-log-lock-waits" xreflabel="log_lock_waits">
3896       <term><varname>log_lock_waits</varname> (<type>boolean</type>)</term>
3897       <indexterm>
3898        <primary><varname>log_lock_waits</> configuration parameter</primary>
3899       </indexterm>
3900       <listitem>
3901        <para>
3902         Controls whether a log message is produced when a session waits
3903         longer than <xref linkend="guc-deadlock-timeout"> to acquire a
3904         lock.  This is useful in determining if lock waits are causing
3905         poor performance.  The default is <literal>off</>.
3906        </para>
3907       </listitem>
3908      </varlistentry>
3909
3910      <varlistentry id="guc-log-statement" xreflabel="log_statement">
3911       <term><varname>log_statement</varname> (<type>enum</type>)</term>
3912       <indexterm>
3913        <primary><varname>log_statement</> configuration parameter</primary>
3914       </indexterm>
3915       <listitem>
3916        <para>
3917         Controls which SQL statements are logged. Valid values are
3918         <literal>none</> (off), <literal>ddl</>, <literal>mod</>, and
3919         <literal>all</> (all statements). <literal>ddl</> logs all data definition
3920         statements, such as <command>CREATE</>, <command>ALTER</>, and
3921         <command>DROP</> statements. <literal>mod</> logs all
3922         <literal>ddl</> statements, plus data-modifying statements
3923         such as <command>INSERT</>,
3924         <command>UPDATE</>, <command>DELETE</>, <command>TRUNCATE</>,
3925         and <command>COPY FROM</>.
3926         <command>PREPARE</>, <command>EXECUTE</>, and
3927         <command>EXPLAIN ANALYZE</> statements are also logged if their
3928         contained command is of an appropriate type.  For clients using
3929         extended query protocol, logging occurs when an Execute message
3930         is received, and values of the Bind parameters are included
3931         (with any embedded single-quote marks doubled).
3932        </para>
3933
3934        <para>
3935         The default is <literal>none</>. Only superusers can change this
3936         setting.
3937        </para>
3938
3939        <note>
3940         <para>
3941          Statements that contain simple syntax errors are not logged
3942          even by the <varname>log_statement</> = <literal>all</> setting,
3943          because the log message is emitted only after basic parsing has
3944          been done to determine the statement type.  In the case of extended
3945          query protocol, this setting likewise does not log statements that
3946          fail before the Execute phase (i.e., during parse analysis or
3947          planning).  Set <varname>log_min_error_statement</> to
3948          <literal>ERROR</> (or lower) to log such statements.
3949         </para>
3950        </note>
3951       </listitem>
3952      </varlistentry>
3953
3954      <varlistentry id="guc-log-temp-files" xreflabel="log_temp_files">
3955       <term><varname>log_temp_files</varname> (<type>integer</type>)</term>
3956       <indexterm>
3957        <primary><varname>log_temp_files</> configuration parameter</primary>
3958       </indexterm>
3959       <listitem>
3960        <para>
3961         Controls logging of temporary file names and sizes.
3962         Temporary files can be
3963         created for sorts, hashes, and temporary query results.
3964         A log entry is made for each temporary file when it is deleted.
3965         A value of zero logs all temporary file information, while positive
3966         values log only files whose size is greater than or equal to
3967         the specified number of kilobytes.  The
3968         default setting is -1, which disables such logging.
3969         Only superusers can change this setting.
3970        </para>
3971       </listitem>
3972      </varlistentry>
3973
3974      <varlistentry id="guc-log-timezone" xreflabel="log_timezone">
3975       <term><varname>log_timezone</varname> (<type>string</type>)</term>
3976       <indexterm>
3977        <primary><varname>log_timezone</> configuration parameter</primary>
3978       </indexterm>
3979       <listitem>
3980        <para>
3981         Sets the time zone used for timestamps written in the server log.
3982         Unlike <xref linkend="guc-timezone">, this value is cluster-wide,
3983         so that all sessions will report timestamps consistently.
3984         The built-in default is <literal>GMT</>, but that is typically
3985         overridden in <filename>postgresql.conf</>; <application>initdb</>
3986         will install a setting there corresponding to its system environment.
3987         See <xref linkend="datatype-timezones"> for more information.
3988         This parameter can only be set in the <filename>postgresql.conf</>
3989         file or on the server command line.
3990        </para>
3991       </listitem>
3992      </varlistentry>
3993
3994      </variablelist>
3995     </sect2>
3996      <sect2 id="runtime-config-logging-csvlog">
3997      <title>Using CSV-Format Log Output</title>
3998
3999        <para>
4000         Including <literal>csvlog</> in the <varname>log_destination</> list
4001         provides a convenient way to import log files into a database table.
4002         This option emits log lines in comma-separated-values
4003         (<acronym>CSV</>) format,
4004         with these columns:
4005         time stamp with milliseconds,
4006         user name,
4007         database name,
4008         process ID,
4009         client host:port number,
4010         session ID,
4011         per-session line number,
4012         command tag,
4013         session start time,
4014         virtual transaction ID,
4015         regular transaction ID,
4016         error severity,
4017         SQLSTATE code,
4018         error message,
4019         error message detail,
4020         hint,
4021         internal query that led to the error (if any),
4022         character count of the error position therein,
4023         error context,
4024         user query that led to the error (if any and enabled by
4025         <varname>log_min_error_statement</>),
4026         character count of the error position therein,
4027         location of the error in the PostgreSQL source code
4028         (if <varname>log_error_verbosity</> is set to <literal>verbose</>),
4029         and application name.
4030         Here is a sample table definition for storing CSV-format log output:
4031
4032 <programlisting>
4033 CREATE TABLE postgres_log
4034 (
4035   log_time timestamp(3) with time zone,
4036   user_name text,
4037   database_name text,
4038   process_id integer,
4039   connection_from text,
4040   session_id text,
4041   session_line_num bigint,
4042   command_tag text,
4043   session_start_time timestamp with time zone,
4044   virtual_transaction_id text,
4045   transaction_id bigint,
4046   error_severity text,
4047   sql_state_code text,
4048   message text,
4049   detail text,
4050   hint text,
4051   internal_query text,
4052   internal_query_pos integer,
4053   context text,
4054   query text,
4055   query_pos integer,
4056   location text,
4057   application_name text,
4058   PRIMARY KEY (session_id, session_line_num)
4059 );
4060 </programlisting>
4061        </para>
4062
4063        <para>
4064         To import a log file into this table, use the <command>COPY FROM</>
4065         command:
4066
4067 <programlisting>
4068 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
4069 </programlisting>
4070        </para>
4071
4072        <para>
4073        There are a few things you need to do to simplify importing CSV log
4074        files:
4075
4076        <orderedlist>
4077          <listitem>
4078            <para>
4079             Set <varname>log_filename</varname> and
4080             <varname>log_rotation_age</> to provide a consistent,
4081             predictable naming scheme for your log files.  This lets you
4082             predict what the file name will be and know when an individual log
4083             file is complete and therefore ready to be imported.
4084          </para>
4085         </listitem>
4086
4087         <listitem>
4088            <para>
4089             Set <varname>log_rotation_size</varname> to 0 to disable
4090             size-based log rotation, as it makes the log file name difficult
4091             to predict.
4092            </para>
4093         </listitem>
4094
4095         <listitem>
4096           <para>
4097            Set <varname>log_truncate_on_rotation</varname> to <literal>on</> so
4098            that old log data isn't mixed with the new in the same file.
4099           </para>
4100         </listitem>
4101
4102         <listitem>
4103           <para>
4104            The table definition above includes a primary key specification.
4105            This is useful to protect against accidentally importing the same
4106            information twice.  The <command>COPY</> command commits all of the
4107            data it imports at one time, so any error will cause the entire
4108            import to fail.  If you import a partial log file and later import
4109            the file again when it is complete, the primary key violation will
4110            cause the import to fail.  Wait until the log is complete and
4111            closed before importing.  This procedure will also protect against
4112            accidentally importing a partial line that hasn't been completely
4113            written, which would also cause <command>COPY</> to fail.
4114           </para>
4115         </listitem>
4116         </orderedlist>
4117       </para>
4118
4119     </sect2>
4120    </sect1>
4121
4122    <sect1 id="runtime-config-statistics">
4123     <title>Run-time Statistics</title>
4124
4125     <sect2 id="runtime-config-statistics-collector">
4126      <title>Query and Index Statistics Collector</title>
4127
4128      <para>
4129       These parameters control server-wide statistics collection features.
4130       When statistics collection is enabled, the data that is produced can be
4131       accessed via the <structname>pg_stat</structname> and
4132       <structname>pg_statio</structname> family of system views.
4133       Refer to <xref linkend="monitoring"> for more information.
4134      </para>
4135
4136      <variablelist>
4137
4138      <varlistentry id="guc-track-activities" xreflabel="track_activities">
4139       <term><varname>track_activities</varname> (<type>boolean</type>)</term>
4140       <indexterm>
4141        <primary><varname>track_activities</> configuration parameter</primary>
4142       </indexterm>
4143       <listitem>
4144        <para>
4145         Enables the collection of information on the currently
4146         executing command of each session, along with the time when
4147         that command began execution. This parameter is on by
4148         default. Note that even when enabled, this information is not
4149         visible to all users, only to superusers and the user owning
4150         the session being reported on, so it should not represent a
4151         security risk.
4152         Only superusers can change this setting.
4153        </para>
4154       </listitem>
4155      </varlistentry>
4156
4157      <varlistentry id="guc-track-activity-query-size" xreflabel="track_activity_query_size">
4158       <term><varname>track_activity_query_size</varname> (<type>integer</type>)</term>
4159       <indexterm>
4160        <primary><varname>track_activity_query_size</> configuration parameter</primary>
4161       </indexterm>
4162       <listitem>
4163        <para>
4164        Specifies the number of bytes reserved to track the currently
4165        executing command for each active session, for the
4166        <structname>pg_stat_activity</>.<structfield>query</> field.
4167        The default value is 1024. This parameter can only be set at server
4168        start.
4169        </para>
4170       </listitem>
4171      </varlistentry>
4172
4173      <varlistentry id="guc-track-counts" xreflabel="track_counts">
4174       <term><varname>track_counts</varname> (<type>boolean</type>)</term>
4175       <indexterm>
4176        <primary><varname>track_counts</> configuration parameter</primary>
4177       </indexterm>
4178       <listitem>
4179        <para>
4180         Enables collection of statistics on database activity.
4181         This parameter is on by default, because the autovacuum
4182         daemon needs the collected information.
4183         Only superusers can change this setting.
4184        </para>
4185       </listitem>
4186      </varlistentry>
4187
4188      <varlistentry id="guc-track-functions" xreflabel="track_functions">
4189       <term><varname>track_functions</varname> (<type>enum</type>)</term>
4190       <indexterm>
4191        <primary><varname>track_functions</> configuration parameter</primary>
4192       </indexterm>
4193       <listitem>
4194        <para>
4195         Enables tracking of function call counts and time used. Specify
4196         <literal>pl</literal> to track only procedural-language functions,
4197         <literal>all</literal> to also track SQL and C language functions.
4198         The default is <literal>none</literal>, which disables function
4199         statistics tracking.  Only superusers can change this setting.
4200        </para>
4201
4202        <note>
4203         <para>
4204          SQL-language functions that are simple enough to be <quote>inlined</>
4205          into the calling query will not be tracked, regardless of this
4206          setting.
4207         </para>
4208        </note>
4209       </listitem>
4210      </varlistentry>
4211
4212      <varlistentry id="guc-update-process-title" xreflabel="update_process_title">
4213       <term><varname>update_process_title</varname> (<type>boolean</type>)</term>
4214       <indexterm>
4215        <primary><varname>update_process_title</> configuration parameter</primary>
4216       </indexterm>
4217       <listitem>
4218        <para>
4219         Enables updating of the process title every time a new SQL command
4220         is received by the server.  The process title is typically viewed
4221         by the <command>ps</> command,
4222         or in Windows by using the <application>Process Explorer</>.
4223         Only superusers can change this setting.
4224        </para>
4225       </listitem>
4226      </varlistentry>
4227
4228      <varlistentry id="guc-stats-temp-directory" xreflabel="stats_temp_directory">
4229       <term><varname>stats_temp_directory</varname> (<type>string</type>)</term>
4230       <indexterm>
4231        <primary><varname>stats_temp_directory</> configuration parameter</primary>
4232       </indexterm>
4233       <listitem>
4234        <para>
4235         Sets the directory to store temporary statistics data in. This can be
4236         a path relative to the data directory or an absolute path. The default
4237         is <filename>pg_stat_tmp</filename>. Pointing this at a RAM-based
4238         file system will decrease physical I/O requirements and can lead to
4239         improved performance.
4240         This parameter can only be set in the <filename>postgresql.conf</>
4241         file or on the server command line.
4242        </para>
4243       </listitem>
4244      </varlistentry>
4245
4246      </variablelist>
4247     </sect2>
4248
4249     <sect2 id="runtime-config-statistics-monitor">
4250      <title>Statistics Monitoring</title>
4251      <variablelist>
4252
4253      <varlistentry>
4254       <term><varname>log_statement_stats</varname> (<type>boolean</type>)</term>
4255       <term><varname>log_parser_stats</varname> (<type>boolean</type>)</term>
4256       <term><varname>log_planner_stats</varname> (<type>boolean</type>)</term>
4257       <term><varname>log_executor_stats</varname> (<type>boolean</type>)</term>
4258       <indexterm>
4259        <primary><varname>log_statement_stats</> configuration parameter</primary>
4260       </indexterm>
4261       <indexterm>
4262        <primary><varname>log_parser_stats</> configuration parameter</primary>
4263       </indexterm>
4264       <indexterm>
4265        <primary><varname>log_planner_stats</> configuration parameter</primary>
4266       </indexterm>
4267       <indexterm>
4268        <primary><varname>log_executor_stats</> configuration parameter</primary>
4269       </indexterm>
4270       <listitem>
4271        <para>
4272         For each query, output performance statistics of the respective
4273         module to the server log. This is a crude profiling
4274         instrument, similar to the Unix <function>getrusage()</> operating
4275         system facility.  <varname>log_statement_stats</varname> reports total
4276         statement statistics, while the others report per-module statistics.
4277         <varname>log_statement_stats</varname> cannot be enabled together with
4278         any of the per-module options.  All of these options are disabled by
4279         default.   Only superusers can change these settings.
4280        </para>
4281       </listitem>
4282      </varlistentry>
4283
4284      </variablelist>
4285
4286     </sect2>
4287    </sect1>
4288
4289    <sect1 id="runtime-config-autovacuum">
4290     <title>Automatic Vacuuming</title>
4291
4292     <indexterm>
4293      <primary>autovacuum</primary>
4294      <secondary>configuration parameters</secondary>
4295     </indexterm>
4296
4297      <para>
4298       These settings control the behavior of the <firstterm>autovacuum</>
4299       feature.  Refer to <xref linkend="autovacuum"> for
4300       more information.
4301      </para>
4302
4303     <variablelist>
4304
4305      <varlistentry id="guc-autovacuum" xreflabel="autovacuum">
4306       <term><varname>autovacuum</varname> (<type>boolean</type>)</term>
4307       <indexterm>
4308        <primary><varname>autovacuum</> configuration parameter</primary>
4309       </indexterm>
4310       <listitem>
4311        <para>
4312         Controls whether the server should run the
4313         autovacuum launcher daemon.  This is on by default; however,
4314         <xref linkend="guc-track-counts"> must also be enabled for
4315         autovacuum to work.
4316         This parameter can only be set in the <filename>postgresql.conf</>
4317         file or on the server command line.
4318        </para>
4319        <para>
4320         Note that even when this parameter is disabled, the system
4321         will launch autovacuum processes if necessary to
4322         prevent transaction ID wraparound.  See <xref
4323         linkend="vacuum-for-wraparound"> for more information.
4324        </para>
4325       </listitem>
4326      </varlistentry>
4327
4328      <varlistentry id="guc-log-autovacuum-min-duration" xreflabel="log_autovacuum_min_duration">
4329       <term><varname>log_autovacuum_min_duration</varname> (<type>integer</type>)</term>
4330       <indexterm>
4331        <primary><varname>log_autovacuum_min_duration</> configuration parameter</primary>
4332       </indexterm>
4333       <listitem>
4334        <para>
4335         Causes each action executed by autovacuum to be logged if it ran for at
4336         least the specified number of milliseconds.  Setting this to zero logs
4337         all autovacuum actions. Minus-one (the default) disables logging
4338         autovacuum actions.  For example, if you set this to
4339         <literal>250ms</literal> then all automatic vacuums and analyzes that run
4340         250ms or longer will be logged.  In addition, when this parameter is
4341         set to any value other than <literal>-1</literal>, a message will be
4342         logged if an autovacuum action is skipped due to the existence of a
4343         conflicting lock.  Enabling this parameter can be helpful
4344         in tracking autovacuum activity.  This setting can only be set in
4345         the <filename>postgresql.conf</> file or on the server command line.
4346        </para>
4347       </listitem>
4348      </varlistentry>
4349
4350      <varlistentry id="guc-autovacuum-max-workers" xreflabel="autovacuum_max_workers">
4351       <term><varname>autovacuum_max_workers</varname> (<type>integer</type>)</term>
4352       <indexterm>
4353        <primary><varname>autovacuum_max_workers</> configuration parameter</primary>
4354       </indexterm>
4355       <listitem>
4356        <para>
4357         Specifies the maximum number of autovacuum processes (other than the
4358         autovacuum launcher) which may be running at any one time.  The default
4359         is three.  This parameter can only be set at server start.
4360        </para>
4361       </listitem>
4362      </varlistentry>
4363
4364      <varlistentry id="guc-autovacuum-naptime" xreflabel="autovacuum_naptime">
4365       <term><varname>autovacuum_naptime</varname> (<type>integer</type>)</term>
4366       <indexterm>
4367        <primary><varname>autovacuum_naptime</> configuration parameter</primary>
4368       </indexterm>
4369       <listitem>
4370        <para>
4371         Specifies the minimum delay between autovacuum runs on any given
4372         database.  In each round the daemon examines the
4373         database and issues <command>VACUUM</> and <command>ANALYZE</> commands
4374         as needed for tables in that database.  The delay is measured
4375         in seconds, and the default is one minute (<literal>1min</>).
4376         This parameter can only be set in the <filename>postgresql.conf</>
4377         file or on the server command line.
4378        </para>
4379       </listitem>
4380      </varlistentry>
4381
4382      <varlistentry id="guc-autovacuum-vacuum-threshold" xreflabel="autovacuum_vacuum_threshold">
4383       <term><varname>autovacuum_vacuum_threshold</varname> (<type>integer</type>)</term>
4384       <indexterm>
4385        <primary><varname>autovacuum_vacuum_threshold</> configuration parameter</primary>
4386       </indexterm>
4387       <listitem>
4388        <para>
4389         Specifies the minimum number of updated or deleted tuples needed
4390         to trigger a <command>VACUUM</> in any one table.
4391         The default is 50 tuples.
4392         This parameter can only be set in the <filename>postgresql.conf</>
4393         file or on the server command line.
4394         This setting can be overridden for individual tables by
4395         changing storage parameters.
4396        </para>
4397       </listitem>
4398      </varlistentry>
4399
4400      <varlistentry id="guc-autovacuum-analyze-threshold" xreflabel="autovacuum_analyze_threshold">
4401       <term><varname>autovacuum_analyze_threshold</varname> (<type>integer</type>)</term>
4402       <indexterm>
4403        <primary><varname>autovacuum_analyze_threshold</> configuration parameter</primary>
4404       </indexterm>
4405       <listitem>
4406        <para>
4407         Specifies the minimum number of inserted, updated or deleted tuples
4408         needed to trigger an <command>ANALYZE</> in any one table.
4409         The default is 50 tuples.
4410         This parameter can only be set in the <filename>postgresql.conf</>
4411         file or on the server command line.
4412         This setting can be overridden for individual tables by
4413         changing storage parameters.
4414        </para>
4415       </listitem>
4416      </varlistentry>
4417
4418      <varlistentry id="guc-autovacuum-vacuum-scale-factor" xreflabel="autovacuum_vacuum_scale_factor">
4419       <term><varname>autovacuum_vacuum_scale_factor</varname> (<type>floating point</type>)</term>
4420       <indexterm>
4421        <primary><varname>autovacuum_vacuum_scale_factor</> configuration parameter</primary>
4422       </indexterm>
4423       <listitem>
4424        <para>
4425         Specifies a fraction of the table size to add to
4426         <varname>autovacuum_vacuum_threshold</varname>
4427         when deciding whether to trigger a <command>VACUUM</>.
4428         The default is 0.2 (20% of table size).
4429         This parameter can only be set in the <filename>postgresql.conf</>
4430         file or on the server command line.
4431         This setting can be overridden for individual tables by
4432         changing storage parameters.
4433        </para>
4434       </listitem>
4435      </varlistentry>
4436
4437      <varlistentry id="guc-autovacuum-analyze-scale-factor" xreflabel="autovacuum_analyze_scale_factor">
4438       <term><varname>autovacuum_analyze_scale_factor</varname> (<type>floating point</type>)</term>
4439       <indexterm>
4440        <primary><varname>autovacuum_analyze_scale_factor</> configuration parameter</primary>
4441       </indexterm>
4442       <listitem>
4443        <para>
4444         Specifies a fraction of the table size to add to
4445         <varname>autovacuum_analyze_threshold</varname>
4446         when deciding whether to trigger an <command>ANALYZE</>.
4447         The default is 0.1 (10% of table size).
4448         This parameter can only be set in the <filename>postgresql.conf</>
4449         file or on the server command line.
4450         This setting can be overridden for individual tables by
4451         changing storage parameters.
4452        </para>
4453       </listitem>
4454      </varlistentry>
4455
4456      <varlistentry id="guc-autovacuum-freeze-max-age" xreflabel="autovacuum_freeze_max_age">
4457       <term><varname>autovacuum_freeze_max_age</varname> (<type>integer</type>)</term>
4458       <indexterm>
4459        <primary><varname>autovacuum_freeze_max_age</> configuration parameter</primary>
4460       </indexterm>
4461       <listitem>
4462        <para>
4463         Specifies the maximum age (in transactions) that a table's
4464         <structname>pg_class</>.<structfield>relfrozenxid</> field can
4465         attain before a <command>VACUUM</> operation is forced
4466         to prevent transaction ID wraparound within the table.
4467         Note that the system will launch autovacuum processes to
4468         prevent wraparound even when autovacuum is otherwise disabled.
4469        </para>
4470
4471        <para>
4472         Vacuum also allows removal of old files from the
4473         <filename>pg_clog</> subdirectory, which is why the default
4474         is a relatively low 200 million transactions.
4475         This parameter can only be set at server start, but the setting
4476         can be reduced for individual tables by
4477         changing storage parameters.
4478         For more information see <xref linkend="vacuum-for-wraparound">.
4479        </para>
4480       </listitem>
4481      </varlistentry>
4482
4483      <varlistentry id="guc-autovacuum-vacuum-cost-delay" xreflabel="autovacuum_vacuum_cost_delay">
4484       <term><varname>autovacuum_vacuum_cost_delay</varname> (<type>integer</type>)</term>
4485       <indexterm>
4486        <primary><varname>autovacuum_vacuum_cost_delay</> configuration parameter</primary>
4487       </indexterm>
4488       <listitem>
4489        <para>
4490         Specifies the cost delay value that will be used in automatic
4491         <command>VACUUM</> operations.  If -1 is specified, the regular
4492         <xref linkend="guc-vacuum-cost-delay"> value will be used.
4493         The default value is 20 milliseconds.
4494         This parameter can only be set in the <filename>postgresql.conf</>
4495         file or on the server command line.
4496         This setting can be overridden for individual tables by
4497         changing storage parameters.
4498        </para>
4499       </listitem>
4500      </varlistentry>
4501
4502      <varlistentry id="guc-autovacuum-vacuum-cost-limit" xreflabel="autovacuum_vacuum_cost_limit">
4503       <term><varname>autovacuum_vacuum_cost_limit</varname> (<type>integer</type>)</term>
4504       <indexterm>
4505        <primary><varname>autovacuum_vacuum_cost_limit</> configuration parameter</primary>
4506       </indexterm>
4507       <listitem>
4508        <para>
4509         Specifies the cost limit value that will be used in automatic
4510         <command>VACUUM</> operations.  If -1 is specified (which is the
4511         default), the regular
4512         <xref linkend="guc-vacuum-cost-limit"> value will be used.  Note that
4513         the value is distributed proportionally among the running autovacuum
4514         workers, if there is more than one, so that the sum of the limits of
4515         each worker never exceeds the limit on this variable.
4516         This parameter can only be set in the <filename>postgresql.conf</>
4517         file or on the server command line.
4518         This setting can be overridden for individual tables by
4519         changing storage parameters.
4520        </para>
4521       </listitem>
4522      </varlistentry>
4523
4524     </variablelist>
4525    </sect1>
4526
4527    <sect1 id="runtime-config-client">
4528     <title>Client Connection Defaults</title>
4529
4530     <sect2 id="runtime-config-client-statement">
4531      <title>Statement Behavior</title>
4532      <variablelist>
4533
4534      <varlistentry id="guc-search-path" xreflabel="search_path">
4535       <term><varname>search_path</varname> (<type>string</type>)</term>
4536       <indexterm>
4537        <primary><varname>search_path</> configuration parameter</primary>
4538       </indexterm>
4539       <indexterm><primary>path</><secondary>for schemas</></>
4540       <listitem>
4541        <para>
4542         This variable specifies the order in which schemas are searched
4543         when an object (table, data type, function, etc.) is referenced by a
4544         simple name with no schema specified.  When there are objects of
4545         identical names in different schemas, the one found first
4546         in the search path is used.  An object that is not in any of the
4547         schemas in the search path can only be referenced by specifying
4548         its containing schema with a qualified (dotted) name.
4549        </para>
4550
4551        <para>
4552         The value for <varname>search_path</varname> must be a comma-separated
4553         list of schema names.  If one of the list items is
4554         the special value <literal>$user</literal>, then the schema
4555         having the name returned by <function>SESSION_USER</> is substituted, if there
4556         is such a schema.  (If not, <literal>$user</literal> is ignored.)
4557        </para>
4558
4559        <para>
4560         The system catalog schema, <literal>pg_catalog</>, is always
4561         searched, whether it is mentioned in the path or not.  If it is
4562         mentioned in the path then it will be searched in the specified
4563         order.  If <literal>pg_catalog</> is not in the path then it will
4564         be searched <emphasis>before</> searching any of the path items.
4565        </para>
4566
4567        <para>
4568         Likewise, the current session's temporary-table schema,
4569         <literal>pg_temp_<replaceable>nnn</></>, is always searched if it
4570         exists.  It can be explicitly listed in the path by using the
4571         alias <literal>pg_temp</>.  If it is not listed in the path then
4572         it is searched first (even before <literal>pg_catalog</>).  However,
4573         the temporary schema is only searched for relation (table, view,
4574         sequence, etc) and data type names.  It is never searched for
4575         function or operator names.
4576        </para>
4577
4578        <para>
4579         When objects are created without specifying a particular target
4580         schema, they will be placed in the first schema listed
4581         in the search path.  An error is reported if the search path is
4582         empty.
4583        </para>
4584
4585        <para>
4586         The default value for this parameter is
4587         <literal>'"$user", public'</literal> (where the second part will be
4588         ignored if there is no schema named <literal>public</>).
4589         This supports shared use of a database (where no users
4590         have private schemas, and all share use of <literal>public</>),
4591         private per-user schemas, and combinations of these.  Other
4592         effects can be obtained by altering the default search path
4593         setting, either globally or per-user.
4594        </para>
4595
4596        <para>
4597         The current effective value of the search path can be examined
4598         via the <acronym>SQL</acronym> function
4599         <function>current_schemas</>
4600         (see <xref linkend="functions-info">).
4601         This is not quite the same as
4602         examining the value of <varname>search_path</varname>, since
4603         <function>current_schemas</> shows how the items
4604         appearing in <varname>search_path</varname> were resolved.
4605        </para>
4606
4607        <para>
4608         For more information on schema handling, see <xref linkend="ddl-schemas">.
4609        </para>
4610       </listitem>
4611      </varlistentry>
4612
4613      <varlistentry id="guc-default-tablespace" xreflabel="default_tablespace">
4614       <term><varname>default_tablespace</varname> (<type>string</type>)</term>
4615       <indexterm>
4616        <primary><varname>default_tablespace</> configuration parameter</primary>
4617       </indexterm>
4618       <indexterm><primary>tablespace</><secondary>default</></>
4619       <listitem>
4620        <para>
4621         This variable specifies the default tablespace in which to create
4622         objects (tables and indexes) when a <command>CREATE</> command does
4623         not explicitly specify a tablespace.
4624        </para>
4625
4626        <para>
4627         The value is either the name of a tablespace, or an empty string
4628         to specify using the default tablespace of the current database.
4629         If the value does not match the name of any existing tablespace,
4630         <productname>PostgreSQL</> will automatically use the default
4631         tablespace of the current database.  If a nondefault tablespace
4632         is specified, the user must have <literal>CREATE</> privilege
4633         for it, or creation attempts will fail.
4634        </para>
4635
4636        <para>
4637         This variable is not used for temporary tables; for them,
4638         <xref linkend="guc-temp-tablespaces"> is consulted instead.
4639        </para>
4640
4641        <para>
4642         This variable is also not used when creating databases.
4643         By default, a new database inherits its tablespace setting from
4644         the template database it is copied from.
4645        </para>
4646
4647        <para>
4648         For more information on tablespaces,
4649         see <xref linkend="manage-ag-tablespaces">.
4650        </para>
4651       </listitem>
4652      </varlistentry>
4653
4654      <varlistentry id="guc-temp-tablespaces" xreflabel="temp_tablespaces">
4655       <term><varname>temp_tablespaces</varname> (<type>string</type>)</term>
4656       <indexterm>
4657        <primary><varname>temp_tablespaces</> configuration parameter</primary>
4658       </indexterm>
4659       <indexterm><primary>tablespace</><secondary>temporary</></>
4660       <listitem>
4661        <para>
4662         This variable specifies tablespaces in which to create temporary
4663         objects (temp tables and indexes on temp tables) when a
4664         <command>CREATE</> command does not explicitly specify a tablespace.
4665         Temporary files for purposes such as sorting large data sets
4666         are also created in these tablespaces.
4667        </para>
4668
4669        <para>
4670         The value is a list of names of tablespaces.  When there is more than
4671         one name in the list, <productname>PostgreSQL</> chooses a random
4672         member of the list each time a temporary object is to be created;
4673         except that within a transaction, successively created temporary
4674         objects are placed in successive tablespaces from the list.
4675         If the selected element of the list is an empty string,
4676         <productname>PostgreSQL</> will automatically use the default
4677         tablespace of the current database instead.
4678        </para>
4679
4680        <para>
4681         When <varname>temp_tablespaces</> is set interactively, specifying a
4682         nonexistent tablespace is an error, as is specifying a tablespace for
4683         which the user does not have <literal>CREATE</> privilege.  However,
4684         when using a previously set value, nonexistent tablespaces are
4685         ignored, as are tablespaces for which the user lacks
4686         <literal>CREATE</> privilege.  In particular, this rule applies when
4687         using a value set in <filename>postgresql.conf</>.
4688        </para>
4689
4690        <para>
4691         The default value is an empty string, which results in all temporary
4692         objects being created in the default tablespace of the current
4693         database.
4694        </para>
4695
4696        <para>
4697         See also <xref linkend="guc-default-tablespace">.
4698        </para>
4699       </listitem>
4700      </varlistentry>
4701
4702      <varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
4703       <term><varname>check_function_bodies</varname> (<type>boolean</type>)</term>
4704       <indexterm>
4705        <primary><varname>check_function_bodies</> configuration parameter</primary>
4706       </indexterm>
4707       <listitem>
4708        <para>
4709         This parameter is normally on. When set to <literal>off</>, it
4710         disables validation of the function body string during <xref
4711         linkend="sql-createfunction">. Disabling validation is
4712         occasionally useful to avoid problems such as forward references
4713         when restoring function definitions from a dump.
4714        </para>
4715       </listitem>
4716      </varlistentry>
4717
4718      <varlistentry id="guc-default-transaction-isolation" xreflabel="default_transaction_isolation">
4719       <indexterm>
4720        <primary>transaction isolation level</primary>
4721        <secondary>setting default</secondary>
4722       </indexterm>
4723       <indexterm>
4724        <primary><varname>default_transaction_isolation</> configuration parameter</primary>
4725       </indexterm>
4726       <term><varname>default_transaction_isolation</varname> (<type>enum</type>)</term>
4727       <listitem>
4728        <para>
4729         Each SQL transaction has an isolation level, which can be
4730         either <quote>read uncommitted</quote>, <quote>read
4731         committed</quote>, <quote>repeatable read</quote>, or
4732         <quote>serializable</quote>.  This parameter controls the
4733         default isolation level of each new transaction. The default
4734         is <quote>read committed</quote>.
4735        </para>
4736
4737        <para>
4738         Consult <xref linkend="mvcc"> and <xref
4739         linkend="sql-set-transaction"> for more information.
4740        </para>
4741       </listitem>
4742      </varlistentry>
4743
4744      <varlistentry id="guc-default-transaction-read-only" xreflabel="default_transaction_read_only">
4745       <indexterm>
4746        <primary>read-only transaction</primary>
4747        <secondary>setting default</secondary>
4748       </indexterm>
4749       <indexterm>
4750        <primary><varname>default_transaction_read_only</> configuration parameter</primary>
4751       </indexterm>
4752
4753       <term><varname>default_transaction_read_only</varname> (<type>boolean</type>)</term>
4754       <listitem>
4755        <para>
4756         A read-only SQL transaction cannot alter non-temporary tables.
4757         This parameter controls the default read-only status of each new
4758         transaction. The default is <literal>off</> (read/write).
4759        </para>
4760
4761        <para>
4762         Consult <xref linkend="sql-set-transaction"> for more information.
4763        </para>
4764       </listitem>
4765      </varlistentry>
4766
4767      <varlistentry id="guc-default-transaction-deferrable" xreflabel="default_transaction_deferrable">
4768       <indexterm>
4769        <primary>deferrable transaction</primary>
4770        <secondary>setting default</secondary>
4771       </indexterm>
4772       <indexterm>
4773        <primary><varname>default_transaction_deferrable</> configuration parameter</primary>
4774       </indexterm>
4775
4776       <term><varname>default_transaction_deferrable</varname> (<type>boolean</type>)</term>
4777       <listitem>
4778        <para>
4779         When running at the <literal>serializable</> isolation level,
4780         a deferrable read-only SQL transaction may be delayed before
4781         it is allowed to proceed.  However, once it begins executing
4782         it does not incur any of the overhead required to ensure
4783         serializability; so serialization code will have no reason to
4784         force it to abort because of concurrent updates, making this
4785         option suitable for long-running read-only transactions.
4786         </para>
4787
4788         <para>
4789         This parameter controls the default deferrable status of each
4790         new transaction.  It currently has no effect on read-write
4791         transactions or those operating at isolation levels lower
4792         than <literal>serializable</>. The default is <literal>off</>.
4793        </para>
4794
4795        <para>
4796         Consult <xref linkend="sql-set-transaction"> for more information.
4797        </para>
4798       </listitem>
4799      </varlistentry>
4800
4801
4802      <varlistentry id="guc-session-replication-role" xreflabel="session_replication_role">
4803       <term><varname>session_replication_role</varname> (<type>enum</type>)</term>
4804       <indexterm>
4805        <primary><varname>session_replication_role</> configuration parameter</primary>
4806       </indexterm>
4807       <listitem>
4808        <para>
4809         Controls firing of replication-related triggers and rules for the
4810         current session.  Setting this variable requires
4811         superuser privilege and results in discarding any previously cached
4812         query plans.  Possible values are <literal>origin</> (the default),
4813         <literal>replica</> and <literal>local</>.
4814         See <xref linkend="sql-altertable"> for
4815         more information.
4816        </para>
4817       </listitem>
4818      </varlistentry>
4819
4820      <varlistentry id="guc-statement-timeout" xreflabel="statement_timeout">
4821       <term><varname>statement_timeout</varname> (<type>integer</type>)</term>
4822       <indexterm>
4823        <primary><varname>statement_timeout</> configuration parameter</primary>
4824       </indexterm>
4825       <listitem>
4826        <para>
4827         Abort any statement that takes over the specified number of
4828         milliseconds, starting from the time the command arrives at the server
4829         from the client.  If <varname>log_min_error_statement</> is set to
4830         <literal>ERROR</> or lower, the statement that timed out will also be
4831         logged.  A value of zero (the default) turns this off.
4832        </para>
4833
4834        <para>
4835         Setting <varname>statement_timeout</> in
4836         <filename>postgresql.conf</> is not recommended because it
4837         affects all sessions.
4838        </para>
4839       </listitem>
4840      </varlistentry>
4841
4842      <varlistentry id="guc-vacuum-freeze-table-age" xreflabel="vacuum_freeze_table_age">
4843       <term><varname>vacuum_freeze_table_age</varname> (<type>integer</type>)</term>
4844       <indexterm>
4845        <primary><varname>vacuum_freeze_table_age</> configuration parameter</primary>
4846       </indexterm>
4847       <listitem>
4848        <para>
4849         <command>VACUUM</> performs a whole-table scan if the table's
4850         <structname>pg_class</>.<structfield>relfrozenxid</> field has reached
4851         the age specified by this setting.  The default is 150 million
4852         transactions.  Although users can set this value anywhere from zero to
4853         one billion, <command>VACUUM</> will silently limit the effective value
4854         to 95% of <xref linkend="guc-autovacuum-freeze-max-age">, so that a
4855         periodical manual <command>VACUUM</> has a chance to run before an
4856         anti-wraparound autovacuum is launched for the table. For more
4857         information see
4858         <xref linkend="vacuum-for-wraparound">.
4859        </para>
4860       </listitem>
4861      </varlistentry>
4862
4863      <varlistentry id="guc-vacuum-freeze-min-age" xreflabel="vacuum_freeze_min_age">
4864       <term><varname>vacuum_freeze_min_age</varname> (<type>integer</type>)</term>
4865       <indexterm>
4866        <primary><varname>vacuum_freeze_min_age</> configuration parameter</primary>
4867       </indexterm>
4868       <listitem>
4869        <para>
4870         Specifies the cutoff age (in transactions) that <command>VACUUM</>
4871         should use to decide whether to replace transaction IDs with
4872         <literal>FrozenXID</> while scanning a table.
4873         The default is 50 million transactions.  Although
4874         users can set this value anywhere from zero to one billion,
4875         <command>VACUUM</> will silently limit the effective value to half
4876         the value of <xref linkend="guc-autovacuum-freeze-max-age">, so
4877         that there is not an unreasonably short time between forced
4878         autovacuums.  For more information see <xref
4879         linkend="vacuum-for-wraparound">.
4880        </para>
4881       </listitem>
4882      </varlistentry>
4883
4884      <varlistentry id="guc-bytea-output" xreflabel="bytea_output">
4885       <term><varname>bytea_output</varname> (<type>enum</type>)</term>
4886       <indexterm>
4887        <primary><varname>bytea_output</> configuration parameter</primary>
4888       </indexterm>
4889       <listitem>
4890        <para>
4891         Sets the output format for values of type <type>bytea</type>.
4892         Valid values are <literal>hex</literal> (the default)
4893         and <literal>escape</literal> (the traditional PostgreSQL
4894         format).  See <xref linkend="datatype-binary"> for more
4895         information.  The <type>bytea</type> type always
4896         accepts both formats on input, regardless of this setting.
4897        </para>
4898       </listitem>
4899      </varlistentry>
4900
4901      <varlistentry id="guc-xmlbinary" xreflabel="xmlbinary">
4902       <term><varname>xmlbinary</varname> (<type>enum</type>)</term>
4903       <indexterm>
4904        <primary><varname>xmlbinary</> configuration parameter</primary>
4905       </indexterm>
4906       <listitem>
4907        <para>
4908         Sets how binary values are to be encoded in XML.  This applies
4909         for example when <type>bytea</type> values are converted to
4910         XML by the functions <function>xmlelement</function> or
4911         <function>xmlforest</function>.  Possible values are
4912         <literal>base64</literal> and <literal>hex</literal>, which
4913         are both defined in the XML Schema standard.  The default is
4914         <literal>base64</literal>.  For further information about
4915         XML-related functions, see <xref linkend="functions-xml">.
4916        </para>
4917
4918        <para>
4919         The actual choice here is mostly a matter of taste,
4920         constrained only by possible restrictions in client
4921         applications.  Both methods support all possible values,
4922         although the hex encoding will be somewhat larger than the
4923         base64 encoding.
4924        </para>
4925       </listitem>
4926      </varlistentry>
4927
4928      <varlistentry id="guc-xmloption" xreflabel="xmloption">
4929       <term><varname>xmloption</varname> (<type>enum</type>)</term>
4930       <indexterm>
4931        <primary><varname>xmloption</> configuration parameter</primary>
4932       </indexterm>
4933       <indexterm>
4934        <primary><varname>SET XML OPTION</></primary>
4935       </indexterm>
4936       <indexterm>
4937        <primary>XML option</primary>
4938       </indexterm>
4939       <listitem>
4940        <para>
4941         Sets whether <literal>DOCUMENT</literal> or
4942         <literal>CONTENT</literal> is implicit when converting between
4943         XML and character string values.  See <xref
4944         linkend="datatype-xml"> for a description of this.  Valid
4945         values are <literal>DOCUMENT</literal> and
4946         <literal>CONTENT</literal>.  The default is
4947         <literal>CONTENT</literal>.
4948        </para>
4949
4950        <para>
4951         According to the SQL standard, the command to set this option is
4952 <synopsis>
4953 SET XML OPTION { DOCUMENT | CONTENT };
4954 </synopsis>
4955         This syntax is also available in PostgreSQL.
4956        </para>
4957       </listitem>
4958      </varlistentry>
4959
4960      </variablelist>
4961     </sect2>
4962      <sect2 id="runtime-config-client-format">
4963      <title>Locale and Formatting</title>
4964
4965      <variablelist>
4966
4967      <varlistentry id="guc-datestyle" xreflabel="DateStyle">
4968       <term><varname>DateStyle</varname> (<type>string</type>)</term>
4969       <indexterm>
4970        <primary><varname>DateStyle</> configuration parameter</primary>
4971       </indexterm>
4972       <listitem>
4973        <para>
4974         Sets the display format for date and time values, as well as the
4975         rules for interpreting ambiguous date input values. For
4976         historical reasons, this variable contains two independent
4977         components: the output format specification (<literal>ISO</>,
4978         <literal>Postgres</>, <literal>SQL</>, or <literal>German</>)
4979         and the input/output specification for year/month/day ordering
4980         (<literal>DMY</>, <literal>MDY</>, or <literal>YMD</>). These
4981         can be set separately or together. The keywords <literal>Euro</>
4982         and <literal>European</> are synonyms for <literal>DMY</>; the
4983         keywords <literal>US</>, <literal>NonEuro</>, and
4984         <literal>NonEuropean</> are synonyms for <literal>MDY</>. See
4985         <xref linkend="datatype-datetime"> for more information. The
4986         built-in default is <literal>ISO, MDY</>, but
4987         <application>initdb</application> will initialize the
4988         configuration file with a setting that corresponds to the
4989         behavior of the chosen <varname>lc_time</varname> locale.
4990        </para>
4991       </listitem>
4992      </varlistentry>
4993
4994      <varlistentry id="guc-intervalstyle" xreflabel="IntervalStyle">
4995       <term><varname>IntervalStyle</varname> (<type>enum</type>)</term>
4996       <indexterm>
4997        <primary><varname>IntervalStyle</> configuration parameter</primary>
4998       </indexterm>
4999       <listitem>
5000        <para>
5001         Sets the display format for interval values.
5002         The value <literal>sql_standard</> will produce
5003         output matching <acronym>SQL</acronym> standard interval literals.
5004         The value <literal>postgres</> (which is the default) will produce
5005         output matching <productname>PostgreSQL</> releases prior to 8.4
5006         when the <xref linkend="guc-datestyle">
5007         parameter was set to <literal>ISO</>.
5008         The value <literal>postgres_verbose</> will produce output
5009         matching <productname>PostgreSQL</> releases prior to 8.4
5010         when the <varname>DateStyle</>
5011         parameter was set to non-<literal>ISO</> output.
5012         The value <literal>iso_8601</> will produce output matching the time
5013         interval <quote>format with designators</> defined in section
5014         4.4.3.2 of ISO 8601.
5015        </para>
5016        <para>
5017         The <varname>IntervalStyle</> parameter also affects the
5018         interpretation of ambiguous interval input.  See
5019         <xref linkend="datatype-interval-input"> for more information.
5020        </para>
5021       </listitem>
5022      </varlistentry>
5023
5024      <varlistentry id="guc-timezone" xreflabel="timezone">
5025       <term><varname>timezone</varname> (<type>string</type>)</term>
5026       <indexterm>
5027        <primary><varname>timezone</> configuration parameter</primary>
5028       </indexterm>
5029       <indexterm><primary>time zone</></>
5030       <listitem>
5031        <para>
5032         Sets the time zone for displaying and interpreting time stamps.
5033         The built-in default is <literal>GMT</>, but that is typically
5034         overridden in <filename>postgresql.conf</>; <application>initdb</>
5035         will install a setting there corresponding to its system environment.
5036         See <xref linkend="datatype-timezones"> for more information.
5037        </para>
5038       </listitem>
5039      </varlistentry>
5040
5041      <varlistentry id="guc-timezone-abbreviations" xreflabel="timezone_abbreviations">
5042       <term><varname>timezone_abbreviations</varname> (<type>string</type>)</term>
5043       <indexterm>
5044        <primary><varname>timezone_abbreviations</> configuration parameter</primary>
5045       </indexterm>
5046       <indexterm><primary>time zone names</></>
5047       <listitem>
5048        <para>
5049         Sets the collection of time zone abbreviations that will be accepted
5050         by the server for datetime input.  The default is <literal>'Default'</>,
5051         which is a collection that works in most of the world; there are
5052         also <literal>'Australia'</literal> and <literal>'India'</literal>, and other collections can be defined
5053         for a particular installation.  See <xref
5054         linkend="datetime-appendix"> for more information.
5055        </para>
5056       </listitem>
5057      </varlistentry>
5058
5059      <varlistentry id="guc-extra-float-digits" xreflabel="extra_float_digits">
5060       <indexterm>
5061        <primary>significant digits</primary>
5062       </indexterm>
5063       <indexterm>
5064        <primary>floating-point</primary>
5065        <secondary>display</secondary>
5066       </indexterm>
5067       <indexterm>
5068        <primary><varname>extra_float_digits</> configuration parameter</primary>
5069       </indexterm>
5070
5071       <term><varname>extra_float_digits</varname> (<type>integer</type>)</term>
5072       <listitem>
5073        <para>
5074         This parameter adjusts the number of digits displayed for
5075         floating-point values, including <type>float4</>, <type>float8</>,
5076         and geometric data types.  The parameter value is added to the
5077         standard number of digits (<literal>FLT_DIG</> or <literal>DBL_DIG</>
5078         as appropriate).  The value can be set as high as 3, to include
5079         partially-significant digits; this is especially useful for dumping
5080         float data that needs to be restored exactly.  Or it can be set
5081         negative to suppress unwanted digits.
5082        </para>
5083       </listitem>
5084      </varlistentry>
5085
5086      <varlistentry id="guc-client-encoding" xreflabel="client_encoding">
5087       <term><varname>client_encoding</varname> (<type>string</type>)</term>
5088       <indexterm>
5089        <primary><varname>client_encoding</> configuration parameter</primary>
5090       </indexterm>
5091       <indexterm><primary>character set</></>
5092       <listitem>
5093        <para>
5094         Sets the client-side encoding (character set).
5095         The default is to use the database encoding.
5096         The character sets supported by the <productname>PostgreSQL</productname>
5097         server are described in <xref linkend="multibyte-charset-supported">.
5098        </para>
5099       </listitem>
5100      </varlistentry>
5101
5102      <varlistentry id="guc-lc-messages" xreflabel="lc_messages">
5103       <term><varname>lc_messages</varname> (<type>string</type>)</term>
5104       <indexterm>
5105        <primary><varname>lc_messages</> configuration parameter</primary>
5106       </indexterm>
5107       <listitem>
5108        <para>
5109         Sets the language in which messages are displayed.  Acceptable
5110         values are system-dependent; see <xref linkend="locale"> for
5111         more information.  If this variable is set to the empty string
5112         (which is the default) then the value is inherited from the
5113         execution environment of the server in a system-dependent way.
5114        </para>
5115
5116        <para>
5117         On some systems, this locale category does not exist.  Setting
5118         this variable will still work, but there will be no effect.
5119         Also, there is a chance that no translated messages for the
5120         desired language exist.  In that case you will continue to see
5121         the English messages.
5122        </para>
5123
5124        <para>
5125         Only superusers can change this setting, because it affects the
5126         messages sent to the server log as well as to the client, and
5127         an improper value might obscure the readability of the server
5128         logs.
5129        </para>
5130       </listitem>
5131      </varlistentry>
5132
5133      <varlistentry id="guc-lc-monetary" xreflabel="lc_monetary">
5134       <term><varname>lc_monetary</varname> (<type>string</type>)</term>
5135       <indexterm>
5136        <primary><varname>lc_monetary</> configuration parameter</primary>
5137       </indexterm>
5138       <listitem>
5139        <para>
5140         Sets the locale to use for formatting monetary amounts, for
5141         example with the <function>to_char</function> family of
5142         functions.  Acceptable values are system-dependent; see <xref
5143         linkend="locale"> for more information.  If this variable is
5144         set to the empty string (which is the default) then the value
5145         is inherited from the execution environment of the server in a
5146         system-dependent way.
5147        </para>
5148       </listitem>
5149      </varlistentry>
5150
5151      <varlistentry id="guc-lc-numeric" xreflabel="lc_numeric">
5152       <term><varname>lc_numeric</varname> (<type>string</type>)</term>
5153       <indexterm>
5154        <primary><varname>lc_numeric</> configuration parameter</primary>
5155       </indexterm>
5156       <listitem>
5157        <para>
5158         Sets the locale to use for formatting numbers, for example
5159         with the <function>to_char</function> family of
5160         functions. Acceptable values are system-dependent; see <xref
5161         linkend="locale"> for more information.  If this variable is
5162         set to the empty string (which is the default) then the value
5163         is inherited from the execution environment of the server in a
5164         system-dependent way.
5165        </para>
5166       </listitem>
5167      </varlistentry>
5168
5169      <varlistentry id="guc-lc-time" xreflabel="lc_time">
5170       <term><varname>lc_time</varname> (<type>string</type>)</term>
5171       <indexterm>
5172        <primary><varname>lc_time</> configuration parameter</primary>
5173       </indexterm>
5174       <listitem>
5175        <para>
5176         Sets the locale to use for formatting dates and times, for example
5177         with the <function>to_char</function> family of
5178         functions. Acceptable values are system-dependent; see <xref
5179         linkend="locale"> for more information.  If this variable is
5180         set to the empty string (which is the default) then the value
5181         is inherited from the execution environment of the server in a
5182         system-dependent way.
5183        </para>
5184       </listitem>
5185      </varlistentry>
5186
5187      <varlistentry id="guc-default-text-search-config" xreflabel="default_text_search_config">
5188       <term><varname>default_text_search_config</varname> (<type>string</type>)</term>
5189       <indexterm>
5190        <primary><varname>default_text_search_config</> configuration parameter</primary>
5191       </indexterm>
5192       <listitem>
5193        <para>
5194         Selects the text search configuration that is used by those variants
5195         of the text search functions that do not have an explicit argument
5196         specifying the configuration.
5197         See <xref linkend="textsearch"> for further information.
5198         The built-in default is <literal>pg_catalog.simple</>, but
5199         <application>initdb</application> will initialize the
5200         configuration file with a setting that corresponds to the
5201         chosen <varname>lc_ctype</varname> locale, if a configuration
5202         matching that locale can be identified.
5203        </para>
5204       </listitem>
5205      </varlistentry>
5206
5207      </variablelist>
5208
5209     </sect2>
5210      <sect2 id="runtime-config-client-other">
5211      <title>Other Defaults</title>
5212
5213      <variablelist>
5214
5215      <varlistentry id="guc-dynamic-library-path" xreflabel="dynamic_library_path">
5216       <term><varname>dynamic_library_path</varname> (<type>string</type>)</term>
5217       <indexterm>
5218        <primary><varname>dynamic_library_path</> configuration parameter</primary>
5219       </indexterm>
5220       <indexterm><primary>dynamic loading</></>
5221       <listitem>
5222        <para>
5223         If a dynamically loadable module needs to be opened and the
5224         file name specified in the <command>CREATE FUNCTION</command> or
5225         <command>LOAD</command> command
5226         does not have a directory component (i.e., the
5227         name does not contain a slash), the system will search this
5228         path for the required file.
5229        </para>
5230
5231        <para>
5232         The value for <varname>dynamic_library_path</varname> must be a
5233         list of absolute directory paths separated by colons (or semi-colons
5234         on Windows).  If a list element starts
5235         with the special string <literal>$libdir</literal>, the
5236         compiled-in <productname>PostgreSQL</productname> package
5237         library directory is substituted for <literal>$libdir</literal>; this
5238         is where the modules provided by the standard
5239         <productname>PostgreSQL</productname> distribution are installed.
5240         (Use <literal>pg_config --pkglibdir</literal> to find out the name of
5241         this directory.) For example:
5242 <programlisting>
5243 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
5244 </programlisting>
5245         or, in a Windows environment:
5246 <programlisting>
5247 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
5248 </programlisting>
5249        </para>
5250
5251        <para>
5252         The default value for this parameter is
5253         <literal>'$libdir'</literal>. If the value is set to an empty
5254         string, the automatic path search is turned off.
5255        </para>
5256
5257        <para>
5258         This parameter can be changed at run time by superusers, but a
5259         setting done that way will only persist until the end of the
5260         client connection, so this method should be reserved for
5261         development purposes. The recommended way to set this parameter
5262         is in the <filename>postgresql.conf</filename> configuration
5263         file.
5264        </para>
5265       </listitem>
5266      </varlistentry>
5267
5268      <varlistentry id="guc-gin-fuzzy-search-limit" xreflabel="gin_fuzzy_search_limit">
5269       <term><varname>gin_fuzzy_search_limit</varname> (<type>integer</type>)</term>
5270       <indexterm>
5271        <primary><varname>gin_fuzzy_search_limit</> configuration parameter</primary>
5272       </indexterm>
5273       <listitem>
5274        <para>
5275         Soft upper limit of the size of the set returned by GIN index scans. For more
5276         information see <xref linkend="gin-tips">.
5277        </para>
5278       </listitem>
5279      </varlistentry>
5280
5281      <varlistentry id="guc-local-preload-libraries" xreflabel="local_preload_libraries">
5282       <term><varname>local_preload_libraries</varname> (<type>string</type>)</term>
5283       <indexterm>
5284        <primary><varname>local_preload_libraries</> configuration parameter</primary>
5285       </indexterm>
5286       <indexterm>
5287        <primary><filename>$libdir/plugins</></primary>
5288       </indexterm>
5289       <listitem>
5290        <para>
5291         This variable specifies one or more shared libraries that are
5292         to be preloaded at connection start.  If more than one library
5293         is to be loaded, separate their names with commas.  All library
5294         names are converted to lower case unless double-quoted.
5295         This parameter cannot be changed after the start of a particular
5296         session.
5297        </para>
5298
5299        <para>
5300         Because this is not a superuser-only option, the libraries
5301         that can be loaded are restricted to those appearing in the
5302         <filename>plugins</> subdirectory of the installation's
5303         standard library directory.  (It is the database administrator's
5304         responsibility to ensure that only <quote>safe</> libraries
5305         are installed there.)  Entries in <varname>local_preload_libraries</>
5306         can specify this directory explicitly, for example
5307         <literal>$libdir/plugins/mylib</literal>, or just specify
5308         the library name &mdash; <literal>mylib</literal> would have
5309         the same effect as <literal>$libdir/plugins/mylib</literal>.
5310        </para>
5311
5312        <para>
5313         Unlike <xref linkend="guc-shared-preload-libraries">, there is no
5314         performance advantage to loading a library at session
5315         start rather than when it is first used.  Rather, the intent of
5316         this feature is to allow debugging or performance-measurement
5317         libraries to be loaded into specific sessions without an explicit
5318         <command>LOAD</> command being given.  For example, debugging could
5319         be enabled for all sessions under a given user name by setting
5320         this parameter with <command>ALTER ROLE SET</>.
5321        </para>
5322
5323        <para>
5324         If a specified library is not found,
5325         the connection attempt will fail.
5326        </para>
5327
5328        <para>
5329         Every  PostgreSQL-supported library has a <quote>magic
5330         block</> that is checked to guarantee compatibility.
5331         For this reason, non-PostgreSQL libraries cannot be
5332         loaded in this way.
5333        </para>
5334       </listitem>
5335      </varlistentry>
5336
5337      </variablelist>
5338     </sect2>
5339    </sect1>
5340
5341    <sect1 id="runtime-config-locks">
5342     <title>Lock Management</title>
5343
5344      <variablelist>
5345
5346      <varlistentry id="guc-deadlock-timeout" xreflabel="deadlock_timeout">
5347       <indexterm>
5348        <primary>deadlock</primary>
5349        <secondary>timeout during</secondary>
5350       </indexterm>
5351       <indexterm>
5352        <primary>timeout</primary>
5353        <secondary>deadlock</secondary>
5354       </indexterm>
5355       <indexterm>
5356        <primary><varname>deadlock_timeout</> configuration parameter</primary>
5357       </indexterm>
5358
5359       <term><varname>deadlock_timeout</varname> (<type>integer</type>)</term>
5360       <listitem>
5361        <para>
5362         This is the amount of time, in milliseconds, to wait on a lock
5363         before checking to see if there is a deadlock condition. The
5364         check for deadlock is relatively expensive, so the server doesn't run
5365         it every time it waits for a lock. We optimistically assume
5366         that deadlocks are not common in production applications and
5367         just wait on the lock for a while before checking for a
5368         deadlock. Increasing this value reduces the amount of time
5369         wasted in needless deadlock checks, but slows down reporting of
5370         real deadlock errors. The default is one second (<literal>1s</>),
5371         which is probably about the smallest value you would want in
5372         practice. On a heavily loaded server you might want to raise it.
5373         Ideally the setting should exceed your typical transaction time,
5374         so as to improve the odds that a lock will be released before
5375         the waiter decides to check for deadlock.  Only superusers can change
5376         this setting.
5377        </para>
5378
5379        <para>
5380         When <xref linkend="guc-log-lock-waits"> is set,
5381         this parameter also determines the length of time to wait before
5382         a log message is issued about the lock wait.  If you are trying
5383         to investigate locking delays you might want to set a shorter than
5384         normal <varname>deadlock_timeout</varname>.
5385        </para>
5386       </listitem>
5387      </varlistentry>
5388
5389      <varlistentry id="guc-max-locks-per-transaction" xreflabel="max_locks_per_transaction">
5390       <term><varname>max_locks_per_transaction</varname> (<type>integer</type>)</term>
5391       <indexterm>
5392        <primary><varname>max_locks_per_transaction</> configuration parameter</primary>
5393       </indexterm>
5394       <listitem>
5395        <para>
5396         The shared lock table tracks locks on
5397         <varname>max_locks_per_transaction</varname> * (<xref
5398         linkend="guc-max-connections"> + <xref
5399         linkend="guc-max-prepared-transactions">) objects (e.g.,  tables);
5400         hence, no more than this many distinct objects can be locked at
5401         any one time.  This parameter controls the average number of object
5402         locks allocated for each transaction;  individual transactions
5403         can lock more objects as long as the locks of all transactions
5404         fit in the lock table.  This is <emphasis>not</> the number of
5405         rows that can be locked; that value is unlimited.  The default,
5406         64, has historically proven sufficient, but you might need to
5407         raise this value if you have clients that touch many different
5408         tables in a single transaction. This parameter can only be set at
5409         server start.
5410        </para>
5411
5412        <para>
5413         Increasing this parameter might cause <productname>PostgreSQL</>
5414         to request more <systemitem class="osname">System V</> shared
5415         memory than your operating system's default configuration
5416         allows. See <xref linkend="sysvipc"> for information on how to
5417         adjust those parameters, if necessary.
5418        </para>
5419
5420        <para>
5421         When running a standby server, you must set this parameter to the
5422         same or higher value than on the master server. Otherwise, queries
5423         will not be allowed in the standby server.
5424        </para>
5425       </listitem>
5426      </varlistentry>
5427
5428      <varlistentry id="guc-max-pred-locks-per-transaction" xreflabel="max_pred_locks_per_transaction">
5429       <term><varname>max_pred_locks_per_transaction</varname> (<type>integer</type>)</term>
5430       <indexterm>
5431        <primary><varname>max_pred_locks_per_transaction</> configuration parameter</primary>
5432       </indexterm>
5433       <listitem>
5434        <para>
5435         The shared predicate lock table tracks locks on
5436         <varname>max_pred_locks_per_transaction</varname> * (<xref
5437         linkend="guc-max-connections"> + <xref
5438         linkend="guc-max-prepared-transactions">) objects (e.g., tables);
5439         hence, no more than this many distinct objects can be locked at
5440         any one time.  This parameter controls the average number of object
5441         locks allocated for each transaction;  individual transactions
5442         can lock more objects as long as the locks of all transactions
5443         fit in the lock table.  This is <emphasis>not</> the number of
5444         rows that can be locked; that value is unlimited.  The default,
5445         64, has generally been sufficient in testing, but you might need to
5446         raise this value if you have clients that touch many different
5447         tables in a single serializable transaction. This parameter can
5448         only be set at server start.
5449        </para>
5450
5451        <para>
5452         Increasing this parameter might cause <productname>PostgreSQL</>
5453         to request more <systemitem class="osname">System V</> shared
5454         memory than your operating system's default configuration
5455         allows. See <xref linkend="sysvipc"> for information on how to
5456         adjust those parameters, if necessary.
5457        </para>
5458       </listitem>
5459      </varlistentry>
5460
5461      </variablelist>
5462    </sect1>
5463
5464    <sect1 id="runtime-config-compatible">
5465     <title>Version and Platform Compatibility</title>
5466
5467     <sect2 id="runtime-config-compatible-version">
5468      <title>Previous PostgreSQL Versions</title>
5469
5470      <variablelist>
5471
5472      <varlistentry id="guc-array-nulls" xreflabel="array_nulls">
5473       <term><varname>array_nulls</varname> (<type>boolean</type>)</term>
5474       <indexterm>
5475        <primary><varname>array_nulls</> configuration parameter</primary>
5476       </indexterm>
5477       <listitem>
5478        <para>
5479         This controls whether the array input parser recognizes
5480         unquoted <literal>NULL</> as specifying a null array element.
5481         By default, this is <literal>on</>, allowing array values containing
5482         null values to be entered.  However, <productname>PostgreSQL</> versions
5483         before 8.2 did not support null values in arrays, and therefore would
5484         treat <literal>NULL</> as specifying a normal array element with
5485         the string value <quote>NULL</>.  For backward compatibility with
5486         applications that require the old behavior, this variable can be
5487         turned <literal>off</>.
5488        </para>
5489
5490        <para>
5491         Note that it is possible to create array values containing null values
5492         even when this variable is <literal>off</>.
5493        </para>
5494       </listitem>
5495      </varlistentry>
5496
5497      <varlistentry id="guc-backslash-quote" xreflabel="backslash_quote">
5498       <term><varname>backslash_quote</varname> (<type>enum</type>)</term>
5499       <indexterm><primary>strings</><secondary>backslash quotes</></>
5500       <indexterm>
5501        <primary><varname>backslash_quote</> configuration parameter</primary>
5502       </indexterm>
5503       <listitem>
5504        <para>
5505         This controls whether a quote mark can be represented by
5506         <literal>\'</> in a string literal.  The preferred, SQL-standard way
5507         to represent a quote mark is by doubling it (<literal>''</>) but
5508         <productname>PostgreSQL</> has historically also accepted
5509         <literal>\'</>. However, use of <literal>\'</> creates security risks
5510         because in some client character set encodings, there are multibyte
5511         characters in which the last byte is numerically equivalent to ASCII
5512         <literal>\</>.  If client-side code does escaping incorrectly then a
5513         SQL-injection attack is possible.  This risk can be prevented by
5514         making the server reject queries in which a quote mark appears to be
5515         escaped by a backslash.
5516         The allowed values of <varname>backslash_quote</> are
5517         <literal>on</> (allow <literal>\'</> always),
5518         <literal>off</> (reject always), and
5519         <literal>safe_encoding</> (allow only if client encoding does not
5520         allow ASCII <literal>\</> within a multibyte character).
5521         <literal>safe_encoding</> is the default setting.
5522        </para>
5523
5524        <para>
5525         Note that in a standard-conforming string literal, <literal>\</> just
5526         means <literal>\</> anyway.  This parameter only affects the handling of
5527         non-standard-conforming literals, including
5528         escape string syntax (<literal>E'...'</>).
5529        </para>
5530       </listitem>
5531      </varlistentry>
5532
5533      <varlistentry id="guc-default-with-oids" xreflabel="default_with_oids">
5534       <term><varname>default_with_oids</varname> (<type>boolean</type>)</term>
5535       <indexterm>
5536        <primary><varname>default_with_oids</> configuration parameter</primary>
5537       </indexterm>
5538       <listitem>
5539        <para>
5540         This controls whether <command>CREATE TABLE</command> and
5541         <command>CREATE TABLE AS</command> include an OID column in
5542         newly-created tables, if neither <literal>WITH OIDS</literal>
5543         nor <literal>WITHOUT OIDS</literal> is specified. It also
5544         determines whether OIDs will be included in tables created by
5545         <command>SELECT INTO</command>. The parameter is <literal>off</>
5546         by default; in <productname>PostgreSQL</> 8.0 and earlier, it
5547         was on by default.
5548        </para>
5549
5550        <para>
5551         The use of OIDs in user tables is considered deprecated, so
5552         most installations should leave this variable disabled.
5553         Applications that require OIDs for a particular table should
5554         specify <literal>WITH OIDS</literal> when creating the
5555         table. This variable can be enabled for compatibility with old
5556         applications that do not follow this behavior.
5557        </para>
5558       </listitem>
5559      </varlistentry>
5560
5561      <varlistentry id="guc-escape-string-warning" xreflabel="escape_string_warning">
5562       <term><varname>escape_string_warning</varname> (<type>boolean</type>)</term>
5563       <indexterm><primary>strings</><secondary>escape warning</></>
5564       <indexterm>
5565        <primary><varname>escape_string_warning</> configuration parameter</primary>
5566       </indexterm>
5567       <listitem>
5568        <para>
5569         When on, a warning is issued if a backslash (<literal>\</>)
5570         appears in an ordinary string literal (<literal>'...'</>
5571         syntax) and <varname>standard_conforming_strings</varname> is off.
5572         The default is <literal>on</>.
5573        </para>
5574        <para>
5575         Applications that wish to use backslash as escape should be
5576         modified to use escape string syntax (<literal>E'...'</>),
5577         because the default behavior of ordinary strings is now to treat
5578         backslash as an ordinary character, per SQL standard.  This variable
5579         can be enabled to help locate code that needs to be changed.
5580        </para>
5581       </listitem>
5582      </varlistentry>
5583
5584      <varlistentry id="guc-lo-compat-privileges" xreflabel="lo_compat_privileges">
5585       <term><varname>lo_compat_privileges</varname> (<type>boolean</type>)</term>
5586       <indexterm>
5587        <primary><varname>lo_compat_privileges</> configuration parameter</primary>
5588       </indexterm>
5589       <listitem>
5590        <para>
5591         In <productname>PostgreSQL</> releases prior to 9.0, large objects
5592         did not have access privileges and were, in effect, readable and
5593         writable by all users.  Setting this variable to <literal>on</>
5594         disables the new privilege checks, for compatibility with prior
5595         releases.  The default is <literal>off</>.
5596        </para>
5597        <para>
5598         Setting this variable does not disable all security checks related to
5599         large objects &mdash; only those for which the default behavior has
5600         changed in <productname>PostgreSQL</> 9.0.
5601         For example, <literal>lo_import()</literal> and
5602         <literal>lo_export()</literal> need superuser privileges independent
5603         of this setting.
5604        </para>
5605       </listitem>
5606      </varlistentry>
5607
5608     <varlistentry id="guc-quote-all-identifiers" xreflabel="quote-all-identifiers">
5609       <term><varname>quote_all_identifiers</varname> (<type>boolean</type>)</term>
5610       <indexterm>
5611        <primary><varname>quote_all_identifiers</> configuration parameter</primary>
5612       </indexterm>
5613       <listitem>
5614        <para>
5615         When the database generates SQL, force all identifiers to be quoted,
5616         even if they are not (currently) keywords.  This will affect the
5617         output of <command>EXPLAIN</> as well as the results of functions
5618         like <function>pg_get_viewdef</>.  See also the
5619         <option>--quote-all-identifiers</option> option of
5620         <xref linkend="app-pgdump"> and <xref linkend="app-pg-dumpall">.
5621        </para>
5622       </listitem>
5623      </varlistentry>
5624
5625      <varlistentry id="guc-sql-inheritance" xreflabel="sql_inheritance">
5626       <term><varname>sql_inheritance</varname> (<type>boolean</type>)</term>
5627       <indexterm>
5628        <primary><varname>sql_inheritance</> configuration parameter</primary>
5629       </indexterm>
5630       <indexterm><primary>inheritance</></>
5631       <listitem>
5632        <para>
5633         This controls the inheritance semantics.  If turned <literal>off</>,
5634         subtables are not accessed by various commands by default; basically
5635         an implied <literal>ONLY</literal> key word.  This was added for
5636         compatibility with releases prior to 7.1.  See
5637         <xref linkend="ddl-inherit"> for more information.
5638        </para>
5639       </listitem>
5640      </varlistentry>
5641
5642      <varlistentry id="guc-standard-conforming-strings" xreflabel="standard_conforming_strings">
5643       <term><varname>standard_conforming_strings</varname> (<type>boolean</type>)</term>
5644       <indexterm><primary>strings</><secondary>standard conforming</></>
5645       <indexterm>
5646        <primary><varname>standard_conforming_strings</> configuration parameter</primary>
5647       </indexterm>
5648       <listitem>
5649        <para>
5650         This controls whether ordinary string literals
5651         (<literal>'...'</>) treat backslashes literally, as specified in
5652         the SQL standard.
5653         Beginning in <productname>PostgreSQL</productname> 9.1, the default is
5654         <literal>on</> (prior releases defaulted to <literal>off</>).
5655         Applications can check this
5656         parameter to determine how string literals will be processed.
5657         The presence of this parameter can also be taken as an indication
5658         that the escape string syntax (<literal>E'...'</>) is supported.
5659         Escape string syntax (<xref linkend="sql-syntax-strings-escape">)
5660         should be used if an application desires
5661         backslashes to be treated as escape characters.
5662        </para>
5663       </listitem>
5664      </varlistentry>
5665
5666      <varlistentry id="guc-synchronize-seqscans" xreflabel="synchronize_seqscans">
5667       <term><varname>synchronize_seqscans</varname> (<type>boolean</type>)</term>
5668       <indexterm>
5669        <primary><varname>synchronize_seqscans</> configuration parameter</primary>
5670       </indexterm>
5671       <listitem>
5672        <para>
5673         This allows sequential scans of large tables to synchronize with each
5674         other, so that concurrent scans read the same block at about the
5675         same time and hence share the I/O workload.  When this is enabled,
5676         a scan might start in the middle of the table and then <quote>wrap
5677         around</> the end to cover all rows, so as to synchronize with the
5678         activity of scans already in progress.  This can result in
5679         unpredictable changes in the row ordering returned by queries that
5680         have no <literal>ORDER BY</> clause.  Setting this parameter to
5681         <literal>off</> ensures the pre-8.3 behavior in which a sequential
5682         scan always starts from the beginning of the table.  The default
5683         is <literal>on</>.
5684        </para>
5685       </listitem>
5686      </varlistentry>
5687
5688      </variablelist>
5689     </sect2>
5690
5691     <sect2 id="runtime-config-compatible-clients">
5692      <title>Platform and Client Compatibility</title>
5693      <variablelist>
5694
5695      <varlistentry id="guc-transform-null-equals" xreflabel="transform_null_equals">
5696       <term><varname>transform_null_equals</varname> (<type>boolean</type>)</term>
5697       <indexterm><primary>IS NULL</></>
5698       <indexterm>
5699        <primary><varname>transform_null_equals</> configuration parameter</primary>
5700       </indexterm>
5701       <listitem>
5702        <para>
5703         When on, expressions of the form <literal><replaceable>expr</> =
5704         NULL</literal> (or <literal>NULL =
5705         <replaceable>expr</></literal>) are treated as
5706         <literal><replaceable>expr</> IS NULL</literal>, that is, they
5707         return true if <replaceable>expr</> evaluates to the null value,
5708         and false otherwise. The correct SQL-spec-compliant behavior of
5709         <literal><replaceable>expr</> = NULL</literal> is to always
5710         return null (unknown). Therefore this parameter defaults to
5711         <literal>off</>.
5712        </para>
5713
5714        <para>
5715         However, filtered forms in <productname>Microsoft
5716         Access</productname> generate queries that appear to use
5717         <literal><replaceable>expr</> = NULL</literal> to test for
5718         null values, so if you use that interface to access the database you
5719         might want to turn this option on.  Since expressions of the
5720         form <literal><replaceable>expr</> = NULL</literal> always
5721         return the null value (using the SQL standard interpretation), they are not
5722         very useful and do not appear often in normal applications so
5723         this option does little harm in practice.  But new users are
5724         frequently confused about the semantics of expressions
5725         involving null values, so this option is off by default.
5726        </para>
5727
5728        <para>
5729         Note that this option only affects the exact form <literal>= NULL</>,
5730         not other comparison operators or other expressions
5731         that are computationally equivalent to some expression
5732         involving the equals operator (such as <literal>IN</literal>).
5733         Thus, this option is not a general fix for bad programming.
5734        </para>
5735
5736        <para>
5737         Refer to <xref linkend="functions-comparison"> for related information.
5738        </para>
5739       </listitem>
5740      </varlistentry>
5741
5742      </variablelist>
5743     </sect2>
5744    </sect1>
5745
5746    <sect1 id="runtime-config-error-handling">
5747     <title>Error Handling</title>
5748
5749     <variablelist>
5750
5751      <varlistentry id="guc-exit-on-error" xreflabel="exit_on_error">
5752       <term><varname>exit_on_error</varname> (<type>boolean</type>)</term>
5753       <indexterm>
5754        <primary><varname>exit_on_error</> configuration parameter</primary>
5755       </indexterm>
5756       <listitem>
5757        <para>
5758         If true, any error will terminate the current session.  By default,
5759         this is set to false, so that only FATAL errors will terminate the
5760         session.
5761        </para>
5762       </listitem>
5763      </varlistentry>
5764
5765      <varlistentry id="guc-restart-after-crash" xreflabel="restart_after_crash">
5766       <term><varname>restart_after_crash</varname> (<type>boolean</type>)</term>
5767       <indexterm>
5768        <primary><varname>restart_after_crash</> configuration parameter</primary>
5769       </indexterm>
5770       <listitem>
5771        <para>
5772         When set to true, which is the default, <productname>PostgreSQL</>
5773         will automatically reinitialize after a backend crash.  Leaving this
5774         value set to true is normally the best way to maximize the availability
5775         of the database.  However, in some circumstances, such as when
5776         <productname>PostgreSQL</> is being invoked by clusterware, it may be
5777         useful to disable the restart so that the clusterware can gain
5778         control and take any actions it deems appropriate.
5779        </para>
5780       </listitem>
5781      </varlistentry>
5782
5783     </variablelist>
5784
5785    </sect1>
5786
5787    <sect1 id="runtime-config-preset">
5788     <title>Preset Options</title>
5789
5790     <para>
5791      The following <quote>parameters</> are read-only, and are determined
5792      when <productname>PostgreSQL</productname> is compiled or when it is
5793      installed. As such, they have been excluded from the sample
5794      <filename>postgresql.conf</> file.  These options report
5795      various aspects of <productname>PostgreSQL</productname> behavior
5796      that might be of interest to certain applications, particularly
5797      administrative front-ends.
5798     </para>
5799
5800     <variablelist>
5801
5802      <varlistentry id="guc-block-size" xreflabel="block_size">
5803       <term><varname>block_size</varname> (<type>integer</type>)</term>
5804       <indexterm>
5805        <primary><varname>block_size</> configuration parameter</primary>
5806       </indexterm>
5807       <listitem>
5808        <para>
5809         Reports the size of a disk block.  It is determined by the value
5810         of <literal>BLCKSZ</> when building the server. The default
5811         value is 8192 bytes.  The meaning of some configuration
5812         variables (such as <xref linkend="guc-shared-buffers">) is
5813         influenced by <varname>block_size</varname>. See <xref
5814         linkend="runtime-config-resource"> for information.
5815        </para>
5816       </listitem>
5817      </varlistentry>
5818
5819      <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes">
5820       <term><varname>integer_datetimes</varname> (<type>boolean</type>)</term>
5821       <indexterm>
5822        <primary><varname>integer_datetimes</> configuration parameter</primary>
5823       </indexterm>
5824       <listitem>
5825        <para>
5826         Reports whether <productname>PostgreSQL</> was built with
5827         support for 64-bit-integer dates and times.  This can be
5828         disabled by configuring with <literal>--disable-integer-datetimes</>
5829         when building <productname>PostgreSQL</>.  The default value is
5830         <literal>on</literal>.
5831        </para>
5832       </listitem>
5833      </varlistentry>
5834
5835      <varlistentry id="guc-lc-collate" xreflabel="lc_collate">
5836       <term><varname>lc_collate</varname> (<type>string</type>)</term>
5837       <indexterm>
5838        <primary><varname>lc_collate</> configuration parameter</primary>
5839       </indexterm>
5840       <listitem>
5841        <para>
5842         Reports the locale in which sorting of textual data is done.
5843         See <xref linkend="locale"> for more information.
5844         This value is determined when a database is created.
5845        </para>
5846       </listitem>
5847      </varlistentry>
5848
5849      <varlistentry id="guc-lc-ctype" xreflabel="lc_ctype">
5850       <term><varname>lc_ctype</varname> (<type>string</type>)</term>
5851       <indexterm>
5852        <primary><varname>lc_ctype</> configuration parameter</primary>
5853       </indexterm>
5854       <listitem>
5855        <para>
5856         Reports the locale that determines character classifications.
5857         See <xref linkend="locale"> for more information.
5858         This value is determined when a database is created.
5859         Ordinarily this will be the same as <varname>lc_collate</varname>,
5860         but for special applications it might be set differently.
5861        </para>
5862       </listitem>
5863      </varlistentry>
5864
5865      <varlistentry id="guc-max-function-args" xreflabel="max_function_args">
5866       <term><varname>max_function_args</varname> (<type>integer</type>)</term>
5867       <indexterm>
5868        <primary><varname>max_function_args</> configuration parameter</primary>
5869       </indexterm>
5870       <listitem>
5871        <para>
5872         Reports the maximum number of function arguments. It is determined by
5873         the value of <literal>FUNC_MAX_ARGS</> when building the server. The
5874         default value is 100 arguments.
5875        </para>
5876       </listitem>
5877      </varlistentry>
5878
5879      <varlistentry id="guc-max-identifier-length" xreflabel="max_identifier_length">
5880       <term><varname>max_identifier_length</varname> (<type>integer</type>)</term>
5881       <indexterm>
5882        <primary><varname>max_identifier_length</> configuration parameter</primary>
5883       </indexterm>
5884       <listitem>
5885        <para>
5886         Reports the maximum identifier length. It is determined as one
5887         less than the value of <literal>NAMEDATALEN</> when building
5888         the server. The default value of <literal>NAMEDATALEN</> is
5889         64; therefore the default
5890         <varname>max_identifier_length</varname> is 63 bytes, which
5891         can be less than 63 characters when using multibyte encodings.
5892        </para>
5893       </listitem>
5894      </varlistentry>
5895
5896      <varlistentry id="guc-max-index-keys" xreflabel="max_index_keys">
5897       <term><varname>max_index_keys</varname> (<type>integer</type>)</term>
5898       <indexterm>
5899        <primary><varname>max_index_keys</> configuration parameter</primary>
5900       </indexterm>
5901       <listitem>
5902        <para>
5903         Reports the maximum number of index keys. It is determined by
5904         the value of <literal>INDEX_MAX_KEYS</> when building the server. The
5905         default value is 32 keys.
5906        </para>
5907       </listitem>
5908      </varlistentry>
5909
5910      <varlistentry id="guc-segment-size" xreflabel="segment_size">
5911       <term><varname>segment_size</varname> (<type>integer</type>)</term>
5912       <indexterm>
5913        <primary><varname>segment_size</> configuration parameter</primary>
5914       </indexterm>
5915       <listitem>
5916        <para>
5917         Reports the number of blocks (pages) that can be stored within a file
5918         segment.  It is determined by the value of <literal>RELSEG_SIZE</>
5919         when building the server.  The maximum size of a segment file in bytes
5920         is equal to <varname>segment_size</> multiplied by
5921         <varname>block_size</>; by default this is 1GB.
5922        </para>
5923       </listitem>
5924      </varlistentry>
5925
5926      <varlistentry id="guc-server-encoding" xreflabel="server_encoding">
5927       <term><varname>server_encoding</varname> (<type>string</type>)</term>
5928       <indexterm>
5929        <primary><varname>server_encoding</> configuration parameter</primary>
5930       </indexterm>
5931       <indexterm><primary>character set</></>
5932       <listitem>
5933        <para>
5934         Reports the database encoding (character set).
5935         It is determined when the database is created.  Ordinarily,
5936         clients need only be concerned with the value of <xref
5937         linkend="guc-client-encoding">.
5938        </para>
5939       </listitem>
5940      </varlistentry>
5941
5942      <varlistentry id="guc-server-version" xreflabel="server_version">
5943       <term><varname>server_version</varname> (<type>string</type>)</term>
5944       <indexterm>
5945        <primary><varname>server_version</> configuration parameter</primary>
5946       </indexterm>
5947       <listitem>
5948        <para>
5949         Reports the version number of the server. It is determined by the
5950         value of <literal>PG_VERSION</> when building the server.
5951        </para>
5952       </listitem>
5953      </varlistentry>
5954
5955      <varlistentry id="guc-server-version-num" xreflabel="server_version_num">
5956       <term><varname>server_version_num</varname> (<type>integer</type>)</term>
5957       <indexterm>
5958        <primary><varname>server_version_num</> configuration parameter</primary>
5959       </indexterm>
5960       <listitem>
5961        <para>
5962         Reports the version number of the server as an integer. It is determined
5963         by the value of <literal>PG_VERSION_NUM</> when building the server.
5964        </para>
5965       </listitem>
5966      </varlistentry>
5967
5968      <varlistentry id="guc-wal-block-size" xreflabel="wal_block_size">
5969       <term><varname>wal_block_size</varname> (<type>integer</type>)</term>
5970       <indexterm>
5971        <primary><varname>wal_block_size</> configuration parameter</primary>
5972       </indexterm>
5973       <listitem>
5974        <para>
5975         Reports the size of a WAL disk block.  It is determined by the value
5976         of <literal>XLOG_BLCKSZ</> when building the server. The default value
5977         is 8192 bytes.
5978        </para>
5979       </listitem>
5980      </varlistentry>
5981
5982      <varlistentry id="guc-wal-segment-size" xreflabel="wal_segment_size">
5983       <term><varname>wal_segment_size</varname> (<type>integer</type>)</term>
5984       <indexterm>
5985        <primary><varname>wal_segment_size</> configuration parameter</primary>
5986       </indexterm>
5987       <listitem>
5988        <para>
5989         Reports the number of blocks (pages) in a WAL segment file.
5990         The total size of a WAL segment file in bytes is equal to
5991         <varname>wal_segment_size</> multiplied by <varname>wal_block_size</>;
5992         by default this is 16MB.  See <xref linkend="wal-configuration"> for
5993         more information.
5994        </para>
5995       </listitem>
5996      </varlistentry>
5997
5998     </variablelist>
5999    </sect1>
6000
6001    <sect1 id="runtime-config-custom">
6002     <title>Customized Options</title>
6003
6004     <para>
6005      This feature was designed to allow parameters not normally known to
6006      <productname>PostgreSQL</productname> to be added by add-on modules
6007      (such as procedural languages).  This allows extension modules to be
6008      configured in the standard ways.
6009     </para>
6010
6011     <para>
6012      Custom options have two-part names: an extension name, then a dot, then
6013      the parameter name proper, much like qualified names in SQL.  An example
6014      is <literal>plpgsql.variable_conflict</>.
6015     </para>
6016
6017     <para>
6018      Because custom options may need to be set in processes that have not
6019      loaded the relevant extension module, <productname>PostgreSQL</>
6020      will accept a setting for any two-part parameter name.  Such variables
6021      are treated as placeholders and have no function until the module that
6022      defines them is loaded. When an extension module is loaded, it will add
6023      its variable definitions, convert any placeholder values according to
6024      those definitions, and issue warnings for any unrecognized placeholders
6025      that begin with its extension name.
6026     </para>
6027    </sect1>
6028
6029    <sect1 id="runtime-config-developer">
6030     <title>Developer Options</title>
6031
6032     <para>
6033      The following parameters are intended for work on the
6034      <productname>PostgreSQL</productname> source code, and in some cases
6035      to assist with recovery of severely damaged databases.  There
6036      should be no reason to use them on a production database.
6037      As such, they have been excluded from the sample
6038      <filename>postgresql.conf</> file.  Note that many of these
6039      parameters require special source compilation flags to work at all.
6040     </para>
6041
6042     <variablelist>
6043      <varlistentry id="guc-allow-system-table-mods" xreflabel="allow_system_table_mods">
6044       <term><varname>allow_system_table_mods</varname> (<type>boolean</type>)</term>
6045       <indexterm>
6046         <primary><varname>allow_system_table_mods</varname> configuration parameter</primary>
6047       </indexterm>
6048       <listitem>
6049        <para>
6050         Allows modification of the structure of system tables.
6051         This is used by <command>initdb</command>.
6052         This parameter can only be set at server start.
6053        </para>
6054       </listitem>
6055      </varlistentry>
6056
6057      <varlistentry id="guc-debug-assertions" xreflabel="debug_assertions">
6058       <term><varname>debug_assertions</varname> (<type>boolean</type>)</term>
6059       <indexterm>
6060        <primary><varname>debug_assertions</> configuration parameter</primary>
6061       </indexterm>
6062       <listitem>
6063        <para>
6064         Turns on various assertion checks. This is a debugging aid. If
6065         you are experiencing strange problems or crashes you might want
6066         to turn this on, as it might expose programming mistakes. To use
6067         this parameter, the macro <symbol>USE_ASSERT_CHECKING</symbol>
6068         must be defined when <productname>PostgreSQL</productname> is
6069         built (accomplished by the <command>configure</command> option
6070         <option>--enable-cassert</option>). Note that
6071         <varname>debug_assertions</varname> defaults to <literal>on</>
6072         if <productname>PostgreSQL</productname> has been built with
6073         assertions enabled.
6074        </para>
6075       </listitem>
6076      </varlistentry>
6077
6078      <varlistentry id="guc-ignore-system-indexes" xreflabel="ignore_system_indexes">
6079       <term><varname>ignore_system_indexes</varname> (<type>boolean</type>)</term>
6080       <indexterm>
6081         <primary><varname>ignore_system_indexes</varname> configuration parameter</primary>
6082       </indexterm>
6083       <listitem>
6084        <para>
6085         Ignore system indexes when reading system tables (but still
6086         update the indexes when modifying the tables).  This is useful
6087         when recovering from damaged system indexes.
6088         This parameter cannot be changed after session start.
6089        </para>
6090       </listitem>
6091      </varlistentry>
6092
6093      <varlistentry id="guc-post-auth-delay" xreflabel="post_auth_delay">
6094       <term><varname>post_auth_delay</varname> (<type>integer</type>)</term>
6095       <indexterm>
6096        <primary><varname>post_auth_delay</> configuration parameter</primary>
6097       </indexterm>
6098       <listitem>
6099        <para>
6100         If nonzero, a delay of this many seconds occurs when a new
6101         server process is started, after it conducts the
6102         authentication procedure.  This is intended to give developers an
6103         opportunity to attach to the server process with a debugger.
6104         This parameter cannot be changed after session start.
6105        </para>
6106       </listitem>
6107      </varlistentry>
6108
6109      <varlistentry id="guc-pre-auth-delay" xreflabel="pre_auth_delay">
6110       <term><varname>pre_auth_delay</varname> (<type>integer</type>)</term>
6111       <indexterm>
6112        <primary><varname>pre_auth_delay</> configuration parameter</primary>
6113       </indexterm>
6114       <listitem>
6115        <para>
6116         If nonzero, a delay of this many seconds occurs just after a
6117         new server process is forked, before it conducts the
6118         authentication procedure.  This is intended to give developers an
6119         opportunity to attach to the server process with a debugger to
6120         trace down misbehavior in authentication.
6121         This parameter can only be set in the <filename>postgresql.conf</>
6122         file or on the server command line.
6123        </para>
6124       </listitem>
6125      </varlistentry>
6126
6127      <varlistentry id="guc-trace-notify" xreflabel="trace_notify">
6128       <term><varname>trace_notify</varname> (<type>boolean</type>)</term>
6129       <indexterm>
6130        <primary><varname>trace_notify</> configuration parameter</primary>
6131       </indexterm>
6132       <listitem>
6133        <para>
6134         Generates a great amount of debugging output for the
6135         <command>LISTEN</command> and <command>NOTIFY</command>
6136         commands.  <xref linkend="guc-client-min-messages"> or
6137         <xref linkend="guc-log-min-messages"> must be
6138         <literal>DEBUG1</literal> or lower to send this output to the
6139         client or server logs, respectively.
6140        </para>
6141       </listitem>
6142      </varlistentry>
6143
6144      <varlistentry id="guc-trace-recovery-messages" xreflabel="trace_recovery_messages">
6145       <term><varname>trace_recovery_messages</varname> (<type>enum</type>)</term>
6146       <indexterm>
6147        <primary><varname>trace_recovery_messages</> configuration parameter</primary>
6148       </indexterm>
6149       <listitem>
6150        <para>
6151         Enables logging of recovery-related debugging output that otherwise
6152         would not be logged. This parameter allows the user to override the
6153         normal setting of <xref linkend="guc-log-min-messages">, but only for
6154         specific messages. This is intended for use in debugging Hot Standby.
6155         Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
6156         <literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>, and
6157         <literal>LOG</>.  The default, <literal>LOG</>, does not affect
6158         logging decisions at all.  The other values cause recovery-related
6159         debug messages of that priority or higher to be logged as though they
6160         had <literal>LOG</> priority; for common settings of
6161         <varname>log_min_messages</> this results in unconditionally sending
6162         them to the server log.
6163         This parameter can only be set in the <filename>postgresql.conf</>
6164         file or on the server command line.
6165        </para>
6166       </listitem>
6167      </varlistentry>
6168
6169      <varlistentry id="guc-trace-sort" xreflabel="trace_sort">
6170       <term><varname>trace_sort</varname> (<type>boolean</type>)</term>
6171       <indexterm>
6172        <primary><varname>trace_sort</> configuration parameter</primary>
6173       </indexterm>
6174       <listitem>
6175        <para>
6176         If on, emit information about resource usage during sort operations.
6177         This parameter is only available if the <symbol>TRACE_SORT</symbol> macro
6178         was defined when <productname>PostgreSQL</productname> was compiled.
6179         (However, <symbol>TRACE_SORT</symbol> is currently defined by default.)
6180        </para>
6181       </listitem>
6182      </varlistentry>
6183
6184      <varlistentry>
6185       <term><varname>trace_locks</varname> (<type>boolean</type>)</term>
6186       <indexterm>
6187        <primary><varname>trace_locks</> configuration parameter</primary>
6188       </indexterm>
6189       <listitem>
6190        <para>
6191         If on, emit information about lock usage.  Information dumped
6192         includes the type of lock operation, the type of lock and the unique
6193         identifier of the object being locked or unlocked.  Also included
6194         are bit masks for the lock types already granted on this object as
6195         well as for the lock types awaited on this object.  For each lock
6196         type a count of the number of granted locks and waiting locks is
6197         also dumped as well as the totals.  An example of the log file output
6198         is shown here:
6199 <screen>
6200 LOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6201       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6202       wait(0) type(AccessShareLock)
6203 LOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6204       grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1
6205       wait(0) type(AccessShareLock)
6206 LOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6207       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6208       wait(0) type(AccessShareLock)
6209 LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6210       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6211       wait(0) type(INVALID)
6212 </screen>
6213         Details of the structure being dumped may be found in
6214         <filename>src/include/storage/lock.h</filename>.
6215        </para>
6216        <para>
6217         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6218         macro was defined when <productname>PostgreSQL</productname> was
6219         compiled.
6220        </para>
6221       </listitem>
6222      </varlistentry>
6223
6224      <varlistentry>
6225       <term><varname>trace_lwlocks</varname> (<type>boolean</type>)</term>
6226       <indexterm>
6227        <primary><varname>trace_lwlocks</> configuration parameter</primary>
6228       </indexterm>
6229       <listitem>
6230        <para>
6231         If on, emit information about lightweight lock usage.  Lightweight
6232         locks are intended primarily to provide mutual exclusion of access
6233         to shared-memory data structures.
6234        </para>
6235        <para>
6236         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6237         macro was defined when <productname>PostgreSQL</productname> was
6238         compiled.
6239        </para>
6240       </listitem>
6241      </varlistentry>
6242
6243      <varlistentry>
6244       <term><varname>trace_userlocks</varname> (<type>boolean</type>)</term>
6245       <indexterm>
6246        <primary><varname>trace_userlocks</> configuration parameter</primary>
6247       </indexterm>
6248       <listitem>
6249        <para>
6250         If on, emit information about user lock usage.  Output is the same
6251         as for <symbol>trace_locks</symbol>, only for advisory locks.
6252        </para>
6253        <para>
6254         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6255         macro was defined when <productname>PostgreSQL</productname> was
6256         compiled.
6257        </para>
6258       </listitem>
6259      </varlistentry>
6260
6261      <varlistentry>
6262       <term><varname>trace_lock_oidmin</varname> (<type>integer</type>)</term>
6263       <indexterm>
6264        <primary><varname>trace_lock_oidmin</> configuration parameter</primary>
6265       </indexterm>
6266       <listitem>
6267        <para>
6268         If set, do not trace locks for tables below this OID. (use to avoid
6269         output on system tables)
6270        </para>
6271        <para>
6272         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6273         macro was defined when <productname>PostgreSQL</productname> was
6274         compiled.
6275        </para>
6276       </listitem>
6277      </varlistentry>
6278
6279      <varlistentry>
6280       <term><varname>trace_lock_table</varname> (<type>integer</type>)</term>
6281       <indexterm>
6282        <primary><varname>trace_lock_table</> configuration parameter</primary>
6283       </indexterm>
6284       <listitem>
6285        <para>
6286         Unconditionally trace locks on this table (OID).
6287        </para>
6288        <para>
6289         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6290         macro was defined when <productname>PostgreSQL</productname> was
6291         compiled.
6292        </para>
6293       </listitem>
6294      </varlistentry>
6295
6296      <varlistentry>
6297       <term><varname>debug_deadlocks</varname> (<type>boolean</type>)</term>
6298       <indexterm>
6299        <primary><varname>debug_deadlocks</> configuration parameter</primary>
6300       </indexterm>
6301       <listitem>
6302        <para>
6303         If set, dumps information about all current locks when a
6304         deadlock timeout occurs.
6305        </para>
6306        <para>
6307         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6308         macro was defined when <productname>PostgreSQL</productname> was
6309         compiled.
6310        </para>
6311       </listitem>
6312      </varlistentry>
6313
6314      <varlistentry>
6315       <term><varname>log_btree_build_stats</varname> (<type>boolean</type>)</term>
6316       <indexterm>
6317        <primary><varname>log_btree_build_stats</> configuration parameter</primary>
6318       </indexterm>
6319       <listitem>
6320        <para>
6321         If set, logs system resource usage statistics (memory and CPU) on
6322         various B-tree operations.
6323        </para>
6324        <para>
6325         This parameter is only available if the <symbol>BTREE_BUILD_STATS</symbol>
6326         macro was defined when <productname>PostgreSQL</productname> was
6327         compiled.
6328        </para>
6329       </listitem>
6330      </varlistentry>
6331
6332      <varlistentry id="guc-wal-debug" xreflabel="wal_debug">
6333       <term><varname>wal_debug</varname> (<type>boolean</type>)</term>
6334       <indexterm>
6335        <primary><varname>wal_debug</> configuration parameter</primary>
6336       </indexterm>
6337       <listitem>
6338        <para>
6339         If on, emit WAL-related debugging output. This parameter is
6340         only available if the <symbol>WAL_DEBUG</symbol> macro was
6341         defined when <productname>PostgreSQL</productname> was
6342         compiled.
6343        </para>
6344       </listitem>
6345      </varlistentry>
6346
6347     <varlistentry id="guc-zero-damaged-pages" xreflabel="zero_damaged_pages">
6348       <term><varname>zero_damaged_pages</varname> (<type>boolean</type>)</term>
6349       <indexterm>
6350        <primary><varname>zero_damaged_pages</> configuration parameter</primary>
6351       </indexterm>
6352       <listitem>
6353        <para>
6354         Detection of a damaged page header normally causes
6355         <productname>PostgreSQL</> to report an error, aborting the current
6356         transaction.  Setting <varname>zero_damaged_pages</> to on causes
6357         the system to instead report a warning, zero out the damaged
6358         page in memory, and continue processing.  This behavior <emphasis>will destroy data</>,
6359         namely all the rows on the damaged page.  However, it does allow you to get
6360         past the error and retrieve rows from any undamaged pages that might
6361         be present in the table.  It is useful for recovering data if
6362         corruption has occurred due to a hardware or software error.  You should
6363         generally not set this on until you have given up hope of recovering
6364         data from the damaged pages of a table.  Zeroed-out pages are not
6365         forced to disk so it is recommended to recreate the table or
6366         the index before turning this parameter off again.  The
6367         default setting is <literal>off</>, and it can only be changed
6368         by a superuser.
6369        </para>
6370       </listitem>
6371      </varlistentry>
6372    </variablelist>
6373   </sect1>
6374   <sect1 id="runtime-config-short">
6375    <title>Short Options</title>
6376
6377    <para>
6378     For convenience there are also single letter command-line option
6379     switches available for some parameters.  They are described in
6380     <xref linkend="runtime-config-short-table">.  Some of these
6381     options exist for historical reasons, and their presence as a
6382     single-letter option does not necessarily indicate an endorsement
6383     to use the option heavily.
6384    </para>
6385
6386     <table id="runtime-config-short-table">
6387      <title>Short Option Key</title>
6388      <tgroup cols="2">
6389       <thead>
6390        <row>
6391         <entry>Short Option</entry>
6392         <entry>Equivalent</entry>
6393        </row>
6394       </thead>
6395
6396       <tbody>
6397        <row>
6398         <entry><option>-A <replaceable>x</replaceable></option></entry>
6399         <entry><literal>debug_assertions = <replaceable>x</replaceable></></entry>
6400        </row>
6401        <row>
6402         <entry><option>-B <replaceable>x</replaceable></option></entry>
6403         <entry><literal>shared_buffers = <replaceable>x</replaceable></></entry>
6404        </row>
6405        <row>
6406         <entry><option>-d <replaceable>x</replaceable></option></entry>
6407         <entry><literal>log_min_messages = DEBUG<replaceable>x</replaceable></></entry>
6408        </row>
6409        <row>
6410         <entry><option>-e</option></entry>
6411         <entry><literal>datestyle = euro</></entry>
6412        </row>
6413        <row>
6414         <entry>
6415           <option>-fb</option>, <option>-fh</option>, <option>-fi</option>,
6416           <option>-fm</option>, <option>-fn</option>, <option>-fo</option>,
6417           <option>-fs</option>, <option>-ft</option>
6418          </entry>
6419          <entry>
6420           <literal>enable_bitmapscan = off</>,
6421           <literal>enable_hashjoin = off</>,
6422           <literal>enable_indexscan = off</>,
6423           <literal>enable_mergejoin = off</>,
6424           <literal>enable_nestloop = off</>,
6425           <literal>enable_indexonlyscan = off</>,
6426           <literal>enable_seqscan = off</>,
6427           <literal>enable_tidscan = off</>
6428          </entry>
6429        </row>
6430        <row>
6431         <entry><option>-F</option></entry>
6432         <entry><literal>fsync = off</></entry>
6433        </row>
6434        <row>
6435         <entry><option>-h <replaceable>x</replaceable></option></entry>
6436         <entry><literal>listen_addresses = <replaceable>x</replaceable></></entry>
6437        </row>
6438        <row>
6439         <entry><option>-i</option></entry>
6440         <entry><literal>listen_addresses = '*'</></entry>
6441        </row>
6442        <row>
6443         <entry><option>-k <replaceable>x</replaceable></option></entry>
6444         <entry><literal>unix_socket_directory = <replaceable>x</replaceable></></entry>
6445        </row>
6446        <row>
6447         <entry><option>-l</option></entry>
6448         <entry><literal>ssl = on</></entry>
6449        </row>
6450        <row>
6451         <entry><option>-N <replaceable>x</replaceable></option></entry>
6452         <entry><literal>max_connections = <replaceable>x</replaceable></></entry>
6453        </row>
6454        <row>
6455         <entry><option>-O</option></entry>
6456         <entry><literal>allow_system_table_mods = on</></entry>
6457        </row>
6458        <row>
6459         <entry><option>-p <replaceable>x</replaceable></option></entry>
6460         <entry><literal>port = <replaceable>x</replaceable></></entry>
6461        </row>
6462        <row>
6463         <entry><option>-P</option></entry>
6464         <entry><literal>ignore_system_indexes = on</></entry>
6465        </row>
6466        <row>
6467         <entry><option>-s</option></entry>
6468         <entry><literal>log_statement_stats = on</></entry>
6469        </row>
6470        <row>
6471         <entry><option>-S <replaceable>x</replaceable></option></entry>
6472         <entry><literal>work_mem = <replaceable>x</replaceable></></entry>
6473        </row>
6474        <row>
6475         <entry><option>-tpa</option>, <option>-tpl</option>, <option>-te</option></entry>
6476         <entry><literal>log_parser_stats = on</>,
6477         <literal>log_planner_stats = on</>,
6478         <literal>log_executor_stats = on</></entry>
6479        </row>
6480        <row>
6481         <entry><option>-W <replaceable>x</replaceable></option></entry>
6482         <entry><literal>post_auth_delay = <replaceable>x</replaceable></></entry>
6483        </row>
6484       </tbody>
6485      </tgroup>
6486     </table>
6487
6488   </sect1>
6489 </chapter>