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