]> granicus.if.org Git - postgresql/blob - doc/src/sgml/config.sgml
Document random page cost is only 4x seqeuntial, and not 40x.
[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        <para>
2608         Random access to mechanical disk storage is normally much more expensive
2609         than four-times sequential access.  However, a lower default is used
2610         (4.0) because the majority of random accesses to disk, such as indexed
2611         reads, are assumed to be in cache.  The default value can be thought of
2612         as modeling random access as 40 times slower than sequential, while
2613         expecting 90% of random reads to be cached.
2614        </para>
2615
2616        <para>
2617         If you believe a 90% cache rate is an incorrect assumption
2618         for your workload, you can increase random_page_cost to better
2619         reflect the true cost of random storage reads. Correspondingly,
2620         if your data is likely to be completely in cache, such as when
2621         the database is smaller than the total server memory, decreasing
2622         random_page_cost can be appropriate.  Storage that has a low random
2623         read cost relative to sequential, e.g. solid-state drives, might
2624         also be better modeled with a lower value for random_page_cost.
2625        </para>
2626
2627        <tip>
2628         <para>
2629          Although the system will let you set <varname>random_page_cost</> to
2630          less than <varname>seq_page_cost</>, it is not physically sensible
2631          to do so.  However, setting them equal makes sense if the database
2632          is entirely cached in RAM, since in that case there is no penalty
2633          for touching pages out of sequence.  Also, in a heavily-cached
2634          database you should lower both values relative to the CPU parameters,
2635          since the cost of fetching a page already in RAM is much smaller
2636          than it would normally be.
2637         </para>
2638        </tip>
2639       </listitem>
2640      </varlistentry>
2641
2642      <varlistentry id="guc-cpu-tuple-cost" xreflabel="cpu_tuple_cost">
2643       <term><varname>cpu_tuple_cost</varname> (<type>floating point</type>)</term>
2644       <indexterm>
2645        <primary><varname>cpu_tuple_cost</> configuration parameter</primary>
2646       </indexterm>
2647       <listitem>
2648        <para>
2649         Sets the planner's estimate of the cost of processing
2650         each row during a query.
2651         The default is 0.01.
2652        </para>
2653       </listitem>
2654      </varlistentry>
2655
2656      <varlistentry id="guc-cpu-index-tuple-cost" xreflabel="cpu_index_tuple_cost">
2657       <term><varname>cpu_index_tuple_cost</varname> (<type>floating point</type>)</term>
2658       <indexterm>
2659        <primary><varname>cpu_index_tuple_cost</> configuration parameter</primary>
2660       </indexterm>
2661       <listitem>
2662        <para>
2663         Sets the planner's estimate of the cost of processing
2664         each index entry during an index scan.
2665         The default is 0.005.
2666        </para>
2667       </listitem>
2668      </varlistentry>
2669
2670      <varlistentry id="guc-cpu-operator-cost" xreflabel="cpu_operator_cost">
2671       <term><varname>cpu_operator_cost</varname> (<type>floating point</type>)</term>
2672       <indexterm>
2673        <primary><varname>cpu_operator_cost</> configuration parameter</primary>
2674       </indexterm>
2675       <listitem>
2676        <para>
2677         Sets the planner's estimate of the cost of processing each
2678         operator or function executed during a query.
2679         The default is 0.0025.
2680        </para>
2681       </listitem>
2682      </varlistentry>
2683
2684      <varlistentry id="guc-effective-cache-size" xreflabel="effective_cache_size">
2685       <term><varname>effective_cache_size</varname> (<type>integer</type>)</term>
2686       <indexterm>
2687        <primary><varname>effective_cache_size</> configuration parameter</primary>
2688       </indexterm>
2689       <listitem>
2690        <para>
2691         Sets the planner's assumption about the effective size of the
2692         disk cache that is available to a single query.  This is
2693         factored into estimates of the cost of using an index; a
2694         higher value makes it more likely index scans will be used, a
2695         lower value makes it more likely sequential scans will be
2696         used. When setting this parameter you should consider both
2697         <productname>PostgreSQL</productname>'s shared buffers and the
2698         portion of the kernel's disk cache that will be used for
2699         <productname>PostgreSQL</productname> data files.  Also, take
2700         into account the expected number of concurrent queries on different
2701         tables, since they will have to share the available
2702         space.  This parameter has no effect on the size of shared
2703         memory allocated by <productname>PostgreSQL</productname>, nor
2704         does it reserve kernel disk cache; it is used only for estimation
2705         purposes.  The system also does not assume data remains in
2706         the disk cache between queries.  The default is 128 megabytes
2707         (<literal>128MB</>).
2708        </para>
2709       </listitem>
2710      </varlistentry>
2711
2712      </variablelist>
2713
2714     </sect2>
2715      <sect2 id="runtime-config-query-geqo">
2716      <title>Genetic Query Optimizer</title>
2717
2718      <para>
2719       The genetic query optimizer (GEQO) is an algorithm that does query
2720       planning using heuristic searching.  This reduces planning time for
2721       complex queries (those joining many relations), at the cost of producing
2722       plans that are sometimes inferior to those found by the normal
2723       exhaustive-search algorithm.  Also, GEQO's searching is randomized and
2724       therefore its plans may vary nondeterministically.
2725       For more information see <xref linkend="geqo">.
2726      </para>
2727
2728      <variablelist>
2729
2730      <varlistentry id="guc-geqo" xreflabel="geqo">
2731       <indexterm>
2732        <primary>genetic query optimization</primary>
2733       </indexterm>
2734       <indexterm>
2735        <primary>GEQO</primary>
2736        <see>genetic query optimization</see>
2737       </indexterm>
2738       <indexterm>
2739        <primary><varname>geqo</> configuration parameter</primary>
2740       </indexterm>
2741       <term><varname>geqo</varname> (<type>boolean</type>)</term>
2742       <listitem>
2743        <para>
2744         Enables or disables genetic query optimization.
2745         This is on by default.  It is usually best not to turn it off in
2746         production; the <varname>geqo_threshold</varname> variable provides
2747         more granular control of GEQO.
2748        </para>
2749       </listitem>
2750      </varlistentry>
2751
2752      <varlistentry id="guc-geqo-threshold" xreflabel="geqo_threshold">
2753       <term><varname>geqo_threshold</varname> (<type>integer</type>)</term>
2754       <indexterm>
2755        <primary><varname>geqo_threshold</> configuration parameter</primary>
2756       </indexterm>
2757       <listitem>
2758        <para>
2759         Use genetic query optimization to plan queries with at least
2760         this many <literal>FROM</> items involved. (Note that a
2761         <literal>FULL OUTER JOIN</> construct counts as only one <literal>FROM</>
2762         item.) The default is 12. For simpler queries it is usually best
2763         to use the deterministic, exhaustive planner, but for queries with
2764         many tables the deterministic planner takes too long, often
2765         longer than the penalty of executing a suboptimal plan.
2766        </para>
2767       </listitem>
2768      </varlistentry>
2769
2770      <varlistentry id="guc-geqo-effort" xreflabel="geqo_effort">
2771       <term><varname>geqo_effort</varname>
2772       (<type>integer</type>)</term>
2773       <indexterm>
2774        <primary><varname>geqo_effort</> configuration parameter</primary>
2775       </indexterm>
2776       <listitem>
2777        <para>
2778         Controls the trade-off between planning time and query plan
2779         quality in GEQO. This variable must be an integer in the
2780         range from 1 to 10. The default value is five. Larger values
2781         increase the time spent doing query planning, but also
2782         increase the likelihood that an efficient query plan will be
2783         chosen.
2784        </para>
2785
2786        <para>
2787         <varname>geqo_effort</varname> doesn't actually do anything
2788         directly; it is only used to compute the default values for
2789         the other variables that influence GEQO behavior (described
2790         below). If you prefer, you can set the other parameters by
2791         hand instead.
2792        </para>
2793       </listitem>
2794      </varlistentry>
2795
2796      <varlistentry id="guc-geqo-pool-size" xreflabel="geqo_pool_size">
2797       <term><varname>geqo_pool_size</varname> (<type>integer</type>)</term>
2798       <indexterm>
2799        <primary><varname>geqo_pool_size</> configuration parameter</primary>
2800       </indexterm>
2801       <listitem>
2802        <para>
2803         Controls the pool size used by GEQO, that is the
2804         number of individuals in the genetic population.  It must be
2805         at least two, and useful values are typically 100 to 1000.  If
2806         it is set to zero (the default setting) then a suitable
2807         value is chosen based on <varname>geqo_effort</varname> and
2808         the number of tables in the query.
2809        </para>
2810       </listitem>
2811      </varlistentry>
2812
2813      <varlistentry id="guc-geqo-generations" xreflabel="geqo_generations">
2814       <term><varname>geqo_generations</varname> (<type>integer</type>)</term>
2815       <indexterm>
2816        <primary><varname>geqo_generations</> configuration parameter</primary>
2817       </indexterm>
2818       <listitem>
2819        <para>
2820         Controls the number of generations used by GEQO, that is
2821         the number of iterations of the algorithm.  It must
2822         be at least one, and useful values are in the same range as
2823         the pool size.  If it is set to zero (the default setting)
2824         then a suitable value is chosen based on
2825         <varname>geqo_pool_size</varname>.
2826        </para>
2827       </listitem>
2828      </varlistentry>
2829
2830      <varlistentry id="guc-geqo-selection-bias" xreflabel="geqo_selection_bias">
2831       <term><varname>geqo_selection_bias</varname> (<type>floating point</type>)</term>
2832       <indexterm>
2833        <primary><varname>geqo_selection_bias</> configuration parameter</primary>
2834       </indexterm>
2835       <listitem>
2836        <para>
2837         Controls the selection bias used by GEQO. The selection bias
2838         is the selective pressure within the population. Values can be
2839         from 1.50 to 2.00; the latter is the default.
2840        </para>
2841       </listitem>
2842      </varlistentry>
2843
2844      <varlistentry id="guc-geqo-seed" xreflabel="geqo_seed">
2845       <term><varname>geqo_seed</varname> (<type>floating point</type>)</term>
2846       <indexterm>
2847        <primary><varname>geqo_seed</> configuration parameter</primary>
2848       </indexterm>
2849       <listitem>
2850        <para>
2851         Controls the initial value of the random number generator used
2852         by GEQO to select random paths through the join order search space.
2853         The value can range from zero (the default) to one.  Varying the
2854         value changes the set of join paths explored, and may result in a
2855         better or worse best path being found.
2856        </para>
2857       </listitem>
2858      </varlistentry>
2859
2860      </variablelist>
2861     </sect2>
2862      <sect2 id="runtime-config-query-other">
2863      <title>Other Planner Options</title>
2864
2865      <variablelist>
2866
2867      <varlistentry id="guc-default-statistics-target" xreflabel="default_statistics_target">
2868       <term><varname>default_statistics_target</varname> (<type>integer</type>)</term>
2869       <indexterm>
2870        <primary><varname>default_statistics_target</> configuration parameter</primary>
2871       </indexterm>
2872       <listitem>
2873        <para>
2874         Sets the default statistics target for table columns without
2875         a column-specific target set via <command>ALTER TABLE
2876         SET STATISTICS</>.  Larger values increase the time needed to
2877         do <command>ANALYZE</>, but might improve the quality of the
2878         planner's estimates. The default is 100. For more information
2879         on the use of statistics by the <productname>PostgreSQL</>
2880         query planner, refer to <xref linkend="planner-stats">.
2881        </para>
2882       </listitem>
2883      </varlistentry>
2884
2885      <varlistentry id="guc-constraint-exclusion" xreflabel="constraint_exclusion">
2886       <term><varname>constraint_exclusion</varname> (<type>enum</type>)</term>
2887       <indexterm>
2888        <primary>constraint exclusion</primary>
2889       </indexterm>
2890       <indexterm>
2891        <primary><varname>constraint_exclusion</> configuration parameter</primary>
2892       </indexterm>
2893       <listitem>
2894        <para>
2895         Controls the query planner's use of table constraints to
2896         optimize queries.
2897         The allowed values of <varname>constraint_exclusion</> are
2898         <literal>on</> (examine constraints for all tables),
2899         <literal>off</> (never examine constraints), and
2900         <literal>partition</> (examine constraints only for inheritance child
2901         tables and <literal>UNION ALL</> subqueries).
2902         <literal>partition</> is the default setting.
2903         It is often used with inheritance and partitioned tables to
2904         improve performance.
2905       </para>
2906
2907        <para>
2908         When this parameter allows it for a particular table, the planner
2909         compares query conditions with the table's <literal>CHECK</>
2910         constraints, and omits scanning tables for which the conditions
2911         contradict the constraints.  For example:
2912
2913 <programlisting>
2914 CREATE TABLE parent(key integer, ...);
2915 CREATE TABLE child1000(check (key between 1000 and 1999)) INHERITS(parent);
2916 CREATE TABLE child2000(check (key between 2000 and 2999)) INHERITS(parent);
2917 ...
2918 SELECT * FROM parent WHERE key = 2400;
2919 </programlisting>
2920
2921         With constraint exclusion enabled, this <command>SELECT</>
2922         will not scan <structname>child1000</> at all, improving performance.
2923        </para>
2924
2925        <para>
2926         Currently, constraint exclusion is enabled by default
2927         only for cases that are often used to implement table partitioning.
2928         Turning it on for all tables imposes extra planning overhead that is
2929         quite noticeable on simple queries, and most often will yield no
2930         benefit for simple queries.  If you have no partitioned tables
2931         you might prefer to turn it off entirely.
2932        </para>
2933
2934        <para>
2935         Refer to <xref linkend="ddl-partitioning-constraint-exclusion"> for
2936         more information on using constraint exclusion and partitioning.
2937        </para>
2938       </listitem>
2939      </varlistentry>
2940
2941      <varlistentry id="guc-cursor-tuple-fraction" xreflabel="cursor_tuple_fraction">
2942       <term><varname>cursor_tuple_fraction</varname> (<type>floating point</type>)</term>
2943       <indexterm>
2944        <primary><varname>cursor_tuple_fraction</> configuration parameter</primary>
2945       </indexterm>
2946       <listitem>
2947        <para>
2948         Sets the planner's estimate of the fraction of a cursor's rows that
2949         will be retrieved.  The default is 0.1.  Smaller values of this
2950         setting bias the planner towards using <quote>fast start</> plans
2951         for cursors, which will retrieve the first few rows quickly while
2952         perhaps taking a long time to fetch all rows.  Larger values
2953         put more emphasis on the total estimated time.  At the maximum
2954         setting of 1.0, cursors are planned exactly like regular queries,
2955         considering only the total estimated time and not how soon the
2956         first rows might be delivered.
2957        </para>
2958       </listitem>
2959      </varlistentry>
2960
2961      <varlistentry id="guc-from-collapse-limit" xreflabel="from_collapse_limit">
2962       <term><varname>from_collapse_limit</varname> (<type>integer</type>)</term>
2963       <indexterm>
2964        <primary><varname>from_collapse_limit</> configuration parameter</primary>
2965       </indexterm>
2966       <listitem>
2967        <para>
2968         The planner will merge sub-queries into upper queries if the
2969         resulting <literal>FROM</literal> list would have no more than
2970         this many items.  Smaller values reduce planning time but might
2971         yield inferior query plans.  The default is eight.
2972         For more information see <xref linkend="explicit-joins">.
2973        </para>
2974
2975        <para>
2976         Setting this value to <xref linkend="guc-geqo-threshold"> or more
2977         may trigger use of the GEQO planner, resulting in nondeterministic
2978         plans.  See <xref linkend="runtime-config-query-geqo">.
2979        </para>
2980       </listitem>
2981      </varlistentry>
2982
2983      <varlistentry id="guc-join-collapse-limit" xreflabel="join_collapse_limit">
2984       <term><varname>join_collapse_limit</varname> (<type>integer</type>)</term>
2985       <indexterm>
2986        <primary><varname>join_collapse_limit</> configuration parameter</primary>
2987       </indexterm>
2988       <listitem>
2989        <para>
2990         The planner will rewrite explicit <literal>JOIN</>
2991         constructs (except <literal>FULL JOIN</>s) into lists of
2992         <literal>FROM</> items whenever a list of no more than this many items
2993         would result.  Smaller values reduce planning time but might
2994         yield inferior query plans.
2995        </para>
2996
2997        <para>
2998         By default, this variable is set the same as
2999         <varname>from_collapse_limit</varname>, which is appropriate
3000         for most uses. Setting it to 1 prevents any reordering of
3001         explicit <literal>JOIN</>s. Thus, the explicit join order
3002         specified in the query will be the actual order in which the
3003         relations are joined. Because the query planner does not always choose
3004         the optimal join order, advanced users can elect to
3005         temporarily set this variable to 1, and then specify the join
3006         order they desire explicitly.
3007         For more information see <xref linkend="explicit-joins">.
3008        </para>
3009
3010        <para>
3011         Setting this value to <xref linkend="guc-geqo-threshold"> or more
3012         may trigger use of the GEQO planner, resulting in nondeterministic
3013         plans.  See <xref linkend="runtime-config-query-geqo">.
3014        </para>
3015       </listitem>
3016      </varlistentry>
3017
3018      </variablelist>
3019     </sect2>
3020    </sect1>
3021
3022    <sect1 id="runtime-config-logging">
3023     <title>Error Reporting and Logging</title>
3024
3025     <indexterm zone="runtime-config-logging">
3026      <primary>server log</primary>
3027     </indexterm>
3028
3029     <sect2 id="runtime-config-logging-where">
3030      <title>Where To Log</title>
3031
3032      <indexterm zone="runtime-config-logging-where">
3033       <primary>where to log</primary>
3034      </indexterm>
3035
3036      <variablelist>
3037
3038      <varlistentry id="guc-log-destination" xreflabel="log_destination">
3039       <term><varname>log_destination</varname> (<type>string</type>)</term>
3040       <indexterm>
3041        <primary><varname>log_destination</> configuration parameter</primary>
3042       </indexterm>
3043       <listitem>
3044        <para>
3045         <productname>PostgreSQL</productname> supports several methods
3046          for logging server messages, including
3047          <systemitem>stderr</systemitem>, <systemitem>csvlog</systemitem> and
3048          <systemitem>syslog</systemitem>. On Windows,
3049          <systemitem>eventlog</systemitem> is also supported. Set this
3050          parameter to a list of desired log destinations separated by
3051          commas. The default is to log to <systemitem>stderr</systemitem>
3052          only.
3053          This parameter can only be set in the <filename>postgresql.conf</>
3054          file or on the server command line.
3055        </para>
3056        <para>
3057         If <systemitem>csvlog</> is included in <varname>log_destination</>,
3058         log entries are output in <quote>comma separated
3059         value</> (<acronym>CSV</>) format, which is convenient for
3060         loading logs into programs.
3061         See <xref linkend="runtime-config-logging-csvlog"> for details.
3062         <varname>logging_collector</varname> must be enabled to generate
3063         CSV-format log output.
3064        </para>
3065
3066        <note>
3067         <para>
3068          On most Unix systems, you will need to alter the configuration of
3069          your system's <application>syslog</application> daemon in order
3070          to make use of the <systemitem>syslog</systemitem> option for
3071          <varname>log_destination</>.  <productname>PostgreSQL</productname>
3072          can log to <application>syslog</application> facilities
3073          <literal>LOCAL0</> through <literal>LOCAL7</> (see <xref
3074          linkend="guc-syslog-facility">), but the default
3075          <application>syslog</application> configuration on most platforms
3076          will discard all such messages.  You will need to add something like:
3077 <programlisting>
3078 local0.*    /var/log/postgresql
3079 </programlisting>
3080          to the  <application>syslog</application> daemon's configuration file
3081          to make it work.
3082         </para>
3083         <para>
3084          On Windows, when you use the <literal>eventlog</literal>
3085          option for <varname>log_destination</>, you should
3086          register an event source and its library with the operating
3087          system so that the Windows Event Viewer can display event
3088          log messages cleanly.
3089          See <xref linkend="event-log-registration"> for details.
3090         </para>
3091        </note>
3092       </listitem>
3093      </varlistentry>
3094
3095      <varlistentry id="guc-logging-collector" xreflabel="logging_collector">
3096       <term><varname>logging_collector</varname> (<type>boolean</type>)</term>
3097       <indexterm>
3098        <primary><varname>logging_collector</> configuration parameter</primary>
3099       </indexterm>
3100       <listitem>
3101        <para>
3102          This parameter captures plain and CSV-format log messages
3103          sent to <application>stderr</> and redirects them into log files.
3104          This approach is often more useful than
3105          logging to <application>syslog</>, since some types of messages
3106          might not appear in <application>syslog</> output (a common example
3107          is dynamic-linker failure messages).
3108          This parameter can only be set at server start.
3109        </para>
3110
3111        <note>
3112         <para>
3113           The logging collector is designed to never lose messages.  This means
3114           that in case of extremely high load, server processes could be
3115           blocked due to trying to send additional log messages when the
3116           collector has fallen behind.  In contrast, <application>syslog</>
3117           prefers to drop messages if it cannot write them, which means it's
3118           less reliable in those cases but it will not block the rest of the
3119           system.
3120         </para>
3121        </note>
3122
3123       </listitem>
3124      </varlistentry>
3125
3126      <varlistentry id="guc-log-directory" xreflabel="log_directory">
3127       <term><varname>log_directory</varname> (<type>string</type>)</term>
3128       <indexterm>
3129        <primary><varname>log_directory</> configuration parameter</primary>
3130       </indexterm>
3131       <listitem>
3132        <para>
3133         When <varname>logging_collector</> is enabled,
3134         this parameter determines the directory in which log files will be created.
3135         It can be specified as an absolute path, or relative to the
3136         cluster data directory.
3137         This parameter can only be set in the <filename>postgresql.conf</>
3138         file or on the server command line.
3139        </para>
3140       </listitem>
3141      </varlistentry>
3142
3143      <varlistentry id="guc-log-filename" xreflabel="log_filename">
3144       <term><varname>log_filename</varname> (<type>string</type>)</term>
3145       <indexterm>
3146        <primary><varname>log_filename</> configuration parameter</primary>
3147       </indexterm>
3148       <listitem>
3149        <para>
3150         When <varname>logging_collector</varname> is enabled,
3151         this parameter sets the file names of the created log files.  The value
3152         is treated as a <systemitem>strftime</systemitem> pattern,
3153         so <literal>%</literal>-escapes can be used to specify time-varying
3154         file names.  (Note that if there are
3155         any time-zone-dependent <literal>%</literal>-escapes, the computation
3156         is done in the zone specified
3157         by <xref linkend="guc-log-timezone">.)
3158         The supported <literal>%</literal>-escapes are similar to those
3159         listed in the Open Group's <ulink
3160         url="http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime
3161         </ulink> specification.
3162         Note that the system's <systemitem>strftime</systemitem> is not used
3163         directly, so platform-specific (nonstandard) extensions do not work.
3164        </para>
3165        <para>
3166         If you specify a file name without escapes, you should plan to
3167         use a log rotation utility to avoid eventually filling the
3168         entire disk.  In releases prior to 8.4, if
3169         no <literal>%</literal> escapes were
3170         present, <productname>PostgreSQL</productname> would append
3171         the epoch of the new log file's creation time, but this is no
3172         longer the case.
3173        </para>
3174        <para>
3175         If CSV-format output is enabled in <varname>log_destination</>,
3176         <literal>.csv</> will be appended to the timestamped
3177         log file name to create the file name for CSV-format output.
3178         (If <varname>log_filename</> ends in <literal>.log</>, the suffix is
3179         replaced instead.)
3180         In the case of the example above, the CSV
3181         file name will be <literal>server_log.1093827753.csv</literal>.
3182        </para>
3183        <para>
3184         This parameter can only be set in the <filename>postgresql.conf</>
3185         file or on the server command line.
3186        </para>
3187       </listitem>
3188      </varlistentry>
3189
3190      <varlistentry id="guc-log-file-mode" xreflabel="log_file_mode">
3191       <term><varname>log_file_mode</varname> (<type>integer</type>)</term>
3192       <indexterm>
3193        <primary><varname>log_file_mode</> configuration parameter</primary>
3194       </indexterm>
3195       <listitem>
3196        <para>
3197         On Unix systems this parameter sets the permissions for log files
3198         when <varname>logging_collector</varname> is enabled. (On Microsoft
3199         Windows this parameter is ignored.)
3200         The parameter value is expected to be a numeric mode
3201         specified in the format accepted by the
3202         <function>chmod</function> and <function>umask</function>
3203         system calls.  (To use the customary octal format the number
3204         must start with a <literal>0</literal> (zero).)
3205        </para>
3206        <para>
3207         The default permissions are <literal>0600</>, meaning only the
3208         server owner can read or write the log files.  The other commonly
3209         useful setting is <literal>0640</>, allowing members of the owner's
3210         group to read the files.  Note however that to make use of such a
3211         setting, you'll need to alter <xref linkend="guc-log-directory"> to
3212         store the files somewhere outside the cluster data directory.  In
3213         any case, it's unwise to make the log files world-readable, since
3214         they might contain sensitive data.
3215        </para>
3216        <para>
3217         This parameter can only be set in the <filename>postgresql.conf</>
3218         file or on the server command line.
3219        </para>
3220       </listitem>
3221      </varlistentry>
3222
3223      <varlistentry id="guc-log-rotation-age" xreflabel="log_rotation_age">
3224       <term><varname>log_rotation_age</varname> (<type>integer</type>)</term>
3225       <indexterm>
3226        <primary><varname>log_rotation_age</> configuration parameter</primary>
3227       </indexterm>
3228       <listitem>
3229        <para>
3230         When <varname>logging_collector</varname> is enabled,
3231         this parameter determines the maximum lifetime of an individual log file.
3232         After this many minutes have elapsed, a new log file will
3233         be created.  Set to zero to disable time-based creation of
3234         new log files.
3235         This parameter can only be set in the <filename>postgresql.conf</>
3236         file or on the server command line.
3237        </para>
3238       </listitem>
3239      </varlistentry>
3240
3241      <varlistentry id="guc-log-rotation-size" xreflabel="log_rotation_size">
3242       <term><varname>log_rotation_size</varname> (<type>integer</type>)</term>
3243       <indexterm>
3244        <primary><varname>log_rotation_size</> configuration parameter</primary>
3245       </indexterm>
3246       <listitem>
3247        <para>
3248         When <varname>logging_collector</varname> is enabled,
3249         this parameter determines the maximum size of an individual log file.
3250         After this many kilobytes have been emitted into a log file,
3251         a new log file will be created.  Set to zero to disable size-based
3252         creation of new log files.
3253         This parameter can only be set in the <filename>postgresql.conf</>
3254         file or on the server command line.
3255        </para>
3256       </listitem>
3257      </varlistentry>
3258
3259      <varlistentry id="guc-log-truncate-on-rotation" xreflabel="log_truncate_on_rotation">
3260       <term><varname>log_truncate_on_rotation</varname> (<type>boolean</type>)</term>
3261       <indexterm>
3262        <primary><varname>log_truncate_on_rotation</> configuration parameter</primary>
3263       </indexterm>
3264       <listitem>
3265        <para>
3266         When <varname>logging_collector</varname> is enabled,
3267         this parameter will cause <productname>PostgreSQL</productname> to truncate (overwrite),
3268         rather than append to, any existing log file of the same name.
3269         However, truncation will occur only when a new file is being opened
3270         due to time-based rotation, not during server startup or size-based
3271         rotation.  When off, pre-existing files will be appended to in
3272         all cases.  For example, using this setting in combination with
3273         a <varname>log_filename</varname> like <literal>postgresql-%H.log</literal>
3274         would result in generating twenty-four hourly log files and then
3275         cyclically overwriting them.
3276         This parameter can only be set in the <filename>postgresql.conf</>
3277         file or on the server command line.
3278        </para>
3279        <para>
3280         Example:  To keep 7 days of logs, one log file per day named
3281         <literal>server_log.Mon</literal>, <literal>server_log.Tue</literal>,
3282         etc, and automatically overwrite last week's log with this week's log,
3283         set <varname>log_filename</varname> to <literal>server_log.%a</literal>,
3284         <varname>log_truncate_on_rotation</varname> to <literal>on</literal>, and
3285         <varname>log_rotation_age</varname> to <literal>1440</literal>.
3286        </para>
3287        <para>
3288         Example: To keep 24 hours of logs, one log file per hour, but
3289         also rotate sooner if the log file size exceeds 1GB, set
3290         <varname>log_filename</varname> to <literal>server_log.%H%M</literal>,
3291         <varname>log_truncate_on_rotation</varname> to <literal>on</literal>,
3292         <varname>log_rotation_age</varname> to <literal>60</literal>, and
3293         <varname>log_rotation_size</varname> to <literal>1000000</literal>.
3294         Including <literal>%M</> in <varname>log_filename</varname> allows
3295         any size-driven rotations that might occur to select a file name
3296         different from the hour's initial file name.
3297        </para>
3298       </listitem>
3299      </varlistentry>
3300
3301      <varlistentry id="guc-syslog-facility" xreflabel="syslog_facility">
3302       <term><varname>syslog_facility</varname> (<type>enum</type>)</term>
3303       <indexterm>
3304        <primary><varname>syslog_facility</> configuration parameter</primary>
3305       </indexterm>
3306       <listitem>
3307        <para>
3308         When logging to <application>syslog</> is enabled, this parameter
3309         determines the <application>syslog</application>
3310         <quote>facility</quote> to be used.  You can choose
3311         from <literal>LOCAL0</>, <literal>LOCAL1</>,
3312         <literal>LOCAL2</>, <literal>LOCAL3</>, <literal>LOCAL4</>,
3313         <literal>LOCAL5</>, <literal>LOCAL6</>, <literal>LOCAL7</>;
3314         the default is <literal>LOCAL0</>. See also the
3315         documentation of your system's
3316         <application>syslog</application> daemon.
3317         This parameter can only be set in the <filename>postgresql.conf</>
3318         file or on the server command line.
3319        </para>
3320       </listitem>
3321      </varlistentry>
3322
3323      <varlistentry id="guc-syslog-ident" xreflabel="syslog_ident">
3324       <term><varname>syslog_ident</varname> (<type>string</type>)</term>
3325       <indexterm>
3326        <primary><varname>syslog_identity</> configuration parameter</primary>
3327       </indexterm>
3328        <listitem>
3329         <para>
3330          When logging to <application>syslog</> is enabled, this parameter
3331          determines the program name used to identify
3332          <productname>PostgreSQL</productname> messages in
3333          <application>syslog</application> logs. The default is
3334          <literal>postgres</literal>.
3335          This parameter can only be set in the <filename>postgresql.conf</>
3336          file or on the server command line.
3337         </para>
3338        </listitem>
3339       </varlistentry>
3340
3341      <varlistentry id="guc-event-source" xreflabel="event_source">
3342       <term><varname>event_source</varname> (<type>string</type>)</term>
3343       <indexterm>
3344        <primary><varname>event_source</> configuration parameter</primary>
3345       </indexterm>
3346       <listitem>
3347        <para>
3348         When logging to <application>event log</> is enabled, this parameter
3349         determines the program name used to identify
3350         <productname>PostgreSQL</productname> messages in
3351         the log. The default is <literal>PostgreSQL</literal>.
3352         This parameter can only be set in the <filename>postgresql.conf</>
3353         file or on the server command line.
3354        </para>
3355       </listitem>
3356      </varlistentry>
3357
3358       </variablelist>
3359     </sect2>
3360      <sect2 id="runtime-config-logging-when">
3361      <title>When To Log</title>
3362
3363      <variablelist>
3364
3365      <varlistentry id="guc-client-min-messages" xreflabel="client_min_messages">
3366       <term><varname>client_min_messages</varname> (<type>enum</type>)</term>
3367       <indexterm>
3368        <primary><varname>client_min_messages</> configuration parameter</primary>
3369       </indexterm>
3370       <listitem>
3371        <para>
3372         Controls which message levels are sent to the client.
3373         Valid values are <literal>DEBUG5</>,
3374         <literal>DEBUG4</>, <literal>DEBUG3</>, <literal>DEBUG2</>,
3375         <literal>DEBUG1</>, <literal>LOG</>, <literal>NOTICE</>,
3376         <literal>WARNING</>, <literal>ERROR</>, <literal>FATAL</>,
3377         and <literal>PANIC</>.  Each level
3378         includes all the levels that follow it.  The later the level,
3379         the fewer messages are sent.  The default is
3380         <literal>NOTICE</>.  Note that <literal>LOG</> has a different
3381         rank here than in <varname>log_min_messages</>.
3382        </para>
3383       </listitem>
3384      </varlistentry>
3385
3386      <varlistentry id="guc-log-min-messages" xreflabel="log_min_messages">
3387       <term><varname>log_min_messages</varname> (<type>enum</type>)</term>
3388       <indexterm>
3389        <primary><varname>log_min_messages</> configuration parameter</primary>
3390       </indexterm>
3391       <listitem>
3392        <para>
3393         Controls which message levels are written to the server log.
3394         Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
3395         <literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>,
3396         <literal>INFO</>, <literal>NOTICE</>, <literal>WARNING</>,
3397         <literal>ERROR</>, <literal>LOG</>, <literal>FATAL</>, and
3398         <literal>PANIC</>.  Each level includes all the levels that
3399         follow it.  The later the level, the fewer messages are sent
3400         to the log.  The default is <literal>WARNING</>.  Note that
3401         <literal>LOG</> has a different rank here than in
3402         <varname>client_min_messages</>.
3403         Only superusers can change this setting.
3404        </para>
3405       </listitem>
3406      </varlistentry>
3407
3408      <varlistentry id="guc-log-min-error-statement" xreflabel="log_min_error_statement">
3409       <term><varname>log_min_error_statement</varname> (<type>enum</type>)</term>
3410       <indexterm>
3411        <primary><varname>log_min_error_statement</> configuration parameter</primary>
3412       </indexterm>
3413       <listitem>
3414        <para>
3415         Controls which SQL statements that cause an error
3416         condition are recorded in the server log.  The current
3417         SQL statement is included in the log entry for any message of
3418         the specified severity or higher.
3419         Valid values are <literal>DEBUG5</literal>,
3420         <literal>DEBUG4</literal>, <literal>DEBUG3</literal>,
3421         <literal>DEBUG2</literal>, <literal>DEBUG1</literal>,
3422         <literal>INFO</literal>, <literal>NOTICE</literal>,
3423         <literal>WARNING</literal>, <literal>ERROR</literal>,
3424         <literal>LOG</literal>,
3425         <literal>FATAL</literal>, and <literal>PANIC</literal>.
3426         The default is <literal>ERROR</literal>, which means statements
3427         causing errors, log messages, fatal errors, or panics will be logged.
3428         To effectively turn off logging of failing statements,
3429         set this parameter to <literal>PANIC</literal>.
3430         Only superusers can change this setting.
3431        </para>
3432       </listitem>
3433      </varlistentry>
3434
3435      <varlistentry id="guc-log-min-duration-statement" xreflabel="log_min_duration_statement">
3436       <term><varname>log_min_duration_statement</varname> (<type>integer</type>)</term>
3437       <indexterm>
3438        <primary><varname>log_min_duration_statement</> configuration parameter</primary>
3439       </indexterm>
3440        <listitem>
3441         <para>
3442          Causes the duration of each completed statement to be logged
3443          if the statement ran for at least the specified number of
3444          milliseconds.  Setting this to zero prints all statement durations.
3445          Minus-one (the default) disables logging statement durations.
3446          For example, if you set it to <literal>250ms</literal>
3447          then all SQL statements that run 250ms or longer will be
3448          logged.  Enabling this parameter can be helpful in tracking down
3449          unoptimized queries in your applications.
3450          Only superusers can change this setting.
3451         </para>
3452
3453         <para>
3454          For clients using extended query protocol, durations of the Parse,
3455          Bind, and Execute steps are logged independently.
3456         </para>
3457
3458        <note>
3459         <para>
3460          When using this option together with
3461          <xref linkend="guc-log-statement">,
3462          the text of statements that are logged because of
3463          <varname>log_statement</> will not be repeated in the
3464          duration log message.
3465          If you are not using <application>syslog</>, it is recommended
3466          that you log the PID or session ID using
3467          <xref linkend="guc-log-line-prefix">
3468          so that you can link the statement message to the later
3469          duration message using the process ID or session ID.
3470         </para>
3471        </note>
3472        </listitem>
3473       </varlistentry>
3474
3475      </variablelist>
3476
3477     <para>
3478      <xref linkend="runtime-config-severity-levels"> explains the message
3479      severity levels used by <productname>PostgreSQL</>.  If logging output
3480      is sent to <systemitem>syslog</systemitem> or Windows'
3481      <systemitem>eventlog</systemitem>, the severity levels are translated
3482      as shown in the table.
3483     </para>
3484
3485     <table id="runtime-config-severity-levels">
3486      <title>Message Severity Levels</title>
3487      <tgroup cols="4">
3488       <thead>
3489        <row>
3490         <entry>Severity</entry>
3491         <entry>Usage</entry>
3492         <entry><systemitem>syslog</></entry>
3493         <entry><systemitem>eventlog</></entry>
3494        </row>
3495       </thead>
3496
3497       <tbody>
3498        <row>
3499         <entry><literal>DEBUG1..DEBUG5</></entry>
3500         <entry>Provides successively-more-detailed information for use by
3501          developers.</entry>
3502         <entry><literal>DEBUG</></entry>
3503         <entry><literal>INFORMATION</></entry>
3504        </row>
3505
3506        <row>
3507         <entry><literal>INFO</></entry>
3508         <entry>Provides information implicitly requested by the user,
3509          e.g., output from <command>VACUUM VERBOSE</>.</entry>
3510         <entry><literal>INFO</></entry>
3511         <entry><literal>INFORMATION</></entry>
3512        </row>
3513
3514        <row>
3515         <entry><literal>NOTICE</></entry>
3516         <entry>Provides information that might be helpful to users, e.g.,
3517          notice of truncation of long identifiers.</entry>
3518         <entry><literal>NOTICE</></entry>
3519         <entry><literal>INFORMATION</></entry>
3520        </row>
3521
3522        <row>
3523         <entry><literal>WARNING</></entry>
3524         <entry>Provides warnings of likely problems, e.g., <command>COMMIT</>
3525          outside a transaction block.</entry>
3526         <entry><literal>NOTICE</></entry>
3527         <entry><literal>WARNING</></entry>
3528        </row>
3529
3530        <row>
3531         <entry><literal>ERROR</></entry>
3532         <entry>Reports an error that caused the current command to
3533          abort.</entry>
3534         <entry><literal>WARNING</></entry>
3535         <entry><literal>ERROR</></entry>
3536        </row>
3537
3538        <row>
3539         <entry><literal>LOG</></entry>
3540         <entry>Reports information of interest to administrators, e.g.,
3541          checkpoint activity.</entry>
3542         <entry><literal>INFO</></entry>
3543         <entry><literal>INFORMATION</></entry>
3544        </row>
3545
3546        <row>
3547         <entry><literal>FATAL</></entry>
3548         <entry>Reports an error that caused the current session to
3549          abort.</entry>
3550         <entry><literal>ERR</></entry>
3551         <entry><literal>ERROR</></entry>
3552        </row>
3553
3554        <row>
3555         <entry><literal>PANIC</></entry>
3556         <entry>Reports an error that caused all database sessions to abort.</entry>
3557         <entry><literal>CRIT</></entry>
3558         <entry><literal>ERROR</></entry>
3559        </row>
3560       </tbody>
3561      </tgroup>
3562     </table>
3563
3564     </sect2>
3565      <sect2 id="runtime-config-logging-what">
3566      <title>What To Log</title>
3567
3568      <variablelist>
3569
3570      <varlistentry id="guc-application-name" xreflabel="application_name">
3571       <term><varname>application_name</varname> (<type>string</type>)</term>
3572       <indexterm>
3573        <primary><varname>application_name</> configuration parameter</primary>
3574       </indexterm>
3575       <listitem>
3576        <para>
3577         The <varname>application_name</varname> can be any string of less than
3578         <symbol>NAMEDATALEN</> characters (64 characters in a standard build).
3579         It is typically set by an application upon connection to the server.
3580         The name will be displayed in the <structname>pg_stat_activity</> view
3581         and included in CSV log entries.  It can also be included in regular
3582         log entries via the <xref linkend="guc-log-line-prefix"> parameter.
3583         Only printable ASCII characters may be used in the
3584         <varname>application_name</varname> value. Other characters will be
3585         replaced with question marks (<literal>?</literal>).
3586        </para>
3587       </listitem>
3588      </varlistentry>
3589
3590      <varlistentry>
3591       <term><varname>debug_print_parse</varname> (<type>boolean</type>)</term>
3592       <term><varname>debug_print_rewritten</varname> (<type>boolean</type>)</term>
3593       <term><varname>debug_print_plan</varname> (<type>boolean</type>)</term>
3594       <indexterm>
3595        <primary><varname>debug_print_parse</> configuration parameter</primary>
3596       </indexterm>
3597       <indexterm>
3598        <primary><varname>debug_print_rewritten</> configuration parameter</primary>
3599       </indexterm>
3600       <indexterm>
3601        <primary><varname>debug_print_plan</> configuration parameter</primary>
3602       </indexterm>
3603       <listitem>
3604        <para>
3605         These parameters enable various debugging output to be emitted.
3606         When set, they print the resulting parse tree, the query rewriter
3607         output, or the execution plan for each executed query.
3608         These messages are emitted at <literal>LOG</> message level, so by
3609         default they will appear in the server log but will not be sent to the
3610         client.  You can change that by adjusting
3611         <xref linkend="guc-client-min-messages"> and/or
3612         <xref linkend="guc-log-min-messages">.
3613         These parameters are off by default.
3614        </para>
3615       </listitem>
3616      </varlistentry>
3617
3618      <varlistentry>
3619       <term><varname>debug_pretty_print</varname> (<type>boolean</type>)</term>
3620       <indexterm>
3621        <primary><varname>debug_pretty_print</> configuration parameter</primary>
3622       </indexterm>
3623       <listitem>
3624        <para>
3625         When set, <varname>debug_pretty_print</varname> indents the messages
3626         produced by <varname>debug_print_parse</varname>,
3627         <varname>debug_print_rewritten</varname>, or
3628         <varname>debug_print_plan</varname>.  This results in more readable
3629         but much longer output than the <quote>compact</> format used when
3630         it is off.  It is on by default.
3631        </para>
3632       </listitem>
3633      </varlistentry>
3634
3635      <varlistentry id="guc-log-checkpoints" xreflabel="log_checkpoints">
3636       <term><varname>log_checkpoints</varname> (<type>boolean</type>)</term>
3637       <indexterm>
3638        <primary><varname>log_checkpoints</> configuration parameter</primary>
3639       </indexterm>
3640       <listitem>
3641        <para>
3642         Causes checkpoints and restartpoints to be logged in the server log.
3643         Some statistics are included in the log messages, including the number
3644         of buffers written and the time spent writing them.
3645         This parameter can only be set in the <filename>postgresql.conf</>
3646         file or on the server command line. The default is off.
3647        </para>
3648       </listitem>
3649      </varlistentry>
3650
3651      <varlistentry id="guc-log-connections" xreflabel="log_connections">
3652       <term><varname>log_connections</varname> (<type>boolean</type>)</term>
3653       <indexterm>
3654        <primary><varname>log_connections</> configuration parameter</primary>
3655       </indexterm>
3656       <listitem>
3657        <para>
3658         Causes each attempted connection to the server to be logged,
3659         as well as successful completion of client authentication.
3660         This parameter cannot be changed after session start.
3661         The default is off.
3662        </para>
3663
3664        <note>
3665         <para>
3666          Some client programs, like <application>psql</>, attempt
3667          to connect twice while determining if a password is required, so
3668          duplicate <quote>connection received</> messages do not
3669          necessarily indicate a problem.
3670         </para>
3671        </note>
3672       </listitem>
3673      </varlistentry>
3674
3675      <varlistentry id="guc-log-disconnections" xreflabel="log_disconnections">
3676       <term><varname>log_disconnections</varname> (<type>boolean</type>)</term>
3677       <indexterm>
3678        <primary><varname>log_disconnections</> configuration parameter</primary>
3679       </indexterm>
3680       <listitem>
3681        <para>
3682         This outputs a line in the server log similar to
3683         <varname>log_connections</varname> but at session termination,
3684         and includes the duration of the session.  This is off by
3685         default.
3686         This parameter cannot be changed after session start.
3687        </para>
3688       </listitem>
3689      </varlistentry>
3690
3691
3692      <varlistentry id="guc-log-duration" xreflabel="log_duration">
3693       <term><varname>log_duration</varname> (<type>boolean</type>)</term>
3694       <indexterm>
3695        <primary><varname>log_duration</> configuration parameter</primary>
3696       </indexterm>
3697       <listitem>
3698        <para>
3699         Causes the duration of every completed statement to be logged.
3700         The default is <literal>off</>.
3701         Only superusers can change this setting.
3702        </para>
3703
3704        <para>
3705         For clients using extended query protocol, durations of the Parse,
3706         Bind, and Execute steps are logged independently.
3707        </para>
3708
3709        <note>
3710         <para>
3711          The difference between setting this option and setting
3712          <xref linkend="guc-log-min-duration-statement"> to zero is that
3713          exceeding <varname>log_min_duration_statement</> forces the text of
3714          the query to be logged, but this option doesn't.  Thus, if
3715          <varname>log_duration</> is <literal>on</> and
3716          <varname>log_min_duration_statement</> has a positive value, all
3717          durations are logged but the query text is included only for
3718          statements exceeding the threshold.  This behavior can be useful for
3719          gathering statistics in high-load installations.
3720         </para>
3721        </note>
3722       </listitem>
3723      </varlistentry>
3724
3725      <varlistentry id="guc-log-error-verbosity" xreflabel="log_error_verbosity">
3726       <term><varname>log_error_verbosity</varname> (<type>enum</type>)</term>
3727       <indexterm>
3728        <primary><varname>log_error_verbosity</> configuration parameter</primary>
3729       </indexterm>
3730       <listitem>
3731        <para>
3732         Controls the amount of detail written in the server log for each
3733         message that is logged.  Valid values are <literal>TERSE</>,
3734         <literal>DEFAULT</>, and <literal>VERBOSE</>, each adding more
3735         fields to displayed messages.  <literal>TERSE</> excludes
3736         the logging of <literal>DETAIL</>, <literal>HINT</>,
3737         <literal>QUERY</>, and <literal>CONTEXT</> error information.
3738         <literal>VERBOSE</> output includes the <symbol>SQLSTATE</> error
3739         code (see also <xref linkend="errcodes-appendix">) and the source code file name, function name,
3740         and line number that generated the error.
3741         Only superusers can change this setting.
3742        </para>
3743       </listitem>
3744      </varlistentry>
3745
3746      <varlistentry id="guc-log-hostname" xreflabel="log_hostname">
3747       <term><varname>log_hostname</varname> (<type>boolean</type>)</term>
3748       <indexterm>
3749        <primary><varname>log_hostname</> configuration parameter</primary>
3750       </indexterm>
3751       <listitem>
3752        <para>
3753         By default, connection log messages only show the IP address of the
3754         connecting host. Turning this parameter on causes logging of the
3755         host name as well.  Note that depending on your host name resolution
3756         setup this might impose a non-negligible performance penalty.
3757         This parameter can only be set in the <filename>postgresql.conf</>
3758         file or on the server command line.
3759        </para>
3760       </listitem>
3761      </varlistentry>
3762
3763      <varlistentry id="guc-log-line-prefix" xreflabel="log_line_prefix">
3764       <term><varname>log_line_prefix</varname> (<type>string</type>)</term>
3765       <indexterm>
3766        <primary><varname>log_line_prefix</> configuration parameter</primary>
3767       </indexterm>
3768       <listitem>
3769        <para>
3770          This is a <function>printf</>-style string that is output at the
3771          beginning of each log line.
3772          <literal>%</> characters begin <quote>escape sequences</>
3773          that are replaced with status information as outlined below.
3774          Unrecognized escapes are ignored. Other
3775          characters are copied straight to the log line. Some escapes are
3776          only recognized by session processes, and are ignored by
3777          background processes such as the main server process.
3778          This parameter can only be set in the <filename>postgresql.conf</>
3779          file or on the server command line. The default is an empty string.
3780
3781          <informaltable>
3782           <tgroup cols="3">
3783            <thead>
3784             <row>
3785              <entry>Escape</entry>
3786              <entry>Effect</entry>
3787              <entry>Session only</entry>
3788              </row>
3789             </thead>
3790            <tbody>
3791             <row>
3792              <entry><literal>%a</literal></entry>
3793              <entry>Application name</entry>
3794              <entry>yes</entry>
3795             </row>
3796             <row>
3797              <entry><literal>%u</literal></entry>
3798              <entry>User name</entry>
3799              <entry>yes</entry>
3800             </row>
3801             <row>
3802              <entry><literal>%d</literal></entry>
3803              <entry>Database name</entry>
3804              <entry>yes</entry>
3805             </row>
3806             <row>
3807              <entry><literal>%r</literal></entry>
3808              <entry>Remote host name or IP address, and remote port</entry>
3809              <entry>yes</entry>
3810             </row>
3811             <row>
3812              <entry><literal>%h</literal></entry>
3813              <entry>Remote host name or IP address</entry>
3814              <entry>yes</entry>
3815             </row>
3816             <row>
3817              <entry><literal>%p</literal></entry>
3818              <entry>Process ID</entry>
3819              <entry>no</entry>
3820             </row>
3821             <row>
3822              <entry><literal>%t</literal></entry>
3823              <entry>Time stamp without milliseconds</entry>
3824              <entry>no</entry>
3825             </row>
3826             <row>
3827              <entry><literal>%m</literal></entry>
3828              <entry>Time stamp with milliseconds</entry>
3829              <entry>no</entry>
3830             </row>
3831             <row>
3832              <entry><literal>%i</literal></entry>
3833              <entry>Command tag: type of session's current command</entry>
3834              <entry>yes</entry>
3835             </row>
3836             <row>
3837              <entry><literal>%e</literal></entry>
3838              <entry>SQLSTATE error code</entry>
3839              <entry>no</entry>
3840             </row>
3841             <row>
3842              <entry><literal>%c</literal></entry>
3843              <entry>Session ID: see below</entry>
3844              <entry>no</entry>
3845             </row>
3846             <row>
3847              <entry><literal>%l</literal></entry>
3848              <entry>Number of the log line for each session or process, starting at 1</entry>
3849              <entry>no</entry>
3850             </row>
3851             <row>
3852              <entry><literal>%s</literal></entry>
3853              <entry>Process start time stamp</entry>
3854              <entry>no</entry>
3855             </row>
3856             <row>
3857              <entry><literal>%v</literal></entry>
3858              <entry>Virtual transaction ID (backendID/localXID)</entry>
3859              <entry>no</entry>
3860             </row>
3861             <row>
3862              <entry><literal>%x</literal></entry>
3863              <entry>Transaction ID (0 if none is assigned)</entry>
3864              <entry>no</entry>
3865             </row>
3866             <row>
3867              <entry><literal>%q</literal></entry>
3868              <entry>Produces no output, but tells non-session
3869              processes to stop at this point in the string; ignored by
3870              session processes</entry>
3871              <entry>no</entry>
3872             </row>
3873             <row>
3874              <entry><literal>%%</literal></entry>
3875              <entry>Literal <literal>%</></entry>
3876              <entry>no</entry>
3877             </row>
3878            </tbody>
3879           </tgroup>
3880          </informaltable>
3881
3882          The <literal>%c</> escape prints a quasi-unique session identifier,
3883          consisting of two 4-byte hexadecimal numbers (without leading zeros)
3884          separated by a dot.  The numbers are the process start time and the
3885          process ID, so <literal>%c</> can also be used as a space saving way
3886          of printing those items.  For example, to generate the session
3887          identifier from <literal>pg_stat_activity</>, use this query:
3888 <programlisting>
3889 SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
3890        to_hex(pid)
3891 FROM pg_stat_activity;
3892 </programlisting>
3893
3894        </para>
3895
3896        <tip>
3897         <para>
3898          If you set a nonempty value for <varname>log_line_prefix</>,
3899          you should usually make its last character be a space, to provide
3900          visual separation from the rest of the log line.  A punctuation
3901          character can be used too.
3902         </para>
3903        </tip>
3904
3905        <tip>
3906         <para>
3907          <application>Syslog</> produces its own
3908          time stamp and process ID information, so you probably do not want to
3909          include those escapes if you are logging to <application>syslog</>.
3910         </para>
3911        </tip>
3912       </listitem>
3913      </varlistentry>
3914
3915      <varlistentry id="guc-log-lock-waits" xreflabel="log_lock_waits">
3916       <term><varname>log_lock_waits</varname> (<type>boolean</type>)</term>
3917       <indexterm>
3918        <primary><varname>log_lock_waits</> configuration parameter</primary>
3919       </indexterm>
3920       <listitem>
3921        <para>
3922         Controls whether a log message is produced when a session waits
3923         longer than <xref linkend="guc-deadlock-timeout"> to acquire a
3924         lock.  This is useful in determining if lock waits are causing
3925         poor performance.  The default is <literal>off</>.
3926        </para>
3927       </listitem>
3928      </varlistentry>
3929
3930      <varlistentry id="guc-log-statement" xreflabel="log_statement">
3931       <term><varname>log_statement</varname> (<type>enum</type>)</term>
3932       <indexterm>
3933        <primary><varname>log_statement</> configuration parameter</primary>
3934       </indexterm>
3935       <listitem>
3936        <para>
3937         Controls which SQL statements are logged. Valid values are
3938         <literal>none</> (off), <literal>ddl</>, <literal>mod</>, and
3939         <literal>all</> (all statements). <literal>ddl</> logs all data definition
3940         statements, such as <command>CREATE</>, <command>ALTER</>, and
3941         <command>DROP</> statements. <literal>mod</> logs all
3942         <literal>ddl</> statements, plus data-modifying statements
3943         such as <command>INSERT</>,
3944         <command>UPDATE</>, <command>DELETE</>, <command>TRUNCATE</>,
3945         and <command>COPY FROM</>.
3946         <command>PREPARE</>, <command>EXECUTE</>, and
3947         <command>EXPLAIN ANALYZE</> statements are also logged if their
3948         contained command is of an appropriate type.  For clients using
3949         extended query protocol, logging occurs when an Execute message
3950         is received, and values of the Bind parameters are included
3951         (with any embedded single-quote marks doubled).
3952        </para>
3953
3954        <para>
3955         The default is <literal>none</>. Only superusers can change this
3956         setting.
3957        </para>
3958
3959        <note>
3960         <para>
3961          Statements that contain simple syntax errors are not logged
3962          even by the <varname>log_statement</> = <literal>all</> setting,
3963          because the log message is emitted only after basic parsing has
3964          been done to determine the statement type.  In the case of extended
3965          query protocol, this setting likewise does not log statements that
3966          fail before the Execute phase (i.e., during parse analysis or
3967          planning).  Set <varname>log_min_error_statement</> to
3968          <literal>ERROR</> (or lower) to log such statements.
3969         </para>
3970        </note>
3971       </listitem>
3972      </varlistentry>
3973
3974      <varlistentry id="guc-log-temp-files" xreflabel="log_temp_files">
3975       <term><varname>log_temp_files</varname> (<type>integer</type>)</term>
3976       <indexterm>
3977        <primary><varname>log_temp_files</> configuration parameter</primary>
3978       </indexterm>
3979       <listitem>
3980        <para>
3981         Controls logging of temporary file names and sizes.
3982         Temporary files can be
3983         created for sorts, hashes, and temporary query results.
3984         A log entry is made for each temporary file when it is deleted.
3985         A value of zero logs all temporary file information, while positive
3986         values log only files whose size is greater than or equal to
3987         the specified number of kilobytes.  The
3988         default setting is -1, which disables such logging.
3989         Only superusers can change this setting.
3990        </para>
3991       </listitem>
3992      </varlistentry>
3993
3994      <varlistentry id="guc-log-timezone" xreflabel="log_timezone">
3995       <term><varname>log_timezone</varname> (<type>string</type>)</term>
3996       <indexterm>
3997        <primary><varname>log_timezone</> configuration parameter</primary>
3998       </indexterm>
3999       <listitem>
4000        <para>
4001         Sets the time zone used for timestamps written in the server log.
4002         Unlike <xref linkend="guc-timezone">, this value is cluster-wide,
4003         so that all sessions will report timestamps consistently.
4004         The built-in default is <literal>GMT</>, but that is typically
4005         overridden in <filename>postgresql.conf</>; <application>initdb</>
4006         will install a setting there corresponding to its system environment.
4007         See <xref linkend="datatype-timezones"> for more information.
4008         This parameter can only be set in the <filename>postgresql.conf</>
4009         file or on the server command line.
4010        </para>
4011       </listitem>
4012      </varlistentry>
4013
4014      </variablelist>
4015     </sect2>
4016      <sect2 id="runtime-config-logging-csvlog">
4017      <title>Using CSV-Format Log Output</title>
4018
4019        <para>
4020         Including <literal>csvlog</> in the <varname>log_destination</> list
4021         provides a convenient way to import log files into a database table.
4022         This option emits log lines in comma-separated-values
4023         (<acronym>CSV</>) format,
4024         with these columns:
4025         time stamp with milliseconds,
4026         user name,
4027         database name,
4028         process ID,
4029         client host:port number,
4030         session ID,
4031         per-session line number,
4032         command tag,
4033         session start time,
4034         virtual transaction ID,
4035         regular transaction ID,
4036         error severity,
4037         SQLSTATE code,
4038         error message,
4039         error message detail,
4040         hint,
4041         internal query that led to the error (if any),
4042         character count of the error position therein,
4043         error context,
4044         user query that led to the error (if any and enabled by
4045         <varname>log_min_error_statement</>),
4046         character count of the error position therein,
4047         location of the error in the PostgreSQL source code
4048         (if <varname>log_error_verbosity</> is set to <literal>verbose</>),
4049         and application name.
4050         Here is a sample table definition for storing CSV-format log output:
4051
4052 <programlisting>
4053 CREATE TABLE postgres_log
4054 (
4055   log_time timestamp(3) with time zone,
4056   user_name text,
4057   database_name text,
4058   process_id integer,
4059   connection_from text,
4060   session_id text,
4061   session_line_num bigint,
4062   command_tag text,
4063   session_start_time timestamp with time zone,
4064   virtual_transaction_id text,
4065   transaction_id bigint,
4066   error_severity text,
4067   sql_state_code text,
4068   message text,
4069   detail text,
4070   hint text,
4071   internal_query text,
4072   internal_query_pos integer,
4073   context text,
4074   query text,
4075   query_pos integer,
4076   location text,
4077   application_name text,
4078   PRIMARY KEY (session_id, session_line_num)
4079 );
4080 </programlisting>
4081        </para>
4082
4083        <para>
4084         To import a log file into this table, use the <command>COPY FROM</>
4085         command:
4086
4087 <programlisting>
4088 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
4089 </programlisting>
4090        </para>
4091
4092        <para>
4093        There are a few things you need to do to simplify importing CSV log
4094        files:
4095
4096        <orderedlist>
4097          <listitem>
4098            <para>
4099             Set <varname>log_filename</varname> and
4100             <varname>log_rotation_age</> to provide a consistent,
4101             predictable naming scheme for your log files.  This lets you
4102             predict what the file name will be and know when an individual log
4103             file is complete and therefore ready to be imported.
4104          </para>
4105         </listitem>
4106
4107         <listitem>
4108            <para>
4109             Set <varname>log_rotation_size</varname> to 0 to disable
4110             size-based log rotation, as it makes the log file name difficult
4111             to predict.
4112            </para>
4113         </listitem>
4114
4115         <listitem>
4116           <para>
4117            Set <varname>log_truncate_on_rotation</varname> to <literal>on</> so
4118            that old log data isn't mixed with the new in the same file.
4119           </para>
4120         </listitem>
4121
4122         <listitem>
4123           <para>
4124            The table definition above includes a primary key specification.
4125            This is useful to protect against accidentally importing the same
4126            information twice.  The <command>COPY</> command commits all of the
4127            data it imports at one time, so any error will cause the entire
4128            import to fail.  If you import a partial log file and later import
4129            the file again when it is complete, the primary key violation will
4130            cause the import to fail.  Wait until the log is complete and
4131            closed before importing.  This procedure will also protect against
4132            accidentally importing a partial line that hasn't been completely
4133            written, which would also cause <command>COPY</> to fail.
4134           </para>
4135         </listitem>
4136         </orderedlist>
4137       </para>
4138
4139     </sect2>
4140    </sect1>
4141
4142    <sect1 id="runtime-config-statistics">
4143     <title>Run-time Statistics</title>
4144
4145     <sect2 id="runtime-config-statistics-collector">
4146      <title>Query and Index Statistics Collector</title>
4147
4148      <para>
4149       These parameters control server-wide statistics collection features.
4150       When statistics collection is enabled, the data that is produced can be
4151       accessed via the <structname>pg_stat</structname> and
4152       <structname>pg_statio</structname> family of system views.
4153       Refer to <xref linkend="monitoring"> for more information.
4154      </para>
4155
4156      <variablelist>
4157
4158      <varlistentry id="guc-track-activities" xreflabel="track_activities">
4159       <term><varname>track_activities</varname> (<type>boolean</type>)</term>
4160       <indexterm>
4161        <primary><varname>track_activities</> configuration parameter</primary>
4162       </indexterm>
4163       <listitem>
4164        <para>
4165         Enables the collection of information on the currently
4166         executing command of each session, along with the time when
4167         that command began execution. This parameter is on by
4168         default. Note that even when enabled, this information is not
4169         visible to all users, only to superusers and the user owning
4170         the session being reported on, so it should not represent a
4171         security risk.
4172         Only superusers can change this setting.
4173        </para>
4174       </listitem>
4175      </varlistentry>
4176
4177      <varlistentry id="guc-track-activity-query-size" xreflabel="track_activity_query_size">
4178       <term><varname>track_activity_query_size</varname> (<type>integer</type>)</term>
4179       <indexterm>
4180        <primary><varname>track_activity_query_size</> configuration parameter</primary>
4181       </indexterm>
4182       <listitem>
4183        <para>
4184        Specifies the number of bytes reserved to track the currently
4185        executing command for each active session, for the
4186        <structname>pg_stat_activity</>.<structfield>query</> field.
4187        The default value is 1024. This parameter can only be set at server
4188        start.
4189        </para>
4190       </listitem>
4191      </varlistentry>
4192
4193      <varlistentry id="guc-track-counts" xreflabel="track_counts">
4194       <term><varname>track_counts</varname> (<type>boolean</type>)</term>
4195       <indexterm>
4196        <primary><varname>track_counts</> configuration parameter</primary>
4197       </indexterm>
4198       <listitem>
4199        <para>
4200         Enables collection of statistics on database activity.
4201         This parameter is on by default, because the autovacuum
4202         daemon needs the collected information.
4203         Only superusers can change this setting.
4204        </para>
4205       </listitem>
4206      </varlistentry>
4207
4208      <varlistentry id="guc-track-functions" xreflabel="track_functions">
4209       <term><varname>track_functions</varname> (<type>enum</type>)</term>
4210       <indexterm>
4211        <primary><varname>track_functions</> configuration parameter</primary>
4212       </indexterm>
4213       <listitem>
4214        <para>
4215         Enables tracking of function call counts and time used. Specify
4216         <literal>pl</literal> to track only procedural-language functions,
4217         <literal>all</literal> to also track SQL and C language functions.
4218         The default is <literal>none</literal>, which disables function
4219         statistics tracking.  Only superusers can change this setting.
4220        </para>
4221
4222        <note>
4223         <para>
4224          SQL-language functions that are simple enough to be <quote>inlined</>
4225          into the calling query will not be tracked, regardless of this
4226          setting.
4227         </para>
4228        </note>
4229       </listitem>
4230      </varlistentry>
4231
4232      <varlistentry id="guc-update-process-title" xreflabel="update_process_title">
4233       <term><varname>update_process_title</varname> (<type>boolean</type>)</term>
4234       <indexterm>
4235        <primary><varname>update_process_title</> configuration parameter</primary>
4236       </indexterm>
4237       <listitem>
4238        <para>
4239         Enables updating of the process title every time a new SQL command
4240         is received by the server.  The process title is typically viewed
4241         by the <command>ps</> command,
4242         or in Windows by using the <application>Process Explorer</>.
4243         Only superusers can change this setting.
4244        </para>
4245       </listitem>
4246      </varlistentry>
4247
4248      <varlistentry id="guc-stats-temp-directory" xreflabel="stats_temp_directory">
4249       <term><varname>stats_temp_directory</varname> (<type>string</type>)</term>
4250       <indexterm>
4251        <primary><varname>stats_temp_directory</> configuration parameter</primary>
4252       </indexterm>
4253       <listitem>
4254        <para>
4255         Sets the directory to store temporary statistics data in. This can be
4256         a path relative to the data directory or an absolute path. The default
4257         is <filename>pg_stat_tmp</filename>. Pointing this at a RAM-based
4258         file system will decrease physical I/O requirements and can lead to
4259         improved performance.
4260         This parameter can only be set in the <filename>postgresql.conf</>
4261         file or on the server command line.
4262        </para>
4263       </listitem>
4264      </varlistentry>
4265
4266      </variablelist>
4267     </sect2>
4268
4269     <sect2 id="runtime-config-statistics-monitor">
4270      <title>Statistics Monitoring</title>
4271      <variablelist>
4272
4273      <varlistentry>
4274       <term><varname>log_statement_stats</varname> (<type>boolean</type>)</term>
4275       <term><varname>log_parser_stats</varname> (<type>boolean</type>)</term>
4276       <term><varname>log_planner_stats</varname> (<type>boolean</type>)</term>
4277       <term><varname>log_executor_stats</varname> (<type>boolean</type>)</term>
4278       <indexterm>
4279        <primary><varname>log_statement_stats</> configuration parameter</primary>
4280       </indexterm>
4281       <indexterm>
4282        <primary><varname>log_parser_stats</> configuration parameter</primary>
4283       </indexterm>
4284       <indexterm>
4285        <primary><varname>log_planner_stats</> configuration parameter</primary>
4286       </indexterm>
4287       <indexterm>
4288        <primary><varname>log_executor_stats</> configuration parameter</primary>
4289       </indexterm>
4290       <listitem>
4291        <para>
4292         For each query, output performance statistics of the respective
4293         module to the server log. This is a crude profiling
4294         instrument, similar to the Unix <function>getrusage()</> operating
4295         system facility.  <varname>log_statement_stats</varname> reports total
4296         statement statistics, while the others report per-module statistics.
4297         <varname>log_statement_stats</varname> cannot be enabled together with
4298         any of the per-module options.  All of these options are disabled by
4299         default.   Only superusers can change these settings.
4300        </para>
4301       </listitem>
4302      </varlistentry>
4303
4304      </variablelist>
4305
4306     </sect2>
4307    </sect1>
4308
4309    <sect1 id="runtime-config-autovacuum">
4310     <title>Automatic Vacuuming</title>
4311
4312     <indexterm>
4313      <primary>autovacuum</primary>
4314      <secondary>configuration parameters</secondary>
4315     </indexterm>
4316
4317      <para>
4318       These settings control the behavior of the <firstterm>autovacuum</>
4319       feature.  Refer to <xref linkend="autovacuum"> for
4320       more information.
4321      </para>
4322
4323     <variablelist>
4324
4325      <varlistentry id="guc-autovacuum" xreflabel="autovacuum">
4326       <term><varname>autovacuum</varname> (<type>boolean</type>)</term>
4327       <indexterm>
4328        <primary><varname>autovacuum</> configuration parameter</primary>
4329       </indexterm>
4330       <listitem>
4331        <para>
4332         Controls whether the server should run the
4333         autovacuum launcher daemon.  This is on by default; however,
4334         <xref linkend="guc-track-counts"> must also be enabled for
4335         autovacuum to work.
4336         This parameter can only be set in the <filename>postgresql.conf</>
4337         file or on the server command line.
4338        </para>
4339        <para>
4340         Note that even when this parameter is disabled, the system
4341         will launch autovacuum processes if necessary to
4342         prevent transaction ID wraparound.  See <xref
4343         linkend="vacuum-for-wraparound"> for more information.
4344        </para>
4345       </listitem>
4346      </varlistentry>
4347
4348      <varlistentry id="guc-log-autovacuum-min-duration" xreflabel="log_autovacuum_min_duration">
4349       <term><varname>log_autovacuum_min_duration</varname> (<type>integer</type>)</term>
4350       <indexterm>
4351        <primary><varname>log_autovacuum_min_duration</> configuration parameter</primary>
4352       </indexterm>
4353       <listitem>
4354        <para>
4355         Causes each action executed by autovacuum to be logged if it ran for at
4356         least the specified number of milliseconds.  Setting this to zero logs
4357         all autovacuum actions. Minus-one (the default) disables logging
4358         autovacuum actions.  For example, if you set this to
4359         <literal>250ms</literal> then all automatic vacuums and analyzes that run
4360         250ms or longer will be logged.  In addition, when this parameter is
4361         set to any value other than <literal>-1</literal>, a message will be
4362         logged if an autovacuum action is skipped due to the existence of a
4363         conflicting lock.  Enabling this parameter can be helpful
4364         in tracking autovacuum activity.  This setting can only be set in
4365         the <filename>postgresql.conf</> file or on the server command line.
4366        </para>
4367       </listitem>
4368      </varlistentry>
4369
4370      <varlistentry id="guc-autovacuum-max-workers" xreflabel="autovacuum_max_workers">
4371       <term><varname>autovacuum_max_workers</varname> (<type>integer</type>)</term>
4372       <indexterm>
4373        <primary><varname>autovacuum_max_workers</> configuration parameter</primary>
4374       </indexterm>
4375       <listitem>
4376        <para>
4377         Specifies the maximum number of autovacuum processes (other than the
4378         autovacuum launcher) which may be running at any one time.  The default
4379         is three.  This parameter can only be set at server start.
4380        </para>
4381       </listitem>
4382      </varlistentry>
4383
4384      <varlistentry id="guc-autovacuum-naptime" xreflabel="autovacuum_naptime">
4385       <term><varname>autovacuum_naptime</varname> (<type>integer</type>)</term>
4386       <indexterm>
4387        <primary><varname>autovacuum_naptime</> configuration parameter</primary>
4388       </indexterm>
4389       <listitem>
4390        <para>
4391         Specifies the minimum delay between autovacuum runs on any given
4392         database.  In each round the daemon examines the
4393         database and issues <command>VACUUM</> and <command>ANALYZE</> commands
4394         as needed for tables in that database.  The delay is measured
4395         in seconds, and the default is one minute (<literal>1min</>).
4396         This parameter can only be set in the <filename>postgresql.conf</>
4397         file or on the server command line.
4398        </para>
4399       </listitem>
4400      </varlistentry>
4401
4402      <varlistentry id="guc-autovacuum-vacuum-threshold" xreflabel="autovacuum_vacuum_threshold">
4403       <term><varname>autovacuum_vacuum_threshold</varname> (<type>integer</type>)</term>
4404       <indexterm>
4405        <primary><varname>autovacuum_vacuum_threshold</> configuration parameter</primary>
4406       </indexterm>
4407       <listitem>
4408        <para>
4409         Specifies the minimum number of updated or deleted tuples needed
4410         to trigger a <command>VACUUM</> in any one table.
4411         The default is 50 tuples.
4412         This parameter can only be set in the <filename>postgresql.conf</>
4413         file or on the server command line.
4414         This setting can be overridden for individual tables by
4415         changing storage parameters.
4416        </para>
4417       </listitem>
4418      </varlistentry>
4419
4420      <varlistentry id="guc-autovacuum-analyze-threshold" xreflabel="autovacuum_analyze_threshold">
4421       <term><varname>autovacuum_analyze_threshold</varname> (<type>integer</type>)</term>
4422       <indexterm>
4423        <primary><varname>autovacuum_analyze_threshold</> configuration parameter</primary>
4424       </indexterm>
4425       <listitem>
4426        <para>
4427         Specifies the minimum number of inserted, updated or deleted tuples
4428         needed to trigger an <command>ANALYZE</> in any one table.
4429         The default is 50 tuples.
4430         This parameter can only be set in the <filename>postgresql.conf</>
4431         file or on the server command line.
4432         This setting can be overridden for individual tables by
4433         changing storage parameters.
4434        </para>
4435       </listitem>
4436      </varlistentry>
4437
4438      <varlistentry id="guc-autovacuum-vacuum-scale-factor" xreflabel="autovacuum_vacuum_scale_factor">
4439       <term><varname>autovacuum_vacuum_scale_factor</varname> (<type>floating point</type>)</term>
4440       <indexterm>
4441        <primary><varname>autovacuum_vacuum_scale_factor</> configuration parameter</primary>
4442       </indexterm>
4443       <listitem>
4444        <para>
4445         Specifies a fraction of the table size to add to
4446         <varname>autovacuum_vacuum_threshold</varname>
4447         when deciding whether to trigger a <command>VACUUM</>.
4448         The default is 0.2 (20% of table size).
4449         This parameter can only be set in the <filename>postgresql.conf</>
4450         file or on the server command line.
4451         This setting can be overridden for individual tables by
4452         changing storage parameters.
4453        </para>
4454       </listitem>
4455      </varlistentry>
4456
4457      <varlistentry id="guc-autovacuum-analyze-scale-factor" xreflabel="autovacuum_analyze_scale_factor">
4458       <term><varname>autovacuum_analyze_scale_factor</varname> (<type>floating point</type>)</term>
4459       <indexterm>
4460        <primary><varname>autovacuum_analyze_scale_factor</> configuration parameter</primary>
4461       </indexterm>
4462       <listitem>
4463        <para>
4464         Specifies a fraction of the table size to add to
4465         <varname>autovacuum_analyze_threshold</varname>
4466         when deciding whether to trigger an <command>ANALYZE</>.
4467         The default is 0.1 (10% of table size).
4468         This parameter can only be set in the <filename>postgresql.conf</>
4469         file or on the server command line.
4470         This setting can be overridden for individual tables by
4471         changing storage parameters.
4472        </para>
4473       </listitem>
4474      </varlistentry>
4475
4476      <varlistentry id="guc-autovacuum-freeze-max-age" xreflabel="autovacuum_freeze_max_age">
4477       <term><varname>autovacuum_freeze_max_age</varname> (<type>integer</type>)</term>
4478       <indexterm>
4479        <primary><varname>autovacuum_freeze_max_age</> configuration parameter</primary>
4480       </indexterm>
4481       <listitem>
4482        <para>
4483         Specifies the maximum age (in transactions) that a table's
4484         <structname>pg_class</>.<structfield>relfrozenxid</> field can
4485         attain before a <command>VACUUM</> operation is forced
4486         to prevent transaction ID wraparound within the table.
4487         Note that the system will launch autovacuum processes to
4488         prevent wraparound even when autovacuum is otherwise disabled.
4489        </para>
4490
4491        <para>
4492         Vacuum also allows removal of old files from the
4493         <filename>pg_clog</> subdirectory, which is why the default
4494         is a relatively low 200 million transactions.
4495         This parameter can only be set at server start, but the setting
4496         can be reduced for individual tables by
4497         changing storage parameters.
4498         For more information see <xref linkend="vacuum-for-wraparound">.
4499        </para>
4500       </listitem>
4501      </varlistentry>
4502
4503      <varlistentry id="guc-autovacuum-vacuum-cost-delay" xreflabel="autovacuum_vacuum_cost_delay">
4504       <term><varname>autovacuum_vacuum_cost_delay</varname> (<type>integer</type>)</term>
4505       <indexterm>
4506        <primary><varname>autovacuum_vacuum_cost_delay</> configuration parameter</primary>
4507       </indexterm>
4508       <listitem>
4509        <para>
4510         Specifies the cost delay value that will be used in automatic
4511         <command>VACUUM</> operations.  If -1 is specified, the regular
4512         <xref linkend="guc-vacuum-cost-delay"> value will be used.
4513         The default value is 20 milliseconds.
4514         This parameter can only be set in the <filename>postgresql.conf</>
4515         file or on the server command line.
4516         This setting can be overridden for individual tables by
4517         changing storage parameters.
4518        </para>
4519       </listitem>
4520      </varlistentry>
4521
4522      <varlistentry id="guc-autovacuum-vacuum-cost-limit" xreflabel="autovacuum_vacuum_cost_limit">
4523       <term><varname>autovacuum_vacuum_cost_limit</varname> (<type>integer</type>)</term>
4524       <indexterm>
4525        <primary><varname>autovacuum_vacuum_cost_limit</> configuration parameter</primary>
4526       </indexterm>
4527       <listitem>
4528        <para>
4529         Specifies the cost limit value that will be used in automatic
4530         <command>VACUUM</> operations.  If -1 is specified (which is the
4531         default), the regular
4532         <xref linkend="guc-vacuum-cost-limit"> value will be used.  Note that
4533         the value is distributed proportionally among the running autovacuum
4534         workers, if there is more than one, so that the sum of the limits of
4535         each worker never exceeds the limit on this variable.
4536         This parameter can only be set in the <filename>postgresql.conf</>
4537         file or on the server command line.
4538         This setting can be overridden for individual tables by
4539         changing storage parameters.
4540        </para>
4541       </listitem>
4542      </varlistentry>
4543
4544     </variablelist>
4545    </sect1>
4546
4547    <sect1 id="runtime-config-client">
4548     <title>Client Connection Defaults</title>
4549
4550     <sect2 id="runtime-config-client-statement">
4551      <title>Statement Behavior</title>
4552      <variablelist>
4553
4554      <varlistentry id="guc-search-path" xreflabel="search_path">
4555       <term><varname>search_path</varname> (<type>string</type>)</term>
4556       <indexterm>
4557        <primary><varname>search_path</> configuration parameter</primary>
4558       </indexterm>
4559       <indexterm><primary>path</><secondary>for schemas</></>
4560       <listitem>
4561        <para>
4562         This variable specifies the order in which schemas are searched
4563         when an object (table, data type, function, etc.) is referenced by a
4564         simple name with no schema specified.  When there are objects of
4565         identical names in different schemas, the one found first
4566         in the search path is used.  An object that is not in any of the
4567         schemas in the search path can only be referenced by specifying
4568         its containing schema with a qualified (dotted) name.
4569        </para>
4570
4571        <para>
4572         The value for <varname>search_path</varname> must be a comma-separated
4573         list of schema names.  If one of the list items is
4574         the special value <literal>$user</literal>, then the schema
4575         having the name returned by <function>SESSION_USER</> is substituted, if there
4576         is such a schema.  (If not, <literal>$user</literal> is ignored.)
4577        </para>
4578
4579        <para>
4580         The system catalog schema, <literal>pg_catalog</>, is always
4581         searched, whether it is mentioned in the path or not.  If it is
4582         mentioned in the path then it will be searched in the specified
4583         order.  If <literal>pg_catalog</> is not in the path then it will
4584         be searched <emphasis>before</> searching any of the path items.
4585        </para>
4586
4587        <para>
4588         Likewise, the current session's temporary-table schema,
4589         <literal>pg_temp_<replaceable>nnn</></>, is always searched if it
4590         exists.  It can be explicitly listed in the path by using the
4591         alias <literal>pg_temp</>.  If it is not listed in the path then
4592         it is searched first (even before <literal>pg_catalog</>).  However,
4593         the temporary schema is only searched for relation (table, view,
4594         sequence, etc) and data type names.  It is never searched for
4595         function or operator names.
4596        </para>
4597
4598        <para>
4599         When objects are created without specifying a particular target
4600         schema, they will be placed in the first schema listed
4601         in the search path.  An error is reported if the search path is
4602         empty.
4603        </para>
4604
4605        <para>
4606         The default value for this parameter is
4607         <literal>'"$user", public'</literal> (where the second part will be
4608         ignored if there is no schema named <literal>public</>).
4609         This supports shared use of a database (where no users
4610         have private schemas, and all share use of <literal>public</>),
4611         private per-user schemas, and combinations of these.  Other
4612         effects can be obtained by altering the default search path
4613         setting, either globally or per-user.
4614        </para>
4615
4616        <para>
4617         The current effective value of the search path can be examined
4618         via the <acronym>SQL</acronym> function
4619         <function>current_schemas</>
4620         (see <xref linkend="functions-info">).
4621         This is not quite the same as
4622         examining the value of <varname>search_path</varname>, since
4623         <function>current_schemas</> shows how the items
4624         appearing in <varname>search_path</varname> were resolved.
4625        </para>
4626
4627        <para>
4628         For more information on schema handling, see <xref linkend="ddl-schemas">.
4629        </para>
4630       </listitem>
4631      </varlistentry>
4632
4633      <varlistentry id="guc-default-tablespace" xreflabel="default_tablespace">
4634       <term><varname>default_tablespace</varname> (<type>string</type>)</term>
4635       <indexterm>
4636        <primary><varname>default_tablespace</> configuration parameter</primary>
4637       </indexterm>
4638       <indexterm><primary>tablespace</><secondary>default</></>
4639       <listitem>
4640        <para>
4641         This variable specifies the default tablespace in which to create
4642         objects (tables and indexes) when a <command>CREATE</> command does
4643         not explicitly specify a tablespace.
4644        </para>
4645
4646        <para>
4647         The value is either the name of a tablespace, or an empty string
4648         to specify using the default tablespace of the current database.
4649         If the value does not match the name of any existing tablespace,
4650         <productname>PostgreSQL</> will automatically use the default
4651         tablespace of the current database.  If a nondefault tablespace
4652         is specified, the user must have <literal>CREATE</> privilege
4653         for it, or creation attempts will fail.
4654        </para>
4655
4656        <para>
4657         This variable is not used for temporary tables; for them,
4658         <xref linkend="guc-temp-tablespaces"> is consulted instead.
4659        </para>
4660
4661        <para>
4662         This variable is also not used when creating databases.
4663         By default, a new database inherits its tablespace setting from
4664         the template database it is copied from.
4665        </para>
4666
4667        <para>
4668         For more information on tablespaces,
4669         see <xref linkend="manage-ag-tablespaces">.
4670        </para>
4671       </listitem>
4672      </varlistentry>
4673
4674      <varlistentry id="guc-temp-tablespaces" xreflabel="temp_tablespaces">
4675       <term><varname>temp_tablespaces</varname> (<type>string</type>)</term>
4676       <indexterm>
4677        <primary><varname>temp_tablespaces</> configuration parameter</primary>
4678       </indexterm>
4679       <indexterm><primary>tablespace</><secondary>temporary</></>
4680       <listitem>
4681        <para>
4682         This variable specifies tablespaces in which to create temporary
4683         objects (temp tables and indexes on temp tables) when a
4684         <command>CREATE</> command does not explicitly specify a tablespace.
4685         Temporary files for purposes such as sorting large data sets
4686         are also created in these tablespaces.
4687        </para>
4688
4689        <para>
4690         The value is a list of names of tablespaces.  When there is more than
4691         one name in the list, <productname>PostgreSQL</> chooses a random
4692         member of the list each time a temporary object is to be created;
4693         except that within a transaction, successively created temporary
4694         objects are placed in successive tablespaces from the list.
4695         If the selected element of the list is an empty string,
4696         <productname>PostgreSQL</> will automatically use the default
4697         tablespace of the current database instead.
4698        </para>
4699
4700        <para>
4701         When <varname>temp_tablespaces</> is set interactively, specifying a
4702         nonexistent tablespace is an error, as is specifying a tablespace for
4703         which the user does not have <literal>CREATE</> privilege.  However,
4704         when using a previously set value, nonexistent tablespaces are
4705         ignored, as are tablespaces for which the user lacks
4706         <literal>CREATE</> privilege.  In particular, this rule applies when
4707         using a value set in <filename>postgresql.conf</>.
4708        </para>
4709
4710        <para>
4711         The default value is an empty string, which results in all temporary
4712         objects being created in the default tablespace of the current
4713         database.
4714        </para>
4715
4716        <para>
4717         See also <xref linkend="guc-default-tablespace">.
4718        </para>
4719       </listitem>
4720      </varlistentry>
4721
4722      <varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
4723       <term><varname>check_function_bodies</varname> (<type>boolean</type>)</term>
4724       <indexterm>
4725        <primary><varname>check_function_bodies</> configuration parameter</primary>
4726       </indexterm>
4727       <listitem>
4728        <para>
4729         This parameter is normally on. When set to <literal>off</>, it
4730         disables validation of the function body string during <xref
4731         linkend="sql-createfunction">. Disabling validation is
4732         occasionally useful to avoid problems such as forward references
4733         when restoring function definitions from a dump.
4734        </para>
4735       </listitem>
4736      </varlistentry>
4737
4738      <varlistentry id="guc-default-transaction-isolation" xreflabel="default_transaction_isolation">
4739       <indexterm>
4740        <primary>transaction isolation level</primary>
4741        <secondary>setting default</secondary>
4742       </indexterm>
4743       <indexterm>
4744        <primary><varname>default_transaction_isolation</> configuration parameter</primary>
4745       </indexterm>
4746       <term><varname>default_transaction_isolation</varname> (<type>enum</type>)</term>
4747       <listitem>
4748        <para>
4749         Each SQL transaction has an isolation level, which can be
4750         either <quote>read uncommitted</quote>, <quote>read
4751         committed</quote>, <quote>repeatable read</quote>, or
4752         <quote>serializable</quote>.  This parameter controls the
4753         default isolation level of each new transaction. The default
4754         is <quote>read committed</quote>.
4755        </para>
4756
4757        <para>
4758         Consult <xref linkend="mvcc"> and <xref
4759         linkend="sql-set-transaction"> for more information.
4760        </para>
4761       </listitem>
4762      </varlistentry>
4763
4764      <varlistentry id="guc-default-transaction-read-only" xreflabel="default_transaction_read_only">
4765       <indexterm>
4766        <primary>read-only transaction</primary>
4767        <secondary>setting default</secondary>
4768       </indexterm>
4769       <indexterm>
4770        <primary><varname>default_transaction_read_only</> configuration parameter</primary>
4771       </indexterm>
4772
4773       <term><varname>default_transaction_read_only</varname> (<type>boolean</type>)</term>
4774       <listitem>
4775        <para>
4776         A read-only SQL transaction cannot alter non-temporary tables.
4777         This parameter controls the default read-only status of each new
4778         transaction. The default is <literal>off</> (read/write).
4779        </para>
4780
4781        <para>
4782         Consult <xref linkend="sql-set-transaction"> for more information.
4783        </para>
4784       </listitem>
4785      </varlistentry>
4786
4787      <varlistentry id="guc-default-transaction-deferrable" xreflabel="default_transaction_deferrable">
4788       <indexterm>
4789        <primary>deferrable transaction</primary>
4790        <secondary>setting default</secondary>
4791       </indexterm>
4792       <indexterm>
4793        <primary><varname>default_transaction_deferrable</> configuration parameter</primary>
4794       </indexterm>
4795
4796       <term><varname>default_transaction_deferrable</varname> (<type>boolean</type>)</term>
4797       <listitem>
4798        <para>
4799         When running at the <literal>serializable</> isolation level,
4800         a deferrable read-only SQL transaction may be delayed before
4801         it is allowed to proceed.  However, once it begins executing
4802         it does not incur any of the overhead required to ensure
4803         serializability; so serialization code will have no reason to
4804         force it to abort because of concurrent updates, making this
4805         option suitable for long-running read-only transactions.
4806         </para>
4807
4808         <para>
4809         This parameter controls the default deferrable status of each
4810         new transaction.  It currently has no effect on read-write
4811         transactions or those operating at isolation levels lower
4812         than <literal>serializable</>. The default is <literal>off</>.
4813        </para>
4814
4815        <para>
4816         Consult <xref linkend="sql-set-transaction"> for more information.
4817        </para>
4818       </listitem>
4819      </varlistentry>
4820
4821
4822      <varlistentry id="guc-session-replication-role" xreflabel="session_replication_role">
4823       <term><varname>session_replication_role</varname> (<type>enum</type>)</term>
4824       <indexterm>
4825        <primary><varname>session_replication_role</> configuration parameter</primary>
4826       </indexterm>
4827       <listitem>
4828        <para>
4829         Controls firing of replication-related triggers and rules for the
4830         current session.  Setting this variable requires
4831         superuser privilege and results in discarding any previously cached
4832         query plans.  Possible values are <literal>origin</> (the default),
4833         <literal>replica</> and <literal>local</>.
4834         See <xref linkend="sql-altertable"> for
4835         more information.
4836        </para>
4837       </listitem>
4838      </varlistentry>
4839
4840      <varlistentry id="guc-statement-timeout" xreflabel="statement_timeout">
4841       <term><varname>statement_timeout</varname> (<type>integer</type>)</term>
4842       <indexterm>
4843        <primary><varname>statement_timeout</> configuration parameter</primary>
4844       </indexterm>
4845       <listitem>
4846        <para>
4847         Abort any statement that takes over the specified number of
4848         milliseconds, starting from the time the command arrives at the server
4849         from the client.  If <varname>log_min_error_statement</> is set to
4850         <literal>ERROR</> or lower, the statement that timed out will also be
4851         logged.  A value of zero (the default) turns this off.
4852        </para>
4853
4854        <para>
4855         Setting <varname>statement_timeout</> in
4856         <filename>postgresql.conf</> is not recommended because it
4857         affects all sessions.
4858        </para>
4859       </listitem>
4860      </varlistentry>
4861
4862      <varlistentry id="guc-vacuum-freeze-table-age" xreflabel="vacuum_freeze_table_age">
4863       <term><varname>vacuum_freeze_table_age</varname> (<type>integer</type>)</term>
4864       <indexterm>
4865        <primary><varname>vacuum_freeze_table_age</> configuration parameter</primary>
4866       </indexterm>
4867       <listitem>
4868        <para>
4869         <command>VACUUM</> performs a whole-table scan if the table's
4870         <structname>pg_class</>.<structfield>relfrozenxid</> field has reached
4871         the age specified by this setting.  The default is 150 million
4872         transactions.  Although users can set this value anywhere from zero to
4873         one billion, <command>VACUUM</> will silently limit the effective value
4874         to 95% of <xref linkend="guc-autovacuum-freeze-max-age">, so that a
4875         periodical manual <command>VACUUM</> has a chance to run before an
4876         anti-wraparound autovacuum is launched for the table. For more
4877         information see
4878         <xref linkend="vacuum-for-wraparound">.
4879        </para>
4880       </listitem>
4881      </varlistentry>
4882
4883      <varlistentry id="guc-vacuum-freeze-min-age" xreflabel="vacuum_freeze_min_age">
4884       <term><varname>vacuum_freeze_min_age</varname> (<type>integer</type>)</term>
4885       <indexterm>
4886        <primary><varname>vacuum_freeze_min_age</> configuration parameter</primary>
4887       </indexterm>
4888       <listitem>
4889        <para>
4890         Specifies the cutoff age (in transactions) that <command>VACUUM</>
4891         should use to decide whether to replace transaction IDs with
4892         <literal>FrozenXID</> while scanning a table.
4893         The default is 50 million transactions.  Although
4894         users can set this value anywhere from zero to one billion,
4895         <command>VACUUM</> will silently limit the effective value to half
4896         the value of <xref linkend="guc-autovacuum-freeze-max-age">, so
4897         that there is not an unreasonably short time between forced
4898         autovacuums.  For more information see <xref
4899         linkend="vacuum-for-wraparound">.
4900        </para>
4901       </listitem>
4902      </varlistentry>
4903
4904      <varlistentry id="guc-bytea-output" xreflabel="bytea_output">
4905       <term><varname>bytea_output</varname> (<type>enum</type>)</term>
4906       <indexterm>
4907        <primary><varname>bytea_output</> configuration parameter</primary>
4908       </indexterm>
4909       <listitem>
4910        <para>
4911         Sets the output format for values of type <type>bytea</type>.
4912         Valid values are <literal>hex</literal> (the default)
4913         and <literal>escape</literal> (the traditional PostgreSQL
4914         format).  See <xref linkend="datatype-binary"> for more
4915         information.  The <type>bytea</type> type always
4916         accepts both formats on input, regardless of this setting.
4917        </para>
4918       </listitem>
4919      </varlistentry>
4920
4921      <varlistentry id="guc-xmlbinary" xreflabel="xmlbinary">
4922       <term><varname>xmlbinary</varname> (<type>enum</type>)</term>
4923       <indexterm>
4924        <primary><varname>xmlbinary</> configuration parameter</primary>
4925       </indexterm>
4926       <listitem>
4927        <para>
4928         Sets how binary values are to be encoded in XML.  This applies
4929         for example when <type>bytea</type> values are converted to
4930         XML by the functions <function>xmlelement</function> or
4931         <function>xmlforest</function>.  Possible values are
4932         <literal>base64</literal> and <literal>hex</literal>, which
4933         are both defined in the XML Schema standard.  The default is
4934         <literal>base64</literal>.  For further information about
4935         XML-related functions, see <xref linkend="functions-xml">.
4936        </para>
4937
4938        <para>
4939         The actual choice here is mostly a matter of taste,
4940         constrained only by possible restrictions in client
4941         applications.  Both methods support all possible values,
4942         although the hex encoding will be somewhat larger than the
4943         base64 encoding.
4944        </para>
4945       </listitem>
4946      </varlistentry>
4947
4948      <varlistentry id="guc-xmloption" xreflabel="xmloption">
4949       <term><varname>xmloption</varname> (<type>enum</type>)</term>
4950       <indexterm>
4951        <primary><varname>xmloption</> configuration parameter</primary>
4952       </indexterm>
4953       <indexterm>
4954        <primary><varname>SET XML OPTION</></primary>
4955       </indexterm>
4956       <indexterm>
4957        <primary>XML option</primary>
4958       </indexterm>
4959       <listitem>
4960        <para>
4961         Sets whether <literal>DOCUMENT</literal> or
4962         <literal>CONTENT</literal> is implicit when converting between
4963         XML and character string values.  See <xref
4964         linkend="datatype-xml"> for a description of this.  Valid
4965         values are <literal>DOCUMENT</literal> and
4966         <literal>CONTENT</literal>.  The default is
4967         <literal>CONTENT</literal>.
4968        </para>
4969
4970        <para>
4971         According to the SQL standard, the command to set this option is
4972 <synopsis>
4973 SET XML OPTION { DOCUMENT | CONTENT };
4974 </synopsis>
4975         This syntax is also available in PostgreSQL.
4976        </para>
4977       </listitem>
4978      </varlistentry>
4979
4980      </variablelist>
4981     </sect2>
4982      <sect2 id="runtime-config-client-format">
4983      <title>Locale and Formatting</title>
4984
4985      <variablelist>
4986
4987      <varlistentry id="guc-datestyle" xreflabel="DateStyle">
4988       <term><varname>DateStyle</varname> (<type>string</type>)</term>
4989       <indexterm>
4990        <primary><varname>DateStyle</> configuration parameter</primary>
4991       </indexterm>
4992       <listitem>
4993        <para>
4994         Sets the display format for date and time values, as well as the
4995         rules for interpreting ambiguous date input values. For
4996         historical reasons, this variable contains two independent
4997         components: the output format specification (<literal>ISO</>,
4998         <literal>Postgres</>, <literal>SQL</>, or <literal>German</>)
4999         and the input/output specification for year/month/day ordering
5000         (<literal>DMY</>, <literal>MDY</>, or <literal>YMD</>). These
5001         can be set separately or together. The keywords <literal>Euro</>
5002         and <literal>European</> are synonyms for <literal>DMY</>; the
5003         keywords <literal>US</>, <literal>NonEuro</>, and
5004         <literal>NonEuropean</> are synonyms for <literal>MDY</>. See
5005         <xref linkend="datatype-datetime"> for more information. The
5006         built-in default is <literal>ISO, MDY</>, but
5007         <application>initdb</application> will initialize the
5008         configuration file with a setting that corresponds to the
5009         behavior of the chosen <varname>lc_time</varname> locale.
5010        </para>
5011       </listitem>
5012      </varlistentry>
5013
5014      <varlistentry id="guc-intervalstyle" xreflabel="IntervalStyle">
5015       <term><varname>IntervalStyle</varname> (<type>enum</type>)</term>
5016       <indexterm>
5017        <primary><varname>IntervalStyle</> configuration parameter</primary>
5018       </indexterm>
5019       <listitem>
5020        <para>
5021         Sets the display format for interval values.
5022         The value <literal>sql_standard</> will produce
5023         output matching <acronym>SQL</acronym> standard interval literals.
5024         The value <literal>postgres</> (which is the default) will produce
5025         output matching <productname>PostgreSQL</> releases prior to 8.4
5026         when the <xref linkend="guc-datestyle">
5027         parameter was set to <literal>ISO</>.
5028         The value <literal>postgres_verbose</> will produce output
5029         matching <productname>PostgreSQL</> releases prior to 8.4
5030         when the <varname>DateStyle</>
5031         parameter was set to non-<literal>ISO</> output.
5032         The value <literal>iso_8601</> will produce output matching the time
5033         interval <quote>format with designators</> defined in section
5034         4.4.3.2 of ISO 8601.
5035        </para>
5036        <para>
5037         The <varname>IntervalStyle</> parameter also affects the
5038         interpretation of ambiguous interval input.  See
5039         <xref linkend="datatype-interval-input"> for more information.
5040        </para>
5041       </listitem>
5042      </varlistentry>
5043
5044      <varlistentry id="guc-timezone" xreflabel="timezone">
5045       <term><varname>timezone</varname> (<type>string</type>)</term>
5046       <indexterm>
5047        <primary><varname>timezone</> configuration parameter</primary>
5048       </indexterm>
5049       <indexterm><primary>time zone</></>
5050       <listitem>
5051        <para>
5052         Sets the time zone for displaying and interpreting time stamps.
5053         The built-in default is <literal>GMT</>, but that is typically
5054         overridden in <filename>postgresql.conf</>; <application>initdb</>
5055         will install a setting there corresponding to its system environment.
5056         See <xref linkend="datatype-timezones"> for more information.
5057        </para>
5058       </listitem>
5059      </varlistentry>
5060
5061      <varlistentry id="guc-timezone-abbreviations" xreflabel="timezone_abbreviations">
5062       <term><varname>timezone_abbreviations</varname> (<type>string</type>)</term>
5063       <indexterm>
5064        <primary><varname>timezone_abbreviations</> configuration parameter</primary>
5065       </indexterm>
5066       <indexterm><primary>time zone names</></>
5067       <listitem>
5068        <para>
5069         Sets the collection of time zone abbreviations that will be accepted
5070         by the server for datetime input.  The default is <literal>'Default'</>,
5071         which is a collection that works in most of the world; there are
5072         also <literal>'Australia'</literal> and <literal>'India'</literal>, and other collections can be defined
5073         for a particular installation.  See <xref
5074         linkend="datetime-appendix"> for more information.
5075        </para>
5076       </listitem>
5077      </varlistentry>
5078
5079      <varlistentry id="guc-extra-float-digits" xreflabel="extra_float_digits">
5080       <indexterm>
5081        <primary>significant digits</primary>
5082       </indexterm>
5083       <indexterm>
5084        <primary>floating-point</primary>
5085        <secondary>display</secondary>
5086       </indexterm>
5087       <indexterm>
5088        <primary><varname>extra_float_digits</> configuration parameter</primary>
5089       </indexterm>
5090
5091       <term><varname>extra_float_digits</varname> (<type>integer</type>)</term>
5092       <listitem>
5093        <para>
5094         This parameter adjusts the number of digits displayed for
5095         floating-point values, including <type>float4</>, <type>float8</>,
5096         and geometric data types.  The parameter value is added to the
5097         standard number of digits (<literal>FLT_DIG</> or <literal>DBL_DIG</>
5098         as appropriate).  The value can be set as high as 3, to include
5099         partially-significant digits; this is especially useful for dumping
5100         float data that needs to be restored exactly.  Or it can be set
5101         negative to suppress unwanted digits.
5102        </para>
5103       </listitem>
5104      </varlistentry>
5105
5106      <varlistentry id="guc-client-encoding" xreflabel="client_encoding">
5107       <term><varname>client_encoding</varname> (<type>string</type>)</term>
5108       <indexterm>
5109        <primary><varname>client_encoding</> configuration parameter</primary>
5110       </indexterm>
5111       <indexterm><primary>character set</></>
5112       <listitem>
5113        <para>
5114         Sets the client-side encoding (character set).
5115         The default is to use the database encoding.
5116         The character sets supported by the <productname>PostgreSQL</productname>
5117         server are described in <xref linkend="multibyte-charset-supported">.
5118        </para>
5119       </listitem>
5120      </varlistentry>
5121
5122      <varlistentry id="guc-lc-messages" xreflabel="lc_messages">
5123       <term><varname>lc_messages</varname> (<type>string</type>)</term>
5124       <indexterm>
5125        <primary><varname>lc_messages</> configuration parameter</primary>
5126       </indexterm>
5127       <listitem>
5128        <para>
5129         Sets the language in which messages are displayed.  Acceptable
5130         values are system-dependent; see <xref linkend="locale"> for
5131         more information.  If this variable is set to the empty string
5132         (which is the default) then the value is inherited from the
5133         execution environment of the server in a system-dependent way.
5134        </para>
5135
5136        <para>
5137         On some systems, this locale category does not exist.  Setting
5138         this variable will still work, but there will be no effect.
5139         Also, there is a chance that no translated messages for the
5140         desired language exist.  In that case you will continue to see
5141         the English messages.
5142        </para>
5143
5144        <para>
5145         Only superusers can change this setting, because it affects the
5146         messages sent to the server log as well as to the client, and
5147         an improper value might obscure the readability of the server
5148         logs.
5149        </para>
5150       </listitem>
5151      </varlistentry>
5152
5153      <varlistentry id="guc-lc-monetary" xreflabel="lc_monetary">
5154       <term><varname>lc_monetary</varname> (<type>string</type>)</term>
5155       <indexterm>
5156        <primary><varname>lc_monetary</> configuration parameter</primary>
5157       </indexterm>
5158       <listitem>
5159        <para>
5160         Sets the locale to use for formatting monetary amounts, for
5161         example with the <function>to_char</function> family of
5162         functions.  Acceptable values are system-dependent; see <xref
5163         linkend="locale"> for more information.  If this variable is
5164         set to the empty string (which is the default) then the value
5165         is inherited from the execution environment of the server in a
5166         system-dependent way.
5167        </para>
5168       </listitem>
5169      </varlistentry>
5170
5171      <varlistentry id="guc-lc-numeric" xreflabel="lc_numeric">
5172       <term><varname>lc_numeric</varname> (<type>string</type>)</term>
5173       <indexterm>
5174        <primary><varname>lc_numeric</> configuration parameter</primary>
5175       </indexterm>
5176       <listitem>
5177        <para>
5178         Sets the locale to use for formatting numbers, for example
5179         with the <function>to_char</function> family of
5180         functions. Acceptable values are system-dependent; see <xref
5181         linkend="locale"> for more information.  If this variable is
5182         set to the empty string (which is the default) then the value
5183         is inherited from the execution environment of the server in a
5184         system-dependent way.
5185        </para>
5186       </listitem>
5187      </varlistentry>
5188
5189      <varlistentry id="guc-lc-time" xreflabel="lc_time">
5190       <term><varname>lc_time</varname> (<type>string</type>)</term>
5191       <indexterm>
5192        <primary><varname>lc_time</> configuration parameter</primary>
5193       </indexterm>
5194       <listitem>
5195        <para>
5196         Sets the locale to use for formatting dates and times, for example
5197         with the <function>to_char</function> family of
5198         functions. Acceptable values are system-dependent; see <xref
5199         linkend="locale"> for more information.  If this variable is
5200         set to the empty string (which is the default) then the value
5201         is inherited from the execution environment of the server in a
5202         system-dependent way.
5203        </para>
5204       </listitem>
5205      </varlistentry>
5206
5207      <varlistentry id="guc-default-text-search-config" xreflabel="default_text_search_config">
5208       <term><varname>default_text_search_config</varname> (<type>string</type>)</term>
5209       <indexterm>
5210        <primary><varname>default_text_search_config</> configuration parameter</primary>
5211       </indexterm>
5212       <listitem>
5213        <para>
5214         Selects the text search configuration that is used by those variants
5215         of the text search functions that do not have an explicit argument
5216         specifying the configuration.
5217         See <xref linkend="textsearch"> for further information.
5218         The built-in default is <literal>pg_catalog.simple</>, but
5219         <application>initdb</application> will initialize the
5220         configuration file with a setting that corresponds to the
5221         chosen <varname>lc_ctype</varname> locale, if a configuration
5222         matching that locale can be identified.
5223        </para>
5224       </listitem>
5225      </varlistentry>
5226
5227      </variablelist>
5228
5229     </sect2>
5230      <sect2 id="runtime-config-client-other">
5231      <title>Other Defaults</title>
5232
5233      <variablelist>
5234
5235      <varlistentry id="guc-dynamic-library-path" xreflabel="dynamic_library_path">
5236       <term><varname>dynamic_library_path</varname> (<type>string</type>)</term>
5237       <indexterm>
5238        <primary><varname>dynamic_library_path</> configuration parameter</primary>
5239       </indexterm>
5240       <indexterm><primary>dynamic loading</></>
5241       <listitem>
5242        <para>
5243         If a dynamically loadable module needs to be opened and the
5244         file name specified in the <command>CREATE FUNCTION</command> or
5245         <command>LOAD</command> command
5246         does not have a directory component (i.e., the
5247         name does not contain a slash), the system will search this
5248         path for the required file.
5249        </para>
5250
5251        <para>
5252         The value for <varname>dynamic_library_path</varname> must be a
5253         list of absolute directory paths separated by colons (or semi-colons
5254         on Windows).  If a list element starts
5255         with the special string <literal>$libdir</literal>, the
5256         compiled-in <productname>PostgreSQL</productname> package
5257         library directory is substituted for <literal>$libdir</literal>; this
5258         is where the modules provided by the standard
5259         <productname>PostgreSQL</productname> distribution are installed.
5260         (Use <literal>pg_config --pkglibdir</literal> to find out the name of
5261         this directory.) For example:
5262 <programlisting>
5263 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
5264 </programlisting>
5265         or, in a Windows environment:
5266 <programlisting>
5267 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
5268 </programlisting>
5269        </para>
5270
5271        <para>
5272         The default value for this parameter is
5273         <literal>'$libdir'</literal>. If the value is set to an empty
5274         string, the automatic path search is turned off.
5275        </para>
5276
5277        <para>
5278         This parameter can be changed at run time by superusers, but a
5279         setting done that way will only persist until the end of the
5280         client connection, so this method should be reserved for
5281         development purposes. The recommended way to set this parameter
5282         is in the <filename>postgresql.conf</filename> configuration
5283         file.
5284        </para>
5285       </listitem>
5286      </varlistentry>
5287
5288      <varlistentry id="guc-gin-fuzzy-search-limit" xreflabel="gin_fuzzy_search_limit">
5289       <term><varname>gin_fuzzy_search_limit</varname> (<type>integer</type>)</term>
5290       <indexterm>
5291        <primary><varname>gin_fuzzy_search_limit</> configuration parameter</primary>
5292       </indexterm>
5293       <listitem>
5294        <para>
5295         Soft upper limit of the size of the set returned by GIN index scans. For more
5296         information see <xref linkend="gin-tips">.
5297        </para>
5298       </listitem>
5299      </varlistentry>
5300
5301      <varlistentry id="guc-local-preload-libraries" xreflabel="local_preload_libraries">
5302       <term><varname>local_preload_libraries</varname> (<type>string</type>)</term>
5303       <indexterm>
5304        <primary><varname>local_preload_libraries</> configuration parameter</primary>
5305       </indexterm>
5306       <indexterm>
5307        <primary><filename>$libdir/plugins</></primary>
5308       </indexterm>
5309       <listitem>
5310        <para>
5311         This variable specifies one or more shared libraries that are
5312         to be preloaded at connection start.  If more than one library
5313         is to be loaded, separate their names with commas.  All library
5314         names are converted to lower case unless double-quoted.
5315         This parameter cannot be changed after the start of a particular
5316         session.
5317        </para>
5318
5319        <para>
5320         Because this is not a superuser-only option, the libraries
5321         that can be loaded are restricted to those appearing in the
5322         <filename>plugins</> subdirectory of the installation's
5323         standard library directory.  (It is the database administrator's
5324         responsibility to ensure that only <quote>safe</> libraries
5325         are installed there.)  Entries in <varname>local_preload_libraries</>
5326         can specify this directory explicitly, for example
5327         <literal>$libdir/plugins/mylib</literal>, or just specify
5328         the library name &mdash; <literal>mylib</literal> would have
5329         the same effect as <literal>$libdir/plugins/mylib</literal>.
5330        </para>
5331
5332        <para>
5333         Unlike <xref linkend="guc-shared-preload-libraries">, there is no
5334         performance advantage to loading a library at session
5335         start rather than when it is first used.  Rather, the intent of
5336         this feature is to allow debugging or performance-measurement
5337         libraries to be loaded into specific sessions without an explicit
5338         <command>LOAD</> command being given.  For example, debugging could
5339         be enabled for all sessions under a given user name by setting
5340         this parameter with <command>ALTER ROLE SET</>.
5341        </para>
5342
5343        <para>
5344         If a specified library is not found,
5345         the connection attempt will fail.
5346        </para>
5347
5348        <para>
5349         Every  PostgreSQL-supported library has a <quote>magic
5350         block</> that is checked to guarantee compatibility.
5351         For this reason, non-PostgreSQL libraries cannot be
5352         loaded in this way.
5353        </para>
5354       </listitem>
5355      </varlistentry>
5356
5357      </variablelist>
5358     </sect2>
5359    </sect1>
5360
5361    <sect1 id="runtime-config-locks">
5362     <title>Lock Management</title>
5363
5364      <variablelist>
5365
5366      <varlistentry id="guc-deadlock-timeout" xreflabel="deadlock_timeout">
5367       <indexterm>
5368        <primary>deadlock</primary>
5369        <secondary>timeout during</secondary>
5370       </indexterm>
5371       <indexterm>
5372        <primary>timeout</primary>
5373        <secondary>deadlock</secondary>
5374       </indexterm>
5375       <indexterm>
5376        <primary><varname>deadlock_timeout</> configuration parameter</primary>
5377       </indexterm>
5378
5379       <term><varname>deadlock_timeout</varname> (<type>integer</type>)</term>
5380       <listitem>
5381        <para>
5382         This is the amount of time, in milliseconds, to wait on a lock
5383         before checking to see if there is a deadlock condition. The
5384         check for deadlock is relatively expensive, so the server doesn't run
5385         it every time it waits for a lock. We optimistically assume
5386         that deadlocks are not common in production applications and
5387         just wait on the lock for a while before checking for a
5388         deadlock. Increasing this value reduces the amount of time
5389         wasted in needless deadlock checks, but slows down reporting of
5390         real deadlock errors. The default is one second (<literal>1s</>),
5391         which is probably about the smallest value you would want in
5392         practice. On a heavily loaded server you might want to raise it.
5393         Ideally the setting should exceed your typical transaction time,
5394         so as to improve the odds that a lock will be released before
5395         the waiter decides to check for deadlock.  Only superusers can change
5396         this setting.
5397        </para>
5398
5399        <para>
5400         When <xref linkend="guc-log-lock-waits"> is set,
5401         this parameter also determines the length of time to wait before
5402         a log message is issued about the lock wait.  If you are trying
5403         to investigate locking delays you might want to set a shorter than
5404         normal <varname>deadlock_timeout</varname>.
5405        </para>
5406       </listitem>
5407      </varlistentry>
5408
5409      <varlistentry id="guc-max-locks-per-transaction" xreflabel="max_locks_per_transaction">
5410       <term><varname>max_locks_per_transaction</varname> (<type>integer</type>)</term>
5411       <indexterm>
5412        <primary><varname>max_locks_per_transaction</> configuration parameter</primary>
5413       </indexterm>
5414       <listitem>
5415        <para>
5416         The shared lock table tracks locks on
5417         <varname>max_locks_per_transaction</varname> * (<xref
5418         linkend="guc-max-connections"> + <xref
5419         linkend="guc-max-prepared-transactions">) objects (e.g.,  tables);
5420         hence, no more than this many distinct objects can be locked at
5421         any one time.  This parameter controls the average number of object
5422         locks allocated for each transaction;  individual transactions
5423         can lock more objects as long as the locks of all transactions
5424         fit in the lock table.  This is <emphasis>not</> the number of
5425         rows that can be locked; that value is unlimited.  The default,
5426         64, has historically proven sufficient, but you might need to
5427         raise this value if you have clients that touch many different
5428         tables in a single transaction. This parameter can only be set at
5429         server start.
5430        </para>
5431
5432        <para>
5433         Increasing this parameter might cause <productname>PostgreSQL</>
5434         to request more <systemitem class="osname">System V</> shared
5435         memory than your operating system's default configuration
5436         allows. See <xref linkend="sysvipc"> for information on how to
5437         adjust those parameters, if necessary.
5438        </para>
5439
5440        <para>
5441         When running a standby server, you must set this parameter to the
5442         same or higher value than on the master server. Otherwise, queries
5443         will not be allowed in the standby server.
5444        </para>
5445       </listitem>
5446      </varlistentry>
5447
5448      <varlistentry id="guc-max-pred-locks-per-transaction" xreflabel="max_pred_locks_per_transaction">
5449       <term><varname>max_pred_locks_per_transaction</varname> (<type>integer</type>)</term>
5450       <indexterm>
5451        <primary><varname>max_pred_locks_per_transaction</> configuration parameter</primary>
5452       </indexterm>
5453       <listitem>
5454        <para>
5455         The shared predicate lock table tracks locks on
5456         <varname>max_pred_locks_per_transaction</varname> * (<xref
5457         linkend="guc-max-connections"> + <xref
5458         linkend="guc-max-prepared-transactions">) objects (e.g., tables);
5459         hence, no more than this many distinct objects can be locked at
5460         any one time.  This parameter controls the average number of object
5461         locks allocated for each transaction;  individual transactions
5462         can lock more objects as long as the locks of all transactions
5463         fit in the lock table.  This is <emphasis>not</> the number of
5464         rows that can be locked; that value is unlimited.  The default,
5465         64, has generally been sufficient in testing, but you might need to
5466         raise this value if you have clients that touch many different
5467         tables in a single serializable transaction. This parameter can
5468         only be set at server start.
5469        </para>
5470
5471        <para>
5472         Increasing this parameter might cause <productname>PostgreSQL</>
5473         to request more <systemitem class="osname">System V</> shared
5474         memory than your operating system's default configuration
5475         allows. See <xref linkend="sysvipc"> for information on how to
5476         adjust those parameters, if necessary.
5477        </para>
5478       </listitem>
5479      </varlistentry>
5480
5481      </variablelist>
5482    </sect1>
5483
5484    <sect1 id="runtime-config-compatible">
5485     <title>Version and Platform Compatibility</title>
5486
5487     <sect2 id="runtime-config-compatible-version">
5488      <title>Previous PostgreSQL Versions</title>
5489
5490      <variablelist>
5491
5492      <varlistentry id="guc-array-nulls" xreflabel="array_nulls">
5493       <term><varname>array_nulls</varname> (<type>boolean</type>)</term>
5494       <indexterm>
5495        <primary><varname>array_nulls</> configuration parameter</primary>
5496       </indexterm>
5497       <listitem>
5498        <para>
5499         This controls whether the array input parser recognizes
5500         unquoted <literal>NULL</> as specifying a null array element.
5501         By default, this is <literal>on</>, allowing array values containing
5502         null values to be entered.  However, <productname>PostgreSQL</> versions
5503         before 8.2 did not support null values in arrays, and therefore would
5504         treat <literal>NULL</> as specifying a normal array element with
5505         the string value <quote>NULL</>.  For backward compatibility with
5506         applications that require the old behavior, this variable can be
5507         turned <literal>off</>.
5508        </para>
5509
5510        <para>
5511         Note that it is possible to create array values containing null values
5512         even when this variable is <literal>off</>.
5513        </para>
5514       </listitem>
5515      </varlistentry>
5516
5517      <varlistentry id="guc-backslash-quote" xreflabel="backslash_quote">
5518       <term><varname>backslash_quote</varname> (<type>enum</type>)</term>
5519       <indexterm><primary>strings</><secondary>backslash quotes</></>
5520       <indexterm>
5521        <primary><varname>backslash_quote</> configuration parameter</primary>
5522       </indexterm>
5523       <listitem>
5524        <para>
5525         This controls whether a quote mark can be represented by
5526         <literal>\'</> in a string literal.  The preferred, SQL-standard way
5527         to represent a quote mark is by doubling it (<literal>''</>) but
5528         <productname>PostgreSQL</> has historically also accepted
5529         <literal>\'</>. However, use of <literal>\'</> creates security risks
5530         because in some client character set encodings, there are multibyte
5531         characters in which the last byte is numerically equivalent to ASCII
5532         <literal>\</>.  If client-side code does escaping incorrectly then a
5533         SQL-injection attack is possible.  This risk can be prevented by
5534         making the server reject queries in which a quote mark appears to be
5535         escaped by a backslash.
5536         The allowed values of <varname>backslash_quote</> are
5537         <literal>on</> (allow <literal>\'</> always),
5538         <literal>off</> (reject always), and
5539         <literal>safe_encoding</> (allow only if client encoding does not
5540         allow ASCII <literal>\</> within a multibyte character).
5541         <literal>safe_encoding</> is the default setting.
5542        </para>
5543
5544        <para>
5545         Note that in a standard-conforming string literal, <literal>\</> just
5546         means <literal>\</> anyway.  This parameter only affects the handling of
5547         non-standard-conforming literals, including
5548         escape string syntax (<literal>E'...'</>).
5549        </para>
5550       </listitem>
5551      </varlistentry>
5552
5553      <varlistentry id="guc-default-with-oids" xreflabel="default_with_oids">
5554       <term><varname>default_with_oids</varname> (<type>boolean</type>)</term>
5555       <indexterm>
5556        <primary><varname>default_with_oids</> configuration parameter</primary>
5557       </indexterm>
5558       <listitem>
5559        <para>
5560         This controls whether <command>CREATE TABLE</command> and
5561         <command>CREATE TABLE AS</command> include an OID column in
5562         newly-created tables, if neither <literal>WITH OIDS</literal>
5563         nor <literal>WITHOUT OIDS</literal> is specified. It also
5564         determines whether OIDs will be included in tables created by
5565         <command>SELECT INTO</command>. The parameter is <literal>off</>
5566         by default; in <productname>PostgreSQL</> 8.0 and earlier, it
5567         was on by default.
5568        </para>
5569
5570        <para>
5571         The use of OIDs in user tables is considered deprecated, so
5572         most installations should leave this variable disabled.
5573         Applications that require OIDs for a particular table should
5574         specify <literal>WITH OIDS</literal> when creating the
5575         table. This variable can be enabled for compatibility with old
5576         applications that do not follow this behavior.
5577        </para>
5578       </listitem>
5579      </varlistentry>
5580
5581      <varlistentry id="guc-escape-string-warning" xreflabel="escape_string_warning">
5582       <term><varname>escape_string_warning</varname> (<type>boolean</type>)</term>
5583       <indexterm><primary>strings</><secondary>escape warning</></>
5584       <indexterm>
5585        <primary><varname>escape_string_warning</> configuration parameter</primary>
5586       </indexterm>
5587       <listitem>
5588        <para>
5589         When on, a warning is issued if a backslash (<literal>\</>)
5590         appears in an ordinary string literal (<literal>'...'</>
5591         syntax) and <varname>standard_conforming_strings</varname> is off.
5592         The default is <literal>on</>.
5593        </para>
5594        <para>
5595         Applications that wish to use backslash as escape should be
5596         modified to use escape string syntax (<literal>E'...'</>),
5597         because the default behavior of ordinary strings is now to treat
5598         backslash as an ordinary character, per SQL standard.  This variable
5599         can be enabled to help locate code that needs to be changed.
5600        </para>
5601       </listitem>
5602      </varlistentry>
5603
5604      <varlistentry id="guc-lo-compat-privileges" xreflabel="lo_compat_privileges">
5605       <term><varname>lo_compat_privileges</varname> (<type>boolean</type>)</term>
5606       <indexterm>
5607        <primary><varname>lo_compat_privileges</> configuration parameter</primary>
5608       </indexterm>
5609       <listitem>
5610        <para>
5611         In <productname>PostgreSQL</> releases prior to 9.0, large objects
5612         did not have access privileges and were, in effect, readable and
5613         writable by all users.  Setting this variable to <literal>on</>
5614         disables the new privilege checks, for compatibility with prior
5615         releases.  The default is <literal>off</>.
5616        </para>
5617        <para>
5618         Setting this variable does not disable all security checks related to
5619         large objects &mdash; only those for which the default behavior has
5620         changed in <productname>PostgreSQL</> 9.0.
5621         For example, <literal>lo_import()</literal> and
5622         <literal>lo_export()</literal> need superuser privileges independent
5623         of this setting.
5624        </para>
5625       </listitem>
5626      </varlistentry>
5627
5628     <varlistentry id="guc-quote-all-identifiers" xreflabel="quote-all-identifiers">
5629       <term><varname>quote_all_identifiers</varname> (<type>boolean</type>)</term>
5630       <indexterm>
5631        <primary><varname>quote_all_identifiers</> configuration parameter</primary>
5632       </indexterm>
5633       <listitem>
5634        <para>
5635         When the database generates SQL, force all identifiers to be quoted,
5636         even if they are not (currently) keywords.  This will affect the
5637         output of <command>EXPLAIN</> as well as the results of functions
5638         like <function>pg_get_viewdef</>.  See also the
5639         <option>--quote-all-identifiers</option> option of
5640         <xref linkend="app-pgdump"> and <xref linkend="app-pg-dumpall">.
5641        </para>
5642       </listitem>
5643      </varlistentry>
5644
5645      <varlistentry id="guc-sql-inheritance" xreflabel="sql_inheritance">
5646       <term><varname>sql_inheritance</varname> (<type>boolean</type>)</term>
5647       <indexterm>
5648        <primary><varname>sql_inheritance</> configuration parameter</primary>
5649       </indexterm>
5650       <indexterm><primary>inheritance</></>
5651       <listitem>
5652        <para>
5653         This controls the inheritance semantics.  If turned <literal>off</>,
5654         subtables are not accessed by various commands by default; basically
5655         an implied <literal>ONLY</literal> key word.  This was added for
5656         compatibility with releases prior to 7.1.  See
5657         <xref linkend="ddl-inherit"> for more information.
5658        </para>
5659       </listitem>
5660      </varlistentry>
5661
5662      <varlistentry id="guc-standard-conforming-strings" xreflabel="standard_conforming_strings">
5663       <term><varname>standard_conforming_strings</varname> (<type>boolean</type>)</term>
5664       <indexterm><primary>strings</><secondary>standard conforming</></>
5665       <indexterm>
5666        <primary><varname>standard_conforming_strings</> configuration parameter</primary>
5667       </indexterm>
5668       <listitem>
5669        <para>
5670         This controls whether ordinary string literals
5671         (<literal>'...'</>) treat backslashes literally, as specified in
5672         the SQL standard.
5673         Beginning in <productname>PostgreSQL</productname> 9.1, the default is
5674         <literal>on</> (prior releases defaulted to <literal>off</>).
5675         Applications can check this
5676         parameter to determine how string literals will be processed.
5677         The presence of this parameter can also be taken as an indication
5678         that the escape string syntax (<literal>E'...'</>) is supported.
5679         Escape string syntax (<xref linkend="sql-syntax-strings-escape">)
5680         should be used if an application desires
5681         backslashes to be treated as escape characters.
5682        </para>
5683       </listitem>
5684      </varlistentry>
5685
5686      <varlistentry id="guc-synchronize-seqscans" xreflabel="synchronize_seqscans">
5687       <term><varname>synchronize_seqscans</varname> (<type>boolean</type>)</term>
5688       <indexterm>
5689        <primary><varname>synchronize_seqscans</> configuration parameter</primary>
5690       </indexterm>
5691       <listitem>
5692        <para>
5693         This allows sequential scans of large tables to synchronize with each
5694         other, so that concurrent scans read the same block at about the
5695         same time and hence share the I/O workload.  When this is enabled,
5696         a scan might start in the middle of the table and then <quote>wrap
5697         around</> the end to cover all rows, so as to synchronize with the
5698         activity of scans already in progress.  This can result in
5699         unpredictable changes in the row ordering returned by queries that
5700         have no <literal>ORDER BY</> clause.  Setting this parameter to
5701         <literal>off</> ensures the pre-8.3 behavior in which a sequential
5702         scan always starts from the beginning of the table.  The default
5703         is <literal>on</>.
5704        </para>
5705       </listitem>
5706      </varlistentry>
5707
5708      </variablelist>
5709     </sect2>
5710
5711     <sect2 id="runtime-config-compatible-clients">
5712      <title>Platform and Client Compatibility</title>
5713      <variablelist>
5714
5715      <varlistentry id="guc-transform-null-equals" xreflabel="transform_null_equals">
5716       <term><varname>transform_null_equals</varname> (<type>boolean</type>)</term>
5717       <indexterm><primary>IS NULL</></>
5718       <indexterm>
5719        <primary><varname>transform_null_equals</> configuration parameter</primary>
5720       </indexterm>
5721       <listitem>
5722        <para>
5723         When on, expressions of the form <literal><replaceable>expr</> =
5724         NULL</literal> (or <literal>NULL =
5725         <replaceable>expr</></literal>) are treated as
5726         <literal><replaceable>expr</> IS NULL</literal>, that is, they
5727         return true if <replaceable>expr</> evaluates to the null value,
5728         and false otherwise. The correct SQL-spec-compliant behavior of
5729         <literal><replaceable>expr</> = NULL</literal> is to always
5730         return null (unknown). Therefore this parameter defaults to
5731         <literal>off</>.
5732        </para>
5733
5734        <para>
5735         However, filtered forms in <productname>Microsoft
5736         Access</productname> generate queries that appear to use
5737         <literal><replaceable>expr</> = NULL</literal> to test for
5738         null values, so if you use that interface to access the database you
5739         might want to turn this option on.  Since expressions of the
5740         form <literal><replaceable>expr</> = NULL</literal> always
5741         return the null value (using the SQL standard interpretation), they are not
5742         very useful and do not appear often in normal applications so
5743         this option does little harm in practice.  But new users are
5744         frequently confused about the semantics of expressions
5745         involving null values, so this option is off by default.
5746        </para>
5747
5748        <para>
5749         Note that this option only affects the exact form <literal>= NULL</>,
5750         not other comparison operators or other expressions
5751         that are computationally equivalent to some expression
5752         involving the equals operator (such as <literal>IN</literal>).
5753         Thus, this option is not a general fix for bad programming.
5754        </para>
5755
5756        <para>
5757         Refer to <xref linkend="functions-comparison"> for related information.
5758        </para>
5759       </listitem>
5760      </varlistentry>
5761
5762      </variablelist>
5763     </sect2>
5764    </sect1>
5765
5766    <sect1 id="runtime-config-error-handling">
5767     <title>Error Handling</title>
5768
5769     <variablelist>
5770
5771      <varlistentry id="guc-exit-on-error" xreflabel="exit_on_error">
5772       <term><varname>exit_on_error</varname> (<type>boolean</type>)</term>
5773       <indexterm>
5774        <primary><varname>exit_on_error</> configuration parameter</primary>
5775       </indexterm>
5776       <listitem>
5777        <para>
5778         If true, any error will terminate the current session.  By default,
5779         this is set to false, so that only FATAL errors will terminate the
5780         session.
5781        </para>
5782       </listitem>
5783      </varlistentry>
5784
5785      <varlistentry id="guc-restart-after-crash" xreflabel="restart_after_crash">
5786       <term><varname>restart_after_crash</varname> (<type>boolean</type>)</term>
5787       <indexterm>
5788        <primary><varname>restart_after_crash</> configuration parameter</primary>
5789       </indexterm>
5790       <listitem>
5791        <para>
5792         When set to true, which is the default, <productname>PostgreSQL</>
5793         will automatically reinitialize after a backend crash.  Leaving this
5794         value set to true is normally the best way to maximize the availability
5795         of the database.  However, in some circumstances, such as when
5796         <productname>PostgreSQL</> is being invoked by clusterware, it may be
5797         useful to disable the restart so that the clusterware can gain
5798         control and take any actions it deems appropriate.
5799        </para>
5800       </listitem>
5801      </varlistentry>
5802
5803     </variablelist>
5804
5805    </sect1>
5806
5807    <sect1 id="runtime-config-preset">
5808     <title>Preset Options</title>
5809
5810     <para>
5811      The following <quote>parameters</> are read-only, and are determined
5812      when <productname>PostgreSQL</productname> is compiled or when it is
5813      installed. As such, they have been excluded from the sample
5814      <filename>postgresql.conf</> file.  These options report
5815      various aspects of <productname>PostgreSQL</productname> behavior
5816      that might be of interest to certain applications, particularly
5817      administrative front-ends.
5818     </para>
5819
5820     <variablelist>
5821
5822      <varlistentry id="guc-block-size" xreflabel="block_size">
5823       <term><varname>block_size</varname> (<type>integer</type>)</term>
5824       <indexterm>
5825        <primary><varname>block_size</> configuration parameter</primary>
5826       </indexterm>
5827       <listitem>
5828        <para>
5829         Reports the size of a disk block.  It is determined by the value
5830         of <literal>BLCKSZ</> when building the server. The default
5831         value is 8192 bytes.  The meaning of some configuration
5832         variables (such as <xref linkend="guc-shared-buffers">) is
5833         influenced by <varname>block_size</varname>. See <xref
5834         linkend="runtime-config-resource"> for information.
5835        </para>
5836       </listitem>
5837      </varlistentry>
5838
5839      <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes">
5840       <term><varname>integer_datetimes</varname> (<type>boolean</type>)</term>
5841       <indexterm>
5842        <primary><varname>integer_datetimes</> configuration parameter</primary>
5843       </indexterm>
5844       <listitem>
5845        <para>
5846         Reports whether <productname>PostgreSQL</> was built with
5847         support for 64-bit-integer dates and times.  This can be
5848         disabled by configuring with <literal>--disable-integer-datetimes</>
5849         when building <productname>PostgreSQL</>.  The default value is
5850         <literal>on</literal>.
5851        </para>
5852       </listitem>
5853      </varlistentry>
5854
5855      <varlistentry id="guc-lc-collate" xreflabel="lc_collate">
5856       <term><varname>lc_collate</varname> (<type>string</type>)</term>
5857       <indexterm>
5858        <primary><varname>lc_collate</> configuration parameter</primary>
5859       </indexterm>
5860       <listitem>
5861        <para>
5862         Reports the locale in which sorting of textual data is done.
5863         See <xref linkend="locale"> for more information.
5864         This value is determined when a database is created.
5865        </para>
5866       </listitem>
5867      </varlistentry>
5868
5869      <varlistentry id="guc-lc-ctype" xreflabel="lc_ctype">
5870       <term><varname>lc_ctype</varname> (<type>string</type>)</term>
5871       <indexterm>
5872        <primary><varname>lc_ctype</> configuration parameter</primary>
5873       </indexterm>
5874       <listitem>
5875        <para>
5876         Reports the locale that determines character classifications.
5877         See <xref linkend="locale"> for more information.
5878         This value is determined when a database is created.
5879         Ordinarily this will be the same as <varname>lc_collate</varname>,
5880         but for special applications it might be set differently.
5881        </para>
5882       </listitem>
5883      </varlistentry>
5884
5885      <varlistentry id="guc-max-function-args" xreflabel="max_function_args">
5886       <term><varname>max_function_args</varname> (<type>integer</type>)</term>
5887       <indexterm>
5888        <primary><varname>max_function_args</> configuration parameter</primary>
5889       </indexterm>
5890       <listitem>
5891        <para>
5892         Reports the maximum number of function arguments. It is determined by
5893         the value of <literal>FUNC_MAX_ARGS</> when building the server. The
5894         default value is 100 arguments.
5895        </para>
5896       </listitem>
5897      </varlistentry>
5898
5899      <varlistentry id="guc-max-identifier-length" xreflabel="max_identifier_length">
5900       <term><varname>max_identifier_length</varname> (<type>integer</type>)</term>
5901       <indexterm>
5902        <primary><varname>max_identifier_length</> configuration parameter</primary>
5903       </indexterm>
5904       <listitem>
5905        <para>
5906         Reports the maximum identifier length. It is determined as one
5907         less than the value of <literal>NAMEDATALEN</> when building
5908         the server. The default value of <literal>NAMEDATALEN</> is
5909         64; therefore the default
5910         <varname>max_identifier_length</varname> is 63 bytes, which
5911         can be less than 63 characters when using multibyte encodings.
5912        </para>
5913       </listitem>
5914      </varlistentry>
5915
5916      <varlistentry id="guc-max-index-keys" xreflabel="max_index_keys">
5917       <term><varname>max_index_keys</varname> (<type>integer</type>)</term>
5918       <indexterm>
5919        <primary><varname>max_index_keys</> configuration parameter</primary>
5920       </indexterm>
5921       <listitem>
5922        <para>
5923         Reports the maximum number of index keys. It is determined by
5924         the value of <literal>INDEX_MAX_KEYS</> when building the server. The
5925         default value is 32 keys.
5926        </para>
5927       </listitem>
5928      </varlistentry>
5929
5930      <varlistentry id="guc-segment-size" xreflabel="segment_size">
5931       <term><varname>segment_size</varname> (<type>integer</type>)</term>
5932       <indexterm>
5933        <primary><varname>segment_size</> configuration parameter</primary>
5934       </indexterm>
5935       <listitem>
5936        <para>
5937         Reports the number of blocks (pages) that can be stored within a file
5938         segment.  It is determined by the value of <literal>RELSEG_SIZE</>
5939         when building the server.  The maximum size of a segment file in bytes
5940         is equal to <varname>segment_size</> multiplied by
5941         <varname>block_size</>; by default this is 1GB.
5942        </para>
5943       </listitem>
5944      </varlistentry>
5945
5946      <varlistentry id="guc-server-encoding" xreflabel="server_encoding">
5947       <term><varname>server_encoding</varname> (<type>string</type>)</term>
5948       <indexterm>
5949        <primary><varname>server_encoding</> configuration parameter</primary>
5950       </indexterm>
5951       <indexterm><primary>character set</></>
5952       <listitem>
5953        <para>
5954         Reports the database encoding (character set).
5955         It is determined when the database is created.  Ordinarily,
5956         clients need only be concerned with the value of <xref
5957         linkend="guc-client-encoding">.
5958        </para>
5959       </listitem>
5960      </varlistentry>
5961
5962      <varlistentry id="guc-server-version" xreflabel="server_version">
5963       <term><varname>server_version</varname> (<type>string</type>)</term>
5964       <indexterm>
5965        <primary><varname>server_version</> configuration parameter</primary>
5966       </indexterm>
5967       <listitem>
5968        <para>
5969         Reports the version number of the server. It is determined by the
5970         value of <literal>PG_VERSION</> when building the server.
5971        </para>
5972       </listitem>
5973      </varlistentry>
5974
5975      <varlistentry id="guc-server-version-num" xreflabel="server_version_num">
5976       <term><varname>server_version_num</varname> (<type>integer</type>)</term>
5977       <indexterm>
5978        <primary><varname>server_version_num</> configuration parameter</primary>
5979       </indexterm>
5980       <listitem>
5981        <para>
5982         Reports the version number of the server as an integer. It is determined
5983         by the value of <literal>PG_VERSION_NUM</> when building the server.
5984        </para>
5985       </listitem>
5986      </varlistentry>
5987
5988      <varlistentry id="guc-wal-block-size" xreflabel="wal_block_size">
5989       <term><varname>wal_block_size</varname> (<type>integer</type>)</term>
5990       <indexterm>
5991        <primary><varname>wal_block_size</> configuration parameter</primary>
5992       </indexterm>
5993       <listitem>
5994        <para>
5995         Reports the size of a WAL disk block.  It is determined by the value
5996         of <literal>XLOG_BLCKSZ</> when building the server. The default value
5997         is 8192 bytes.
5998        </para>
5999       </listitem>
6000      </varlistentry>
6001
6002      <varlistentry id="guc-wal-segment-size" xreflabel="wal_segment_size">
6003       <term><varname>wal_segment_size</varname> (<type>integer</type>)</term>
6004       <indexterm>
6005        <primary><varname>wal_segment_size</> configuration parameter</primary>
6006       </indexterm>
6007       <listitem>
6008        <para>
6009         Reports the number of blocks (pages) in a WAL segment file.
6010         The total size of a WAL segment file in bytes is equal to
6011         <varname>wal_segment_size</> multiplied by <varname>wal_block_size</>;
6012         by default this is 16MB.  See <xref linkend="wal-configuration"> for
6013         more information.
6014        </para>
6015       </listitem>
6016      </varlistentry>
6017
6018     </variablelist>
6019    </sect1>
6020
6021    <sect1 id="runtime-config-custom">
6022     <title>Customized Options</title>
6023
6024     <para>
6025      This feature was designed to allow parameters not normally known to
6026      <productname>PostgreSQL</productname> to be added by add-on modules
6027      (such as procedural languages).  This allows extension modules to be
6028      configured in the standard ways.
6029     </para>
6030
6031     <para>
6032      Custom options have two-part names: an extension name, then a dot, then
6033      the parameter name proper, much like qualified names in SQL.  An example
6034      is <literal>plpgsql.variable_conflict</>.
6035     </para>
6036
6037     <para>
6038      Because custom options may need to be set in processes that have not
6039      loaded the relevant extension module, <productname>PostgreSQL</>
6040      will accept a setting for any two-part parameter name.  Such variables
6041      are treated as placeholders and have no function until the module that
6042      defines them is loaded. When an extension module is loaded, it will add
6043      its variable definitions, convert any placeholder values according to
6044      those definitions, and issue warnings for any unrecognized placeholders
6045      that begin with its extension name.
6046     </para>
6047    </sect1>
6048
6049    <sect1 id="runtime-config-developer">
6050     <title>Developer Options</title>
6051
6052     <para>
6053      The following parameters are intended for work on the
6054      <productname>PostgreSQL</productname> source code, and in some cases
6055      to assist with recovery of severely damaged databases.  There
6056      should be no reason to use them on a production database.
6057      As such, they have been excluded from the sample
6058      <filename>postgresql.conf</> file.  Note that many of these
6059      parameters require special source compilation flags to work at all.
6060     </para>
6061
6062     <variablelist>
6063      <varlistentry id="guc-allow-system-table-mods" xreflabel="allow_system_table_mods">
6064       <term><varname>allow_system_table_mods</varname> (<type>boolean</type>)</term>
6065       <indexterm>
6066         <primary><varname>allow_system_table_mods</varname> configuration parameter</primary>
6067       </indexterm>
6068       <listitem>
6069        <para>
6070         Allows modification of the structure of system tables.
6071         This is used by <command>initdb</command>.
6072         This parameter can only be set at server start.
6073        </para>
6074       </listitem>
6075      </varlistentry>
6076
6077      <varlistentry id="guc-debug-assertions" xreflabel="debug_assertions">
6078       <term><varname>debug_assertions</varname> (<type>boolean</type>)</term>
6079       <indexterm>
6080        <primary><varname>debug_assertions</> configuration parameter</primary>
6081       </indexterm>
6082       <listitem>
6083        <para>
6084         Turns on various assertion checks. This is a debugging aid. If
6085         you are experiencing strange problems or crashes you might want
6086         to turn this on, as it might expose programming mistakes. To use
6087         this parameter, the macro <symbol>USE_ASSERT_CHECKING</symbol>
6088         must be defined when <productname>PostgreSQL</productname> is
6089         built (accomplished by the <command>configure</command> option
6090         <option>--enable-cassert</option>). Note that
6091         <varname>debug_assertions</varname> defaults to <literal>on</>
6092         if <productname>PostgreSQL</productname> has been built with
6093         assertions enabled.
6094        </para>
6095       </listitem>
6096      </varlistentry>
6097
6098      <varlistentry id="guc-ignore-system-indexes" xreflabel="ignore_system_indexes">
6099       <term><varname>ignore_system_indexes</varname> (<type>boolean</type>)</term>
6100       <indexterm>
6101         <primary><varname>ignore_system_indexes</varname> configuration parameter</primary>
6102       </indexterm>
6103       <listitem>
6104        <para>
6105         Ignore system indexes when reading system tables (but still
6106         update the indexes when modifying the tables).  This is useful
6107         when recovering from damaged system indexes.
6108         This parameter cannot be changed after session start.
6109        </para>
6110       </listitem>
6111      </varlistentry>
6112
6113      <varlistentry id="guc-post-auth-delay" xreflabel="post_auth_delay">
6114       <term><varname>post_auth_delay</varname> (<type>integer</type>)</term>
6115       <indexterm>
6116        <primary><varname>post_auth_delay</> configuration parameter</primary>
6117       </indexterm>
6118       <listitem>
6119        <para>
6120         If nonzero, a delay of this many seconds occurs when a new
6121         server process is started, after it conducts the
6122         authentication procedure.  This is intended to give developers an
6123         opportunity to attach to the server process with a debugger.
6124         This parameter cannot be changed after session start.
6125        </para>
6126       </listitem>
6127      </varlistentry>
6128
6129      <varlistentry id="guc-pre-auth-delay" xreflabel="pre_auth_delay">
6130       <term><varname>pre_auth_delay</varname> (<type>integer</type>)</term>
6131       <indexterm>
6132        <primary><varname>pre_auth_delay</> configuration parameter</primary>
6133       </indexterm>
6134       <listitem>
6135        <para>
6136         If nonzero, a delay of this many seconds occurs just after a
6137         new server process is forked, before it conducts the
6138         authentication procedure.  This is intended to give developers an
6139         opportunity to attach to the server process with a debugger to
6140         trace down misbehavior in authentication.
6141         This parameter can only be set in the <filename>postgresql.conf</>
6142         file or on the server command line.
6143        </para>
6144       </listitem>
6145      </varlistentry>
6146
6147      <varlistentry id="guc-trace-notify" xreflabel="trace_notify">
6148       <term><varname>trace_notify</varname> (<type>boolean</type>)</term>
6149       <indexterm>
6150        <primary><varname>trace_notify</> configuration parameter</primary>
6151       </indexterm>
6152       <listitem>
6153        <para>
6154         Generates a great amount of debugging output for the
6155         <command>LISTEN</command> and <command>NOTIFY</command>
6156         commands.  <xref linkend="guc-client-min-messages"> or
6157         <xref linkend="guc-log-min-messages"> must be
6158         <literal>DEBUG1</literal> or lower to send this output to the
6159         client or server logs, respectively.
6160        </para>
6161       </listitem>
6162      </varlistentry>
6163
6164      <varlistentry id="guc-trace-recovery-messages" xreflabel="trace_recovery_messages">
6165       <term><varname>trace_recovery_messages</varname> (<type>enum</type>)</term>
6166       <indexterm>
6167        <primary><varname>trace_recovery_messages</> configuration parameter</primary>
6168       </indexterm>
6169       <listitem>
6170        <para>
6171         Enables logging of recovery-related debugging output that otherwise
6172         would not be logged. This parameter allows the user to override the
6173         normal setting of <xref linkend="guc-log-min-messages">, but only for
6174         specific messages. This is intended for use in debugging Hot Standby.
6175         Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
6176         <literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>, and
6177         <literal>LOG</>.  The default, <literal>LOG</>, does not affect
6178         logging decisions at all.  The other values cause recovery-related
6179         debug messages of that priority or higher to be logged as though they
6180         had <literal>LOG</> priority; for common settings of
6181         <varname>log_min_messages</> this results in unconditionally sending
6182         them to the server log.
6183         This parameter can only be set in the <filename>postgresql.conf</>
6184         file or on the server command line.
6185        </para>
6186       </listitem>
6187      </varlistentry>
6188
6189      <varlistentry id="guc-trace-sort" xreflabel="trace_sort">
6190       <term><varname>trace_sort</varname> (<type>boolean</type>)</term>
6191       <indexterm>
6192        <primary><varname>trace_sort</> configuration parameter</primary>
6193       </indexterm>
6194       <listitem>
6195        <para>
6196         If on, emit information about resource usage during sort operations.
6197         This parameter is only available if the <symbol>TRACE_SORT</symbol> macro
6198         was defined when <productname>PostgreSQL</productname> was compiled.
6199         (However, <symbol>TRACE_SORT</symbol> is currently defined by default.)
6200        </para>
6201       </listitem>
6202      </varlistentry>
6203
6204      <varlistentry>
6205       <term><varname>trace_locks</varname> (<type>boolean</type>)</term>
6206       <indexterm>
6207        <primary><varname>trace_locks</> configuration parameter</primary>
6208       </indexterm>
6209       <listitem>
6210        <para>
6211         If on, emit information about lock usage.  Information dumped
6212         includes the type of lock operation, the type of lock and the unique
6213         identifier of the object being locked or unlocked.  Also included
6214         are bit masks for the lock types already granted on this object as
6215         well as for the lock types awaited on this object.  For each lock
6216         type a count of the number of granted locks and waiting locks is
6217         also dumped as well as the totals.  An example of the log file output
6218         is shown here:
6219 <screen>
6220 LOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6221       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6222       wait(0) type(AccessShareLock)
6223 LOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6224       grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1
6225       wait(0) type(AccessShareLock)
6226 LOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6227       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6228       wait(0) type(AccessShareLock)
6229 LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
6230       grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
6231       wait(0) type(INVALID)
6232 </screen>
6233         Details of the structure being dumped may be found in
6234         <filename>src/include/storage/lock.h</filename>.
6235        </para>
6236        <para>
6237         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6238         macro was defined when <productname>PostgreSQL</productname> was
6239         compiled.
6240        </para>
6241       </listitem>
6242      </varlistentry>
6243
6244      <varlistentry>
6245       <term><varname>trace_lwlocks</varname> (<type>boolean</type>)</term>
6246       <indexterm>
6247        <primary><varname>trace_lwlocks</> configuration parameter</primary>
6248       </indexterm>
6249       <listitem>
6250        <para>
6251         If on, emit information about lightweight lock usage.  Lightweight
6252         locks are intended primarily to provide mutual exclusion of access
6253         to shared-memory data structures.
6254        </para>
6255        <para>
6256         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6257         macro was defined when <productname>PostgreSQL</productname> was
6258         compiled.
6259        </para>
6260       </listitem>
6261      </varlistentry>
6262
6263      <varlistentry>
6264       <term><varname>trace_userlocks</varname> (<type>boolean</type>)</term>
6265       <indexterm>
6266        <primary><varname>trace_userlocks</> configuration parameter</primary>
6267       </indexterm>
6268       <listitem>
6269        <para>
6270         If on, emit information about user lock usage.  Output is the same
6271         as for <symbol>trace_locks</symbol>, only for advisory locks.
6272        </para>
6273        <para>
6274         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6275         macro was defined when <productname>PostgreSQL</productname> was
6276         compiled.
6277        </para>
6278       </listitem>
6279      </varlistentry>
6280
6281      <varlistentry>
6282       <term><varname>trace_lock_oidmin</varname> (<type>integer</type>)</term>
6283       <indexterm>
6284        <primary><varname>trace_lock_oidmin</> configuration parameter</primary>
6285       </indexterm>
6286       <listitem>
6287        <para>
6288         If set, do not trace locks for tables below this OID. (use to avoid
6289         output on system tables)
6290        </para>
6291        <para>
6292         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6293         macro was defined when <productname>PostgreSQL</productname> was
6294         compiled.
6295        </para>
6296       </listitem>
6297      </varlistentry>
6298
6299      <varlistentry>
6300       <term><varname>trace_lock_table</varname> (<type>integer</type>)</term>
6301       <indexterm>
6302        <primary><varname>trace_lock_table</> configuration parameter</primary>
6303       </indexterm>
6304       <listitem>
6305        <para>
6306         Unconditionally trace locks on this table (OID).
6307        </para>
6308        <para>
6309         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6310         macro was defined when <productname>PostgreSQL</productname> was
6311         compiled.
6312        </para>
6313       </listitem>
6314      </varlistentry>
6315
6316      <varlistentry>
6317       <term><varname>debug_deadlocks</varname> (<type>boolean</type>)</term>
6318       <indexterm>
6319        <primary><varname>debug_deadlocks</> configuration parameter</primary>
6320       </indexterm>
6321       <listitem>
6322        <para>
6323         If set, dumps information about all current locks when a
6324         deadlock timeout occurs.
6325        </para>
6326        <para>
6327         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
6328         macro was defined when <productname>PostgreSQL</productname> was
6329         compiled.
6330        </para>
6331       </listitem>
6332      </varlistentry>
6333
6334      <varlistentry>
6335       <term><varname>log_btree_build_stats</varname> (<type>boolean</type>)</term>
6336       <indexterm>
6337        <primary><varname>log_btree_build_stats</> configuration parameter</primary>
6338       </indexterm>
6339       <listitem>
6340        <para>
6341         If set, logs system resource usage statistics (memory and CPU) on
6342         various B-tree operations.
6343        </para>
6344        <para>
6345         This parameter is only available if the <symbol>BTREE_BUILD_STATS</symbol>
6346         macro was defined when <productname>PostgreSQL</productname> was
6347         compiled.
6348        </para>
6349       </listitem>
6350      </varlistentry>
6351
6352      <varlistentry id="guc-wal-debug" xreflabel="wal_debug">
6353       <term><varname>wal_debug</varname> (<type>boolean</type>)</term>
6354       <indexterm>
6355        <primary><varname>wal_debug</> configuration parameter</primary>
6356       </indexterm>
6357       <listitem>
6358        <para>
6359         If on, emit WAL-related debugging output. This parameter is
6360         only available if the <symbol>WAL_DEBUG</symbol> macro was
6361         defined when <productname>PostgreSQL</productname> was
6362         compiled.
6363        </para>
6364       </listitem>
6365      </varlistentry>
6366
6367     <varlistentry id="guc-zero-damaged-pages" xreflabel="zero_damaged_pages">
6368       <term><varname>zero_damaged_pages</varname> (<type>boolean</type>)</term>
6369       <indexterm>
6370        <primary><varname>zero_damaged_pages</> configuration parameter</primary>
6371       </indexterm>
6372       <listitem>
6373        <para>
6374         Detection of a damaged page header normally causes
6375         <productname>PostgreSQL</> to report an error, aborting the current
6376         transaction.  Setting <varname>zero_damaged_pages</> to on causes
6377         the system to instead report a warning, zero out the damaged
6378         page in memory, and continue processing.  This behavior <emphasis>will destroy data</>,
6379         namely all the rows on the damaged page.  However, it does allow you to get
6380         past the error and retrieve rows from any undamaged pages that might
6381         be present in the table.  It is useful for recovering data if
6382         corruption has occurred due to a hardware or software error.  You should
6383         generally not set this on until you have given up hope of recovering
6384         data from the damaged pages of a table.  Zeroed-out pages are not
6385         forced to disk so it is recommended to recreate the table or
6386         the index before turning this parameter off again.  The
6387         default setting is <literal>off</>, and it can only be changed
6388         by a superuser.
6389        </para>
6390       </listitem>
6391      </varlistentry>
6392    </variablelist>
6393   </sect1>
6394   <sect1 id="runtime-config-short">
6395    <title>Short Options</title>
6396
6397    <para>
6398     For convenience there are also single letter command-line option
6399     switches available for some parameters.  They are described in
6400     <xref linkend="runtime-config-short-table">.  Some of these
6401     options exist for historical reasons, and their presence as a
6402     single-letter option does not necessarily indicate an endorsement
6403     to use the option heavily.
6404    </para>
6405
6406     <table id="runtime-config-short-table">
6407      <title>Short Option Key</title>
6408      <tgroup cols="2">
6409       <thead>
6410        <row>
6411         <entry>Short Option</entry>
6412         <entry>Equivalent</entry>
6413        </row>
6414       </thead>
6415
6416       <tbody>
6417        <row>
6418         <entry><option>-A <replaceable>x</replaceable></option></entry>
6419         <entry><literal>debug_assertions = <replaceable>x</replaceable></></entry>
6420        </row>
6421        <row>
6422         <entry><option>-B <replaceable>x</replaceable></option></entry>
6423         <entry><literal>shared_buffers = <replaceable>x</replaceable></></entry>
6424        </row>
6425        <row>
6426         <entry><option>-d <replaceable>x</replaceable></option></entry>
6427         <entry><literal>log_min_messages = DEBUG<replaceable>x</replaceable></></entry>
6428        </row>
6429        <row>
6430         <entry><option>-e</option></entry>
6431         <entry><literal>datestyle = euro</></entry>
6432        </row>
6433        <row>
6434         <entry>
6435           <option>-fb</option>, <option>-fh</option>, <option>-fi</option>,
6436           <option>-fm</option>, <option>-fn</option>, <option>-fo</option>,
6437           <option>-fs</option>, <option>-ft</option>
6438          </entry>
6439          <entry>
6440           <literal>enable_bitmapscan = off</>,
6441           <literal>enable_hashjoin = off</>,
6442           <literal>enable_indexscan = off</>,
6443           <literal>enable_mergejoin = off</>,
6444           <literal>enable_nestloop = off</>,
6445           <literal>enable_indexonlyscan = off</>,
6446           <literal>enable_seqscan = off</>,
6447           <literal>enable_tidscan = off</>
6448          </entry>
6449        </row>
6450        <row>
6451         <entry><option>-F</option></entry>
6452         <entry><literal>fsync = off</></entry>
6453        </row>
6454        <row>
6455         <entry><option>-h <replaceable>x</replaceable></option></entry>
6456         <entry><literal>listen_addresses = <replaceable>x</replaceable></></entry>
6457        </row>
6458        <row>
6459         <entry><option>-i</option></entry>
6460         <entry><literal>listen_addresses = '*'</></entry>
6461        </row>
6462        <row>
6463         <entry><option>-k <replaceable>x</replaceable></option></entry>
6464         <entry><literal>unix_socket_directory = <replaceable>x</replaceable></></entry>
6465        </row>
6466        <row>
6467         <entry><option>-l</option></entry>
6468         <entry><literal>ssl = on</></entry>
6469        </row>
6470        <row>
6471         <entry><option>-N <replaceable>x</replaceable></option></entry>
6472         <entry><literal>max_connections = <replaceable>x</replaceable></></entry>
6473        </row>
6474        <row>
6475         <entry><option>-O</option></entry>
6476         <entry><literal>allow_system_table_mods = on</></entry>
6477        </row>
6478        <row>
6479         <entry><option>-p <replaceable>x</replaceable></option></entry>
6480         <entry><literal>port = <replaceable>x</replaceable></></entry>
6481        </row>
6482        <row>
6483         <entry><option>-P</option></entry>
6484         <entry><literal>ignore_system_indexes = on</></entry>
6485        </row>
6486        <row>
6487         <entry><option>-s</option></entry>
6488         <entry><literal>log_statement_stats = on</></entry>
6489        </row>
6490        <row>
6491         <entry><option>-S <replaceable>x</replaceable></option></entry>
6492         <entry><literal>work_mem = <replaceable>x</replaceable></></entry>
6493        </row>
6494        <row>
6495         <entry><option>-tpa</option>, <option>-tpl</option>, <option>-te</option></entry>
6496         <entry><literal>log_parser_stats = on</>,
6497         <literal>log_planner_stats = on</>,
6498         <literal>log_executor_stats = on</></entry>
6499        </row>
6500        <row>
6501         <entry><option>-W <replaceable>x</replaceable></option></entry>
6502         <entry><literal>post_auth_delay = <replaceable>x</replaceable></></entry>
6503        </row>
6504       </tbody>
6505      </tgroup>
6506     </table>
6507
6508   </sect1>
6509 </chapter>