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