Remove old RULE privilege completely.
[pgsql.git] / doc / src / sgml / config.sgml
blob0aec11f443212d2a53609423d263071116372cd2
1 <!-- doc/src/sgml/config.sgml -->
3 <chapter id="runtime-config">
4 <title>Server Configuration</title>
6 <indexterm>
7 <primary>configuration</primary>
8 <secondary>of the server</secondary>
9 </indexterm>
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>
18 <sect1 id="config-setting">
19 <title>Setting Parameters</title>
21 <sect2 id="config-setting-names-values">
22 <title>Parameter Names and Values</title>
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>
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>
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 (Values that match an SQL keyword require quoting in some contexts.)
55 </para>
56 </listitem>
58 <listitem>
59 <para>
60 <emphasis>Numeric (integer and floating point):</emphasis>
61 Numeric parameters can be specified in the customary integer and
62 floating-point formats; fractional values are rounded to the nearest
63 integer if the parameter is of integer type. Integer parameters
64 additionally accept hexadecimal input (beginning
65 with <literal>0x</literal>) and octal input (beginning
66 with <literal>0</literal>), but these formats cannot have a fraction.
67 Do not use thousands separators.
68 Quotes are not required, except for hexadecimal input.
69 </para>
70 </listitem>
72 <listitem>
73 <para>
74 <emphasis>Numeric with Unit:</emphasis>
75 Some numeric parameters have an implicit unit, because they describe
76 quantities of memory or time. The unit might be bytes, kilobytes, blocks
77 (typically eight kilobytes), milliseconds, seconds, or minutes.
78 An unadorned numeric value for one of these settings will use the
79 setting's default unit, which can be learned from
80 <structname>pg_settings</structname>.<structfield>unit</structfield>.
81 For convenience, settings can be given with a unit specified explicitly,
82 for example <literal>'120 ms'</literal> for a time value, and they will be
83 converted to whatever the parameter's actual unit is. Note that the
84 value must be written as a string (with quotes) to use this feature.
85 The unit name is case-sensitive, and there can be whitespace between
86 the numeric value and the unit.
88 <itemizedlist>
89 <listitem>
90 <para>
91 Valid memory units are <literal>B</literal> (bytes),
92 <literal>kB</literal> (kilobytes),
93 <literal>MB</literal> (megabytes), <literal>GB</literal>
94 (gigabytes), and <literal>TB</literal> (terabytes).
95 The multiplier for memory units is 1024, not 1000.
96 </para>
97 </listitem>
99 <listitem>
100 <para>
101 Valid time units are
102 <literal>us</literal> (microseconds),
103 <literal>ms</literal> (milliseconds),
104 <literal>s</literal> (seconds), <literal>min</literal> (minutes),
105 <literal>h</literal> (hours), and <literal>d</literal> (days).
106 </para>
107 </listitem>
108 </itemizedlist>
110 If a fractional value is specified with a unit, it will be rounded
111 to a multiple of the next smaller unit if there is one.
112 For example, <literal>30.1 GB</literal> will be converted
113 to <literal>30822 MB</literal> not <literal>32319628902 B</literal>.
114 If the parameter is of integer type, a final rounding to integer
115 occurs after any unit conversion.
116 </para>
117 </listitem>
119 <listitem>
120 <para>
121 <emphasis>Enumerated:</emphasis>
122 Enumerated-type parameters are written in the same way as string
123 parameters, but are restricted to have one of a limited set of
124 values. The values allowable for such a parameter can be found from
125 <structname>pg_settings</structname>.<structfield>enumvals</structfield>.
126 Enum parameter values are case-insensitive.
127 </para>
128 </listitem>
129 </itemizedlist>
130 </sect2>
132 <sect2 id="config-setting-configuration-file">
133 <title>Parameter Interaction via the Configuration File</title>
135 <para>
136 The most fundamental way to set these parameters is to edit the file
137 <filename>postgresql.conf</filename><indexterm><primary>postgresql.conf</primary></indexterm>,
138 which is normally kept in the data directory. A default copy is
139 installed when the database cluster directory is initialized.
140 An example of what this file might look like is:
141 <programlisting>
142 # This is a comment
143 log_connections = yes
144 log_destination = 'syslog'
145 search_path = '"$user", public'
146 shared_buffers = 128MB
147 </programlisting>
148 One parameter is specified per line. The equal sign between name and
149 value is optional. Whitespace is insignificant (except within a quoted
150 parameter value) and blank lines are
151 ignored. Hash marks (<literal>#</literal>) designate the remainder
152 of the line as a comment. Parameter values that are not simple
153 identifiers or numbers must be single-quoted. To embed a single
154 quote in a parameter value, write either two quotes (preferred)
155 or backslash-quote.
156 If the file contains multiple entries for the same parameter,
157 all but the last one are ignored.
158 </para>
160 <para>
161 Parameters set in this way provide default values for the cluster.
162 The settings seen by active sessions will be these values unless they
163 are overridden. The following sections describe ways in which the
164 administrator or user can override these defaults.
165 </para>
167 <para>
168 <indexterm>
169 <primary>SIGHUP</primary>
170 </indexterm>
171 The configuration file is reread whenever the main server process
172 receives a <systemitem>SIGHUP</systemitem> signal; this signal is most easily
173 sent by running <literal>pg_ctl reload</literal> from the command line or by
174 calling the SQL function <function>pg_reload_conf()</function>. The main
175 server process also propagates this signal to all currently running
176 server processes, so that existing sessions also adopt the new values
177 (this will happen after they complete any currently-executing client
178 command). Alternatively, you can
179 send the signal to a single server process directly. Some parameters
180 can only be set at server start; any changes to their entries in the
181 configuration file will be ignored until the server is restarted.
182 Invalid parameter settings in the configuration file are likewise
183 ignored (but logged) during <systemitem>SIGHUP</systemitem> processing.
184 </para>
186 <para>
187 In addition to <filename>postgresql.conf</filename>,
188 a <productname>PostgreSQL</productname> data directory contains a file
189 <filename>postgresql.auto.conf</filename><indexterm><primary>postgresql.auto.conf</primary></indexterm>,
190 which has the same format as <filename>postgresql.conf</filename> but
191 is intended to be edited automatically, not manually. This file holds
192 settings provided through the <link linkend="sql-altersystem"><command>ALTER SYSTEM</command></link> command.
193 This file is read whenever <filename>postgresql.conf</filename> is,
194 and its settings take effect in the same way. Settings
195 in <filename>postgresql.auto.conf</filename> override those
196 in <filename>postgresql.conf</filename>.
197 </para>
199 <para>
200 External tools may also
201 modify <filename>postgresql.auto.conf</filename>. It is not
202 recommended to do this while the server is running unless <xref
203 linkend="guc-allow-alter-system"/> is set to <literal>off</literal>, since a
204 concurrent <command>ALTER SYSTEM</command> command could overwrite
205 such changes. Such tools might simply append new settings to the end,
206 or they might choose to remove duplicate settings and/or comments
207 (as <command>ALTER SYSTEM</command> will).
208 </para>
210 <para>
211 The system view
212 <link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link>
213 can be helpful for pre-testing changes to the configuration files, or for
214 diagnosing problems if a <systemitem>SIGHUP</systemitem> signal did not have the
215 desired effects.
216 </para>
217 </sect2>
219 <sect2 id="config-setting-sql">
220 <title>Parameter Interaction via SQL</title>
222 <para>
223 <productname>PostgreSQL</productname> provides three SQL
224 commands to establish configuration defaults.
225 The already-mentioned <command>ALTER SYSTEM</command> command
226 provides an SQL-accessible means of changing global defaults; it is
227 functionally equivalent to editing <filename>postgresql.conf</filename>.
228 In addition, there are two commands that allow setting of defaults
229 on a per-database or per-role basis:
230 </para>
232 <itemizedlist>
233 <listitem>
234 <para>
235 The <link linkend="sql-alterdatabase"><command>ALTER DATABASE</command></link> command allows global
236 settings to be overridden on a per-database basis.
237 </para>
238 </listitem>
240 <listitem>
241 <para>
242 The <link linkend="sql-alterrole"><command>ALTER ROLE</command></link> command allows both global and
243 per-database settings to be overridden with user-specific values.
244 </para>
245 </listitem>
246 </itemizedlist>
248 <para>
249 Values set with <command>ALTER DATABASE</command> and <command>ALTER ROLE</command>
250 are applied only when starting a fresh database session. They
251 override values obtained from the configuration files or server
252 command line, and constitute defaults for the rest of the session.
253 Note that some settings cannot be changed after server start, and
254 so cannot be set with these commands (or the ones listed below).
255 </para>
257 <para>
258 Once a client is connected to the database, <productname>PostgreSQL</productname>
259 provides two additional SQL commands (and equivalent functions) to
260 interact with session-local configuration settings:
261 </para>
263 <itemizedlist>
264 <listitem>
265 <para>
266 The <link linkend="sql-show"><command>SHOW</command></link> command allows inspection of the
267 current value of any parameter. The corresponding SQL function is
268 <function>current_setting(setting_name text)</function>
269 (see <xref linkend="functions-admin-set"/>).
270 </para>
271 </listitem>
273 <listitem>
274 <para>
275 The <link linkend="sql-set"><command>SET</command></link> command allows modification of the
276 current value of those parameters that can be set locally to a
277 session; it has no effect on other sessions.
278 Many parameters can be set this way by any user, but some can
279 only be set by superusers and users who have been
280 granted <literal>SET</literal> privilege on that parameter.
281 The corresponding SQL function is
282 <function>set_config(setting_name, new_value, is_local)</function>
283 (see <xref linkend="functions-admin-set"/>).
284 </para>
285 </listitem>
286 </itemizedlist>
288 <para>
289 In addition, the system view <link
290 linkend="view-pg-settings"><structname>pg_settings</structname></link> can be
291 used to view and change session-local values:
292 </para>
294 <itemizedlist>
295 <listitem>
296 <para>
297 Querying this view is similar to using <command>SHOW ALL</command> but
298 provides more detail. It is also more flexible, since it's possible
299 to specify filter conditions or join against other relations.
300 </para>
301 </listitem>
303 <listitem>
304 <para>
305 Using <command>UPDATE</command> on this view, specifically
306 updating the <structname>setting</structname> column, is the equivalent
307 of issuing <command>SET</command> commands. For example, the equivalent of
308 <programlisting>
309 SET configuration_parameter TO DEFAULT;
310 </programlisting>
312 <programlisting>
313 UPDATE pg_settings SET setting = reset_val WHERE name = 'configuration_parameter';
314 </programlisting>
315 </para>
316 </listitem>
317 </itemizedlist>
319 </sect2>
321 <sect2 id="config-setting-shell">
322 <title>Parameter Interaction via the Shell</title>
324 <para>
325 In addition to setting global defaults or attaching
326 overrides at the database or role level, you can pass settings to
327 <productname>PostgreSQL</productname> via shell facilities.
328 Both the server and <application>libpq</application> client library
329 accept parameter values via the shell.
330 </para>
332 <itemizedlist>
333 <listitem>
334 <para>
335 During server startup, parameter settings can be
336 passed to the <command>postgres</command> command via the
337 <option>-c name=value</option> command-line parameter, or its equivalent
338 <option>--name=value</option> variation. For example,
339 <programlisting>
340 postgres -c log_connections=yes --log-destination='syslog'
341 </programlisting>
342 Settings provided in this way override those set via
343 <filename>postgresql.conf</filename> or <command>ALTER SYSTEM</command>,
344 so they cannot be changed globally without restarting the server.
345 </para>
346 </listitem>
348 <listitem>
349 <para>
350 When starting a client session via <application>libpq</application>,
351 parameter settings can be
352 specified using the <envar>PGOPTIONS</envar> environment variable.
353 Settings established in this way constitute defaults for the life
354 of the session, but do not affect other sessions.
355 For historical reasons, the format of <envar>PGOPTIONS</envar> is
356 similar to that used when launching the <command>postgres</command>
357 command; specifically, the <option>-c</option>, or prepended
358 <literal>--</literal>, before the name must be specified. For example,
359 <programlisting>
360 env PGOPTIONS="-c geqo=off --statement-timeout=5min" psql
361 </programlisting>
362 </para>
364 <para>
365 Other clients and libraries might provide their own mechanisms,
366 via the shell or otherwise, that allow the user to alter session
367 settings without direct use of SQL commands.
368 </para>
369 </listitem>
370 </itemizedlist>
372 </sect2>
374 <sect2 id="config-includes">
375 <title>Managing Configuration File Contents</title>
377 <para>
378 <productname>PostgreSQL</productname> provides several features for breaking
379 down complex <filename>postgresql.conf</filename> files into sub-files.
380 These features are especially useful when managing multiple servers
381 with related, but not identical, configurations.
382 </para>
384 <para>
385 <indexterm>
386 <primary><literal>include</literal></primary>
387 <secondary>in configuration file</secondary>
388 </indexterm>
389 In addition to individual parameter settings,
390 the <filename>postgresql.conf</filename> file can contain <firstterm>include
391 directives</firstterm>, which specify another file to read and process as if
392 it were inserted into the configuration file at this point. This
393 feature allows a configuration file to be divided into physically
394 separate parts. Include directives simply look like:
395 <programlisting>
396 include 'filename'
397 </programlisting>
398 If the file name is not an absolute path, it is taken as relative to
399 the directory containing the referencing configuration file.
400 Inclusions can be nested.
401 </para>
403 <para>
404 <indexterm>
405 <primary><literal>include_if_exists</literal></primary>
406 <secondary>in configuration file</secondary>
407 </indexterm>
408 There is also an <literal>include_if_exists</literal> directive, which acts
409 the same as the <literal>include</literal> directive, except
410 when the referenced file does not exist or cannot be read. A regular
411 <literal>include</literal> will consider this an error condition, but
412 <literal>include_if_exists</literal> merely logs a message and continues
413 processing the referencing configuration file.
414 </para>
416 <para>
417 <indexterm>
418 <primary><literal>include_dir</literal></primary>
419 <secondary>in configuration file</secondary>
420 </indexterm>
421 The <filename>postgresql.conf</filename> file can also contain
422 <literal>include_dir</literal> directives, which specify an entire
423 directory of configuration files to include. These look like
424 <programlisting>
425 include_dir 'directory'
426 </programlisting>
427 Non-absolute directory names are taken as relative to the directory
428 containing the referencing configuration file. Within the specified
429 directory, only non-directory files whose names end with the
430 suffix <literal>.conf</literal> will be included. File names that
431 start with the <literal>.</literal> character are also ignored, to
432 prevent mistakes since such files are hidden on some platforms. Multiple
433 files within an include directory are processed in file name order
434 (according to C locale rules, i.e., numbers before letters, and
435 uppercase letters before lowercase ones).
436 </para>
438 <para>
439 Include files or directories can be used to logically separate portions
440 of the database configuration, rather than having a single large
441 <filename>postgresql.conf</filename> file. Consider a company that has two
442 database servers, each with a different amount of memory. There are
443 likely elements of the configuration both will share, for things such
444 as logging. But memory-related parameters on the server will vary
445 between the two. And there might be server specific customizations,
446 too. One way to manage this situation is to break the custom
447 configuration changes for your site into three files. You could add
448 this to the end of your <filename>postgresql.conf</filename> file to include
449 them:
450 <programlisting>
451 include 'shared.conf'
452 include 'memory.conf'
453 include 'server.conf'
454 </programlisting>
455 All systems would have the same <filename>shared.conf</filename>. Each
456 server with a particular amount of memory could share the
457 same <filename>memory.conf</filename>; you might have one for all servers
458 with 8GB of RAM, another for those having 16GB. And
459 finally <filename>server.conf</filename> could have truly server-specific
460 configuration information in it.
461 </para>
463 <para>
464 Another possibility is to create a configuration file directory and
465 put this information into files there. For example, a <filename>conf.d</filename>
466 directory could be referenced at the end of <filename>postgresql.conf</filename>:
467 <programlisting>
468 include_dir 'conf.d'
469 </programlisting>
470 Then you could name the files in the <filename>conf.d</filename> directory
471 like this:
472 <programlisting>
473 00shared.conf
474 01memory.conf
475 02server.conf
476 </programlisting>
477 This naming convention establishes a clear order in which these
478 files will be loaded. This is important because only the last
479 setting encountered for a particular parameter while the server is
480 reading configuration files will be used. In this example,
481 something set in <filename>conf.d/02server.conf</filename> would override a
482 value set in <filename>conf.d/01memory.conf</filename>.
483 </para>
485 <para>
486 You might instead use this approach to naming the files
487 descriptively:
488 <programlisting>
489 00shared.conf
490 01memory-8GB.conf
491 02server-foo.conf
492 </programlisting>
493 This sort of arrangement gives a unique name for each configuration file
494 variation. This can help eliminate ambiguity when several servers have
495 their configurations all stored in one place, such as in a version
496 control repository. (Storing database configuration files under version
497 control is another good practice to consider.)
498 </para>
499 </sect2>
500 </sect1>
502 <sect1 id="runtime-config-file-locations">
503 <title>File Locations</title>
505 <para>
506 In addition to the <filename>postgresql.conf</filename> file
507 already mentioned, <productname>PostgreSQL</productname> uses
508 two other manually-edited configuration files, which control
509 client authentication (their use is discussed in <xref
510 linkend="client-authentication"/>). By default, all three
511 configuration files are stored in the database cluster's data
512 directory. The parameters described in this section allow the
513 configuration files to be placed elsewhere. (Doing so can ease
514 administration. In particular it is often easier to ensure that
515 the configuration files are properly backed-up when they are
516 kept separate.)
517 </para>
519 <variablelist>
520 <varlistentry id="guc-data-directory" xreflabel="data_directory">
521 <term><varname>data_directory</varname> (<type>string</type>)
522 <indexterm>
523 <primary><varname>data_directory</varname> configuration parameter</primary>
524 </indexterm>
525 </term>
526 <listitem>
527 <para>
528 Specifies the directory to use for data storage.
529 This parameter can only be set at server start.
530 </para>
531 </listitem>
532 </varlistentry>
534 <varlistentry id="guc-config-file" xreflabel="config_file">
535 <term><varname>config_file</varname> (<type>string</type>)
536 <indexterm>
537 <primary><varname>config_file</varname> configuration parameter</primary>
538 </indexterm>
539 </term>
540 <listitem>
541 <para>
542 Specifies the main server configuration file
543 (customarily called <filename>postgresql.conf</filename>).
544 This parameter can only be set on the <command>postgres</command> command line.
545 </para>
546 </listitem>
547 </varlistentry>
549 <varlistentry id="guc-hba-file" xreflabel="hba_file">
550 <term><varname>hba_file</varname> (<type>string</type>)
551 <indexterm>
552 <primary><varname>hba_file</varname> configuration parameter</primary>
553 </indexterm>
554 </term>
555 <listitem>
556 <para>
557 Specifies the configuration file for host-based authentication
558 (customarily called <filename>pg_hba.conf</filename>).
559 This parameter can only be set at server start.
560 </para>
561 </listitem>
562 </varlistentry>
564 <varlistentry id="guc-ident-file" xreflabel="ident_file">
565 <term><varname>ident_file</varname> (<type>string</type>)
566 <indexterm>
567 <primary><varname>ident_file</varname> configuration parameter</primary>
568 </indexterm>
569 </term>
570 <listitem>
571 <para>
572 Specifies the configuration file for user name mapping
573 (customarily called <filename>pg_ident.conf</filename>).
574 This parameter can only be set at server start.
575 See also <xref linkend="auth-username-maps"/>.
576 </para>
577 </listitem>
578 </varlistentry>
580 <varlistentry id="guc-external-pid-file" xreflabel="external_pid_file">
581 <term><varname>external_pid_file</varname> (<type>string</type>)
582 <indexterm>
583 <primary><varname>external_pid_file</varname> configuration parameter</primary>
584 </indexterm>
585 </term>
586 <listitem>
587 <para>
588 Specifies the name of an additional process-ID (PID) file that the
589 server should create for use by server administration programs.
590 This parameter can only be set at server start.
591 </para>
592 </listitem>
593 </varlistentry>
594 </variablelist>
596 <para>
597 In a default installation, none of the above parameters are set
598 explicitly. Instead, the
599 data directory is specified by the <option>-D</option> command-line
600 option or the <envar>PGDATA</envar> environment variable, and the
601 configuration files are all found within the data directory.
602 </para>
604 <para>
605 If you wish to keep the configuration files elsewhere than the
606 data directory, the <command>postgres</command> <option>-D</option>
607 command-line option or <envar>PGDATA</envar> environment variable
608 must point to the directory containing the configuration files,
609 and the <varname>data_directory</varname> parameter must be set in
610 <filename>postgresql.conf</filename> (or on the command line) to show
611 where the data directory is actually located. Notice that
612 <varname>data_directory</varname> overrides <option>-D</option> and
613 <envar>PGDATA</envar> for the location
614 of the data directory, but not for the location of the configuration
615 files.
616 </para>
618 <para>
619 If you wish, you can specify the configuration file names and locations
620 individually using the parameters <varname>config_file</varname>,
621 <varname>hba_file</varname> and/or <varname>ident_file</varname>.
622 <varname>config_file</varname> can only be specified on the
623 <command>postgres</command> command line, but the others can be
624 set within the main configuration file. If all three parameters plus
625 <varname>data_directory</varname> are explicitly set, then it is not necessary
626 to specify <option>-D</option> or <envar>PGDATA</envar>.
627 </para>
629 <para>
630 When setting any of these parameters, a relative path will be interpreted
631 with respect to the directory in which <command>postgres</command>
632 is started.
633 </para>
634 </sect1>
636 <sect1 id="runtime-config-connection">
637 <title>Connections and Authentication</title>
639 <sect2 id="runtime-config-connection-settings">
640 <title>Connection Settings</title>
642 <variablelist>
644 <varlistentry id="guc-listen-addresses" xreflabel="listen_addresses">
645 <term><varname>listen_addresses</varname> (<type>string</type>)
646 <indexterm>
647 <primary><varname>listen_addresses</varname> configuration parameter</primary>
648 </indexterm>
649 </term>
650 <listitem>
651 <para>
652 Specifies the TCP/IP address(es) on which the server is
653 to listen for connections from client applications.
654 The value takes the form of a comma-separated list of host names
655 and/or numeric IP addresses. The special entry <literal>*</literal>
656 corresponds to all available IP interfaces. The entry
657 <literal>0.0.0.0</literal> allows listening for all IPv4 addresses and
658 <literal>::</literal> allows listening for all IPv6 addresses.
659 If the list is empty, the server does not listen on any IP interface
660 at all, in which case only Unix-domain sockets can be used to connect
661 to it. If the list is not empty, the server will start if it
662 can listen on at least one TCP/IP address. A warning will be
663 emitted for any TCP/IP address which cannot be opened.
664 The default value is <systemitem class="systemname">localhost</systemitem>,
665 which allows only local TCP/IP <quote>loopback</quote> connections to be
666 made.
667 </para>
668 <para>
669 While client authentication (<xref
670 linkend="client-authentication"/>) allows fine-grained control
671 over who can access the server, <varname>listen_addresses</varname>
672 controls which interfaces accept connection attempts, which
673 can help prevent repeated malicious connection requests on
674 insecure network interfaces. This parameter can only be set
675 at server start.
676 </para>
677 </listitem>
678 </varlistentry>
680 <varlistentry id="guc-port" xreflabel="port">
681 <term><varname>port</varname> (<type>integer</type>)
682 <indexterm>
683 <primary><varname>port</varname> configuration parameter</primary>
684 </indexterm>
685 </term>
686 <listitem>
687 <para>
688 The TCP port the server listens on; 5432 by default. Note that the
689 same port number is used for all IP addresses the server listens on.
690 This parameter can only be set at server start.
691 </para>
692 </listitem>
693 </varlistentry>
695 <varlistentry id="guc-max-connections" xreflabel="max_connections">
696 <term><varname>max_connections</varname> (<type>integer</type>)
697 <indexterm>
698 <primary><varname>max_connections</varname> configuration parameter</primary>
699 </indexterm>
700 </term>
701 <listitem>
702 <para>
703 Determines the maximum number of concurrent connections to the
704 database server. The default is typically 100 connections, but
705 might be less if your kernel settings will not support it (as
706 determined during <application>initdb</application>). This parameter can
707 only be set at server start.
708 </para>
710 <para>
711 PostgreSQL sizes certain resources based directly on the value of
712 <varname>max_connections</varname>. Increasing its value leads to
713 higher allocation of those resources, including shared memory.
714 </para>
716 <para>
717 When running a standby server, you must set this parameter to the
718 same or higher value than on the primary server. Otherwise, queries
719 will not be allowed in the standby server.
720 </para>
721 </listitem>
722 </varlistentry>
724 <varlistentry id="guc-reserved-connections" xreflabel="reserved_connections">
725 <term><varname>reserved_connections</varname> (<type>integer</type>)
726 <indexterm>
727 <primary><varname>reserved_connections</varname> configuration parameter</primary>
728 </indexterm>
729 </term>
730 <listitem>
731 <para>
732 Determines the number of connection <quote>slots</quote> that are
733 reserved for connections by roles with privileges of the
734 <xref linkend="predefined-role-pg-use-reserved-connections"/>
735 role. Whenever the number of free connection slots is greater than
736 <xref linkend="guc-superuser-reserved-connections"/> but less than or
737 equal to the sum of <varname>superuser_reserved_connections</varname>
738 and <varname>reserved_connections</varname>, new connections will be
739 accepted only for superusers and roles with privileges of
740 <literal>pg_use_reserved_connections</literal>. If
741 <varname>superuser_reserved_connections</varname> or fewer connection
742 slots are available, new connections will be accepted only for
743 superusers.
744 </para>
746 <para>
747 The default value is zero connections. The value must be less than
748 <varname>max_connections</varname> minus
749 <varname>superuser_reserved_connections</varname>. This parameter can
750 only be set at server start.
751 </para>
752 </listitem>
753 </varlistentry>
755 <varlistentry id="guc-superuser-reserved-connections"
756 xreflabel="superuser_reserved_connections">
757 <term><varname>superuser_reserved_connections</varname>
758 (<type>integer</type>)
759 <indexterm>
760 <primary><varname>superuser_reserved_connections</varname> configuration parameter</primary>
761 </indexterm>
762 </term>
763 <listitem>
764 <para>
765 Determines the number of connection <quote>slots</quote> that
766 are reserved for connections by <productname>PostgreSQL</productname>
767 superusers. At most <xref linkend="guc-max-connections"/>
768 connections can ever be active simultaneously. Whenever the
769 number of active concurrent connections is at least
770 <varname>max_connections</varname> minus
771 <varname>superuser_reserved_connections</varname>, new
772 connections will be accepted only for superusers. The connection slots
773 reserved by this parameter are intended as final reserve for emergency
774 use after the slots reserved by
775 <xref linkend="guc-reserved-connections"/> have been exhausted.
776 </para>
778 <para>
779 The default value is three connections. The value must be less
780 than <varname>max_connections</varname> minus
781 <varname>reserved_connections</varname>.
782 This parameter can only be set at server start.
783 </para>
784 </listitem>
785 </varlistentry>
787 <varlistentry id="guc-unix-socket-directories" xreflabel="unix_socket_directories">
788 <term><varname>unix_socket_directories</varname> (<type>string</type>)
789 <indexterm>
790 <primary><varname>unix_socket_directories</varname> configuration parameter</primary>
791 </indexterm>
792 </term>
793 <listitem>
794 <para>
795 Specifies the directory of the Unix-domain socket(s) on which the
796 server is to listen for connections from client applications.
797 Multiple sockets can be created by listing multiple directories
798 separated by commas. Whitespace between entries is
799 ignored; surround a directory name with double quotes if you need
800 to include whitespace or commas in the name.
801 An empty value
802 specifies not listening on any Unix-domain sockets, in which case
803 only TCP/IP sockets can be used to connect to the server.
804 </para>
806 <para>
807 A value that starts with <literal>@</literal> specifies that a
808 Unix-domain socket in the abstract namespace should be created
809 (currently supported on Linux only). In that case, this value
810 does not specify a <quote>directory</quote> but a prefix from which
811 the actual socket name is computed in the same manner as for the
812 file-system namespace. While the abstract socket name prefix can be
813 chosen freely, since it is not a file-system location, the convention
814 is to nonetheless use file-system-like values such as
815 <literal>@/tmp</literal>.
816 </para>
818 <para>
819 The default value is normally
820 <filename>/tmp</filename>, but that can be changed at build time.
821 On Windows, the default is empty, which means no Unix-domain socket is
822 created by default.
823 This parameter can only be set at server start.
824 </para>
826 <para>
827 In addition to the socket file itself, which is named
828 <literal>.s.PGSQL.<replaceable>nnnn</replaceable></literal> where
829 <replaceable>nnnn</replaceable> is the server's port number, an ordinary file
830 named <literal>.s.PGSQL.<replaceable>nnnn</replaceable>.lock</literal> will be
831 created in each of the <varname>unix_socket_directories</varname> directories.
832 Neither file should ever be removed manually.
833 For sockets in the abstract namespace, no lock file is created.
834 </para>
835 </listitem>
836 </varlistentry>
838 <varlistentry id="guc-unix-socket-group" xreflabel="unix_socket_group">
839 <term><varname>unix_socket_group</varname> (<type>string</type>)
840 <indexterm>
841 <primary><varname>unix_socket_group</varname> configuration parameter</primary>
842 </indexterm>
843 </term>
844 <listitem>
845 <para>
846 Sets the owning group of the Unix-domain socket(s). (The owning
847 user of the sockets is always the user that starts the
848 server.) In combination with the parameter
849 <varname>unix_socket_permissions</varname> this can be used as
850 an additional access control mechanism for Unix-domain connections.
851 By default this is the empty string, which uses the default
852 group of the server user. This parameter can only be set at
853 server start.
854 </para>
856 <para>
857 This parameter is not supported on Windows. Any setting will be
858 ignored. Also, sockets in the abstract namespace have no file owner,
859 so this setting is also ignored in that case.
860 </para>
861 </listitem>
862 </varlistentry>
864 <varlistentry id="guc-unix-socket-permissions" xreflabel="unix_socket_permissions">
865 <term><varname>unix_socket_permissions</varname> (<type>integer</type>)
866 <indexterm>
867 <primary><varname>unix_socket_permissions</varname> configuration parameter</primary>
868 </indexterm>
869 </term>
870 <listitem>
871 <para>
872 Sets the access permissions of the Unix-domain socket(s). Unix-domain
873 sockets use the usual Unix file system permission set.
874 The parameter value is expected to be a numeric mode
875 specified in the format accepted by the
876 <function>chmod</function> and <function>umask</function>
877 system calls. (To use the customary octal format the number
878 must start with a <literal>0</literal> (zero).)
879 </para>
881 <para>
882 The default permissions are <literal>0777</literal>, meaning
883 anyone can connect. Reasonable alternatives are
884 <literal>0770</literal> (only user and group, see also
885 <varname>unix_socket_group</varname>) and <literal>0700</literal>
886 (only user). (Note that for a Unix-domain socket, only write
887 permission matters, so there is no point in setting or revoking
888 read or execute permissions.)
889 </para>
891 <para>
892 This access control mechanism is independent of the one
893 described in <xref linkend="client-authentication"/>.
894 </para>
896 <para>
897 This parameter can only be set at server start.
898 </para>
900 <para>
901 This parameter is irrelevant on systems, notably Solaris as of Solaris
902 10, that ignore socket permissions entirely. There, one can achieve a
903 similar effect by pointing <varname>unix_socket_directories</varname> to a
904 directory having search permission limited to the desired audience.
905 </para>
907 <para>
908 Sockets in the abstract namespace have no file permissions, so this
909 setting is also ignored in that case.
910 </para>
911 </listitem>
912 </varlistentry>
914 <varlistentry id="guc-bonjour" xreflabel="bonjour">
915 <term><varname>bonjour</varname> (<type>boolean</type>)
916 <indexterm>
917 <primary><varname>bonjour</varname> configuration parameter</primary>
918 </indexterm>
919 </term>
920 <listitem>
921 <para>
922 Enables advertising the server's existence via
923 <productname>Bonjour</productname>. The default is off.
924 This parameter can only be set at server start.
925 </para>
926 </listitem>
927 </varlistentry>
929 <varlistentry id="guc-bonjour-name" xreflabel="bonjour_name">
930 <term><varname>bonjour_name</varname> (<type>string</type>)
931 <indexterm>
932 <primary><varname>bonjour_name</varname> configuration parameter</primary>
933 </indexterm>
934 </term>
935 <listitem>
936 <para>
937 Specifies the <productname>Bonjour</productname> service
938 name. The computer name is used if this parameter is set to the
939 empty string <literal>''</literal> (which is the default). This parameter is
940 ignored if the server was not compiled with
941 <productname>Bonjour</productname> support.
942 This parameter can only be set at server start.
943 </para>
944 </listitem>
945 </varlistentry>
946 </variablelist>
947 </sect2>
949 <sect2 id="runtime-config-tcp-settings">
950 <title>TCP Settings</title>
952 <variablelist>
954 <varlistentry id="guc-tcp-keepalives-idle" xreflabel="tcp_keepalives_idle">
955 <term><varname>tcp_keepalives_idle</varname> (<type>integer</type>)
956 <indexterm>
957 <primary><varname>tcp_keepalives_idle</varname> configuration parameter</primary>
958 </indexterm>
959 </term>
960 <listitem>
961 <para>
962 Specifies the amount of time with no network activity after which
963 the operating system should send a TCP keepalive message to the client.
964 If this value is specified without units, it is taken as seconds.
965 A value of 0 (the default) selects the operating system's default.
966 On Windows, setting a value of 0 will set this parameter to 2 hours,
967 since Windows does not provide a way to read the system default value.
968 This parameter is supported only on systems that support
969 <symbol>TCP_KEEPIDLE</symbol> or an equivalent socket option, and on
970 Windows; on other systems, it must be zero.
971 In sessions connected via a Unix-domain socket, this parameter is
972 ignored and always reads as zero.
973 </para>
974 </listitem>
975 </varlistentry>
977 <varlistentry id="guc-tcp-keepalives-interval" xreflabel="tcp_keepalives_interval">
978 <term><varname>tcp_keepalives_interval</varname> (<type>integer</type>)
979 <indexterm>
980 <primary><varname>tcp_keepalives_interval</varname> configuration parameter</primary>
981 </indexterm>
982 </term>
983 <listitem>
984 <para>
985 Specifies the amount of time after which a TCP keepalive message
986 that has not been acknowledged by the client should be retransmitted.
987 If this value is specified without units, it is taken as seconds.
988 A value of 0 (the default) selects the operating system's default.
989 On Windows, setting a value of 0 will set this parameter to 1 second,
990 since Windows does not provide a way to read the system default value.
991 This parameter is supported only on systems that support
992 <symbol>TCP_KEEPINTVL</symbol> or an equivalent socket option, and on
993 Windows; on other systems, it must be zero.
994 In sessions connected via a Unix-domain socket, this parameter is
995 ignored and always reads as zero.
996 </para>
997 </listitem>
998 </varlistentry>
1000 <varlistentry id="guc-tcp-keepalives-count" xreflabel="tcp_keepalives_count">
1001 <term><varname>tcp_keepalives_count</varname> (<type>integer</type>)
1002 <indexterm>
1003 <primary><varname>tcp_keepalives_count</varname> configuration parameter</primary>
1004 </indexterm>
1005 </term>
1006 <listitem>
1007 <para>
1008 Specifies the number of TCP keepalive messages that can be lost before
1009 the server's connection to the client is considered dead.
1010 A value of 0 (the default) selects the operating system's default.
1011 This parameter is supported only on systems that support
1012 <symbol>TCP_KEEPCNT</symbol> or an equivalent socket option (which does not include Windows);
1013 on other systems, it must be zero.
1014 In sessions connected via a Unix-domain socket, this parameter is
1015 ignored and always reads as zero.
1016 </para>
1017 </listitem>
1018 </varlistentry>
1020 <varlistentry id="guc-tcp-user-timeout" xreflabel="tcp_user_timeout">
1021 <term><varname>tcp_user_timeout</varname> (<type>integer</type>)
1022 <indexterm>
1023 <primary><varname>tcp_user_timeout</varname> configuration parameter</primary>
1024 </indexterm>
1025 </term>
1026 <listitem>
1027 <para>
1028 Specifies the amount of time that transmitted data may
1029 remain unacknowledged before the TCP connection is forcibly closed.
1030 If this value is specified without units, it is taken as milliseconds.
1031 A value of 0 (the default) selects the operating system's default.
1032 This parameter is supported only on systems that support
1033 <symbol>TCP_USER_TIMEOUT</symbol> (which does not include Windows); on other systems, it must be zero.
1034 In sessions connected via a Unix-domain socket, this parameter is
1035 ignored and always reads as zero.
1036 </para>
1037 </listitem>
1038 </varlistentry>
1040 <varlistentry id="guc-client-connection-check-interval" xreflabel="client_connection_check_interval">
1041 <term><varname>client_connection_check_interval</varname> (<type>integer</type>)
1042 <indexterm>
1043 <primary><varname>client_connection_check_interval</varname> configuration parameter</primary>
1044 </indexterm>
1045 </term>
1046 <listitem>
1047 <para>
1048 Sets the time interval between optional checks that the client is still
1049 connected, while running queries. The check is performed by polling
1050 the socket, and allows long running queries to be aborted sooner if
1051 the kernel reports that the connection is closed.
1052 </para>
1053 <para>
1054 This option relies on kernel events exposed by Linux, macOS, illumos
1055 and the BSD family of operating systems, and is not currently available
1056 on other systems.
1057 </para>
1058 <para>
1059 If the value is specified without units, it is taken as milliseconds.
1060 The default value is <literal>0</literal>, which disables connection
1061 checks. Without connection checks, the server will detect the loss of
1062 the connection only at the next interaction with the socket, when it
1063 waits for, receives or sends data.
1064 </para>
1065 <para>
1066 For the kernel itself to detect lost TCP connections reliably and within
1067 a known timeframe in all scenarios including network failure, it may
1068 also be necessary to adjust the TCP keepalive settings of the operating
1069 system, or the <xref linkend="guc-tcp-keepalives-idle"/>,
1070 <xref linkend="guc-tcp-keepalives-interval"/> and
1071 <xref linkend="guc-tcp-keepalives-count"/> settings of
1072 <productname>PostgreSQL</productname>.
1073 </para>
1074 </listitem>
1075 </varlistentry>
1077 </variablelist>
1078 </sect2>
1080 <sect2 id="runtime-config-connection-authentication">
1081 <title>Authentication</title>
1083 <variablelist>
1084 <varlistentry id="guc-authentication-timeout" xreflabel="authentication_timeout">
1085 <term><varname>authentication_timeout</varname> (<type>integer</type>)
1086 <indexterm><primary>timeout</primary><secondary>client authentication</secondary></indexterm>
1087 <indexterm><primary>client authentication</primary><secondary>timeout during</secondary></indexterm>
1088 <indexterm>
1089 <primary><varname>authentication_timeout</varname> configuration parameter</primary>
1090 </indexterm>
1091 </term>
1093 <listitem>
1094 <para>
1095 Maximum amount of time allowed to complete client authentication. If a
1096 would-be client has not completed the authentication protocol in
1097 this much time, the server closes the connection. This prevents
1098 hung clients from occupying a connection indefinitely.
1099 If this value is specified without units, it is taken as seconds.
1100 The default is one minute (<literal>1m</literal>).
1101 This parameter can only be set in the <filename>postgresql.conf</filename>
1102 file or on the server command line.
1103 </para>
1104 </listitem>
1105 </varlistentry>
1107 <varlistentry id="guc-password-encryption" xreflabel="password_encryption">
1108 <term><varname>password_encryption</varname> (<type>enum</type>)
1109 <indexterm>
1110 <primary><varname>password_encryption</varname> configuration parameter</primary>
1111 </indexterm>
1112 </term>
1113 <listitem>
1114 <para>
1115 When a password is specified in <xref linkend="sql-createrole"/> or
1116 <xref linkend="sql-alterrole"/>, this parameter determines the
1117 algorithm to use to encrypt the password. Possible values are
1118 <literal>scram-sha-256</literal>, which will encrypt the password with
1119 SCRAM-SHA-256, and <literal>md5</literal>, which stores the password
1120 as an MD5 hash. The default is <literal>scram-sha-256</literal>.
1121 </para>
1122 <para>
1123 Note that older clients might lack support for the SCRAM authentication
1124 mechanism, and hence not work with passwords encrypted with
1125 SCRAM-SHA-256. See <xref linkend="auth-password"/> for more details.
1126 </para>
1127 </listitem>
1128 </varlistentry>
1130 <varlistentry id="guc-scram-iterations" xreflabel="scram_iterations">
1131 <term><varname>scram_iterations</varname> (<type>integer</type>)
1132 <indexterm>
1133 <primary><varname>scram_iterations</varname> configuration parameter</primary>
1134 </indexterm>
1135 </term>
1136 <listitem>
1137 <para>
1138 The number of computational iterations to be performed when encrypting
1139 a password using SCRAM-SHA-256. The default is <literal>4096</literal>.
1140 A higher number of iterations provides additional protection against
1141 brute-force attacks on stored passwords, but makes authentication
1142 slower. Changing the value has no effect on existing passwords
1143 encrypted with SCRAM-SHA-256 as the iteration count is fixed at the
1144 time of encryption. In order to make use of a changed value, a new
1145 password must be set.
1146 </para>
1147 </listitem>
1148 </varlistentry>
1150 <varlistentry id="guc-krb-server-keyfile" xreflabel="krb_server_keyfile">
1151 <term><varname>krb_server_keyfile</varname> (<type>string</type>)
1152 <indexterm>
1153 <primary><varname>krb_server_keyfile</varname> configuration parameter</primary>
1154 </indexterm>
1155 </term>
1156 <listitem>
1157 <para>
1158 Sets the location of the server's Kerberos key file. The default is
1159 <filename>FILE:/usr/local/pgsql/etc/krb5.keytab</filename>
1160 (where the directory part is whatever was specified
1161 as <varname>sysconfdir</varname> at build time; use
1162 <literal>pg_config --sysconfdir</literal> to determine that).
1163 If this parameter is set to an empty string, it is ignored and a
1164 system-dependent default is used.
1165 This parameter can only be set in the
1166 <filename>postgresql.conf</filename> file or on the server command line.
1167 See <xref linkend="gssapi-auth"/> for more information.
1168 </para>
1169 </listitem>
1170 </varlistentry>
1172 <varlistentry id="guc-krb-caseins-users" xreflabel="krb_caseins_users">
1173 <term><varname>krb_caseins_users</varname> (<type>boolean</type>)
1174 <indexterm>
1175 <primary><varname>krb_caseins_users</varname> configuration parameter</primary>
1176 </indexterm>
1177 </term>
1178 <listitem>
1179 <para>
1180 Sets whether GSSAPI user names should be treated
1181 case-insensitively.
1182 The default is <literal>off</literal> (case sensitive). This parameter can only be
1183 set in the <filename>postgresql.conf</filename> file or on the server command line.
1184 </para>
1185 </listitem>
1186 </varlistentry>
1188 <varlistentry id="guc-gss-accept-delegation" xreflabel="gss_accept_delegation">
1189 <term><varname>gss_accept_delegation</varname> (<type>boolean</type>)
1190 <indexterm>
1191 <primary><varname>gss_accept_delegation</varname> configuration parameter</primary>
1192 </indexterm>
1193 </term>
1194 <listitem>
1195 <para>
1196 Sets whether GSSAPI delegation should be accepted from the client.
1197 The default is <literal>off</literal> meaning credentials from the client will
1198 <emphasis>not</emphasis> be accepted. Changing this to <literal>on</literal> will make the server
1199 accept credentials delegated to it from the client. This parameter can only be
1200 set in the <filename>postgresql.conf</filename> file or on the server command line.
1201 </para>
1202 </listitem>
1203 </varlistentry>
1204 </variablelist>
1205 </sect2>
1207 <sect2 id="runtime-config-connection-ssl">
1208 <title>SSL</title>
1210 <para>
1211 See <xref linkend="ssl-tcp"/> for more information about setting up
1212 <acronym>SSL</acronym>. The configuration parameters for controlling
1213 transfer encryption using <acronym>TLS</acronym> protocols are named
1214 <literal>ssl</literal> for historic reasons, even though support for
1215 the <acronym>SSL</acronym> protocol has been deprecated.
1216 <acronym>SSL</acronym> is in this context used interchangeably with
1217 <acronym>TLS</acronym>.
1218 </para>
1220 <variablelist>
1221 <varlistentry id="guc-ssl" xreflabel="ssl">
1222 <term><varname>ssl</varname> (<type>boolean</type>)
1223 <indexterm>
1224 <primary><varname>ssl</varname> configuration parameter</primary>
1225 </indexterm>
1226 </term>
1227 <listitem>
1228 <para>
1229 Enables <acronym>SSL</acronym> connections.
1230 This parameter can only be set in the <filename>postgresql.conf</filename>
1231 file or on the server command line.
1232 The default is <literal>off</literal>.
1233 </para>
1234 </listitem>
1235 </varlistentry>
1237 <varlistentry id="guc-ssl-ca-file" xreflabel="ssl_ca_file">
1238 <term><varname>ssl_ca_file</varname> (<type>string</type>)
1239 <indexterm>
1240 <primary><varname>ssl_ca_file</varname> configuration parameter</primary>
1241 </indexterm>
1242 </term>
1243 <listitem>
1244 <para>
1245 Specifies the name of the file containing the SSL server certificate
1246 authority (CA).
1247 Relative paths are relative to the data directory.
1248 This parameter can only be set in the <filename>postgresql.conf</filename>
1249 file or on the server command line.
1250 The default is empty, meaning no CA file is loaded,
1251 and client certificate verification is not performed.
1252 </para>
1253 </listitem>
1254 </varlistentry>
1256 <varlistentry id="guc-ssl-cert-file" xreflabel="ssl_cert_file">
1257 <term><varname>ssl_cert_file</varname> (<type>string</type>)
1258 <indexterm>
1259 <primary><varname>ssl_cert_file</varname> configuration parameter</primary>
1260 </indexterm>
1261 </term>
1262 <listitem>
1263 <para>
1264 Specifies the name of the file containing the SSL server certificate.
1265 Relative paths are relative to the data directory.
1266 This parameter can only be set in the <filename>postgresql.conf</filename>
1267 file or on the server command line.
1268 The default is <filename>server.crt</filename>.
1269 </para>
1270 </listitem>
1271 </varlistentry>
1273 <varlistentry id="guc-ssl-crl-file" xreflabel="ssl_crl_file">
1274 <term><varname>ssl_crl_file</varname> (<type>string</type>)
1275 <indexterm>
1276 <primary><varname>ssl_crl_file</varname> configuration parameter</primary>
1277 </indexterm>
1278 </term>
1279 <listitem>
1280 <para>
1281 Specifies the name of the file containing the SSL client certificate
1282 revocation list (CRL).
1283 Relative paths are relative to the data directory.
1284 This parameter can only be set in the <filename>postgresql.conf</filename>
1285 file or on the server command line.
1286 The default is empty, meaning no CRL file is loaded (unless
1287 <xref linkend="guc-ssl-crl-dir"/> is set).
1288 </para>
1289 </listitem>
1290 </varlistentry>
1292 <varlistentry id="guc-ssl-crl-dir" xreflabel="ssl_crl_dir">
1293 <term><varname>ssl_crl_dir</varname> (<type>string</type>)
1294 <indexterm>
1295 <primary><varname>ssl_crl_dir</varname> configuration parameter</primary>
1296 </indexterm>
1297 </term>
1298 <listitem>
1299 <para>
1300 Specifies the name of the directory containing the SSL client
1301 certificate revocation list (CRL). Relative paths are relative to the
1302 data directory. This parameter can only be set in
1303 the <filename>postgresql.conf</filename> file or on the server command
1304 line. The default is empty, meaning no CRLs are used (unless
1305 <xref linkend="guc-ssl-crl-file"/> is set).
1306 </para>
1308 <para>
1309 The directory needs to be prepared with the
1310 <productname>OpenSSL</productname> command
1311 <literal>openssl rehash</literal> or <literal>c_rehash</literal>. See
1312 its documentation for details.
1313 </para>
1315 <para>
1316 When using this setting, CRLs in the specified directory are loaded
1317 on-demand at connection time. New CRLs can be added to the directory
1318 and will be used immediately. This is unlike <xref
1319 linkend="guc-ssl-crl-file"/>, which causes the CRL in the file to be
1320 loaded at server start time or when the configuration is reloaded.
1321 Both settings can be used together.
1322 </para>
1323 </listitem>
1324 </varlistentry>
1326 <varlistentry id="guc-ssl-key-file" xreflabel="ssl_key_file">
1327 <term><varname>ssl_key_file</varname> (<type>string</type>)
1328 <indexterm>
1329 <primary><varname>ssl_key_file</varname> configuration parameter</primary>
1330 </indexterm>
1331 </term>
1332 <listitem>
1333 <para>
1334 Specifies the name of the file containing the SSL server private key.
1335 Relative paths are relative to the data directory.
1336 This parameter can only be set in the <filename>postgresql.conf</filename>
1337 file or on the server command line.
1338 The default is <filename>server.key</filename>.
1339 </para>
1340 </listitem>
1341 </varlistentry>
1343 <varlistentry id="guc-ssl-ciphers" xreflabel="ssl_ciphers">
1344 <term><varname>ssl_ciphers</varname> (<type>string</type>)
1345 <indexterm>
1346 <primary><varname>ssl_ciphers</varname> configuration parameter</primary>
1347 </indexterm>
1348 </term>
1349 <listitem>
1350 <para>
1351 Specifies a list of <acronym>SSL</acronym> cipher suites that are
1352 allowed to be used by SSL connections. See the
1353 <citerefentry><refentrytitle>ciphers</refentrytitle></citerefentry>
1354 manual page in the <productname>OpenSSL</productname> package for the
1355 syntax of this setting and a list of supported values. Only
1356 connections using TLS version 1.2 and lower are affected. There is
1357 currently no setting that controls the cipher choices used by TLS
1358 version 1.3 connections. The default value is
1359 <literal>HIGH:MEDIUM:+3DES:!aNULL</literal>. The default is usually a
1360 reasonable choice unless you have specific security requirements.
1361 </para>
1363 <para>
1364 This parameter can only be set in the
1365 <filename>postgresql.conf</filename> file or on the server command
1366 line.
1367 </para>
1369 <para>
1370 Explanation of the default value:
1371 <variablelist>
1372 <varlistentry id="guc-ssl-ciphers-high">
1373 <term><literal>HIGH</literal></term>
1374 <listitem>
1375 <para>
1376 Cipher suites that use ciphers from <literal>HIGH</literal> group (e.g.,
1377 AES, Camellia, 3DES)
1378 </para>
1379 </listitem>
1380 </varlistentry>
1382 <varlistentry id="guc-ssl-ciphers-medium">
1383 <term><literal>MEDIUM</literal></term>
1384 <listitem>
1385 <para>
1386 Cipher suites that use ciphers from <literal>MEDIUM</literal> group
1387 (e.g., RC4, SEED)
1388 </para>
1389 </listitem>
1390 </varlistentry>
1392 <varlistentry id="guc-ssl-ciphers-plus-3des">
1393 <term><literal>+3DES</literal></term>
1394 <listitem>
1395 <para>
1396 The <productname>OpenSSL</productname> default order for
1397 <literal>HIGH</literal> is problematic because it orders 3DES
1398 higher than AES128. This is wrong because 3DES offers less
1399 security than AES128, and it is also much slower.
1400 <literal>+3DES</literal> reorders it after all other
1401 <literal>HIGH</literal> and <literal>MEDIUM</literal> ciphers.
1402 </para>
1403 </listitem>
1404 </varlistentry>
1406 <varlistentry id="guc-ssl-ciphers-not-anull">
1407 <term><literal>!aNULL</literal></term>
1408 <listitem>
1409 <para>
1410 Disables anonymous cipher suites that do no authentication. Such
1411 cipher suites are vulnerable to <acronym>MITM</acronym> attacks and
1412 therefore should not be used.
1413 </para>
1414 </listitem>
1415 </varlistentry>
1416 </variablelist>
1417 </para>
1419 <para>
1420 Available cipher suite details will vary across
1421 <productname>OpenSSL</productname> versions. Use the command
1422 <literal>openssl ciphers -v 'HIGH:MEDIUM:+3DES:!aNULL'</literal> to
1423 see actual details for the currently installed
1424 <productname>OpenSSL</productname> version. Note that this list is
1425 filtered at run time based on the server key type.
1426 </para>
1427 </listitem>
1428 </varlistentry>
1430 <varlistentry id="guc-ssl-prefer-server-ciphers" xreflabel="ssl_prefer_server_ciphers">
1431 <term><varname>ssl_prefer_server_ciphers</varname> (<type>boolean</type>)
1432 <indexterm>
1433 <primary><varname>ssl_prefer_server_ciphers</varname> configuration parameter</primary>
1434 </indexterm>
1435 </term>
1436 <listitem>
1437 <para>
1438 Specifies whether to use the server's SSL cipher preferences, rather
1439 than the client's.
1440 This parameter can only be set in the <filename>postgresql.conf</filename>
1441 file or on the server command line.
1442 The default is <literal>on</literal>.
1443 </para>
1445 <para>
1446 <productname>PostgreSQL</productname> versions before 9.4 do not have
1447 this setting and always use the client's preferences. This setting is
1448 mainly for backward compatibility with those versions. Using the
1449 server's preferences is usually better because it is more likely that
1450 the server is appropriately configured.
1451 </para>
1452 </listitem>
1453 </varlistentry>
1455 <varlistentry id="guc-ssl-ecdh-curve" xreflabel="ssl_ecdh_curve">
1456 <term><varname>ssl_ecdh_curve</varname> (<type>string</type>)
1457 <indexterm>
1458 <primary><varname>ssl_ecdh_curve</varname> configuration parameter</primary>
1459 </indexterm>
1460 </term>
1461 <listitem>
1462 <para>
1463 Specifies the name of the curve to use in <acronym>ECDH</acronym> key
1464 exchange. It needs to be supported by all clients that connect.
1465 It does not need to be the same curve used by the server's Elliptic
1466 Curve key.
1467 This parameter can only be set in the <filename>postgresql.conf</filename>
1468 file or on the server command line.
1469 The default is <literal>prime256v1</literal>.
1470 </para>
1472 <para>
1473 <productname>OpenSSL</productname> names for the most common curves
1474 are:
1475 <literal>prime256v1</literal> (NIST P-256),
1476 <literal>secp384r1</literal> (NIST P-384),
1477 <literal>secp521r1</literal> (NIST P-521).
1478 The full list of available curves can be shown with the command
1479 <command>openssl ecparam -list_curves</command>. Not all of them
1480 are usable in <acronym>TLS</acronym> though.
1481 </para>
1482 </listitem>
1483 </varlistentry>
1485 <varlistentry id="guc-ssl-min-protocol-version" xreflabel="ssl_min_protocol_version">
1486 <term><varname>ssl_min_protocol_version</varname> (<type>enum</type>)
1487 <indexterm>
1488 <primary><varname>ssl_min_protocol_version</varname> configuration parameter</primary>
1489 </indexterm>
1490 </term>
1491 <listitem>
1492 <para>
1493 Sets the minimum SSL/TLS protocol version to use. Valid values are
1494 currently: <literal>TLSv1</literal>, <literal>TLSv1.1</literal>,
1495 <literal>TLSv1.2</literal>, <literal>TLSv1.3</literal>. Older
1496 versions of the <productname>OpenSSL</productname> library do not
1497 support all values; an error will be raised if an unsupported setting
1498 is chosen. Protocol versions before TLS 1.0, namely SSL version 2 and
1499 3, are always disabled.
1500 </para>
1502 <para>
1503 The default is <literal>TLSv1.2</literal>, which satisfies industry
1504 best practices as of this writing.
1505 </para>
1507 <para>
1508 This parameter can only be set in the <filename>postgresql.conf</filename>
1509 file or on the server command line.
1510 </para>
1511 </listitem>
1512 </varlistentry>
1514 <varlistentry id="guc-ssl-max-protocol-version" xreflabel="ssl_max_protocol_version">
1515 <term><varname>ssl_max_protocol_version</varname> (<type>enum</type>)
1516 <indexterm>
1517 <primary><varname>ssl_max_protocol_version</varname> configuration parameter</primary>
1518 </indexterm>
1519 </term>
1520 <listitem>
1521 <para>
1522 Sets the maximum SSL/TLS protocol version to use. Valid values are as
1523 for <xref linkend="guc-ssl-min-protocol-version"/>, with addition of
1524 an empty string, which allows any protocol version. The default is to
1525 allow any version. Setting the maximum protocol version is mainly
1526 useful for testing or if some component has issues working with a
1527 newer protocol.
1528 </para>
1530 <para>
1531 This parameter can only be set in the <filename>postgresql.conf</filename>
1532 file or on the server command line.
1533 </para>
1534 </listitem>
1535 </varlistentry>
1537 <varlistentry id="guc-ssl-dh-params-file" xreflabel="ssl_dh_params_file">
1538 <term><varname>ssl_dh_params_file</varname> (<type>string</type>)
1539 <indexterm>
1540 <primary><varname>ssl_dh_params_file</varname> configuration parameter</primary>
1541 </indexterm>
1542 </term>
1543 <listitem>
1544 <para>
1545 Specifies the name of the file containing Diffie-Hellman parameters
1546 used for so-called ephemeral DH family of SSL ciphers. The default is
1547 empty, in which case compiled-in default DH parameters used. Using
1548 custom DH parameters reduces the exposure if an attacker manages to
1549 crack the well-known compiled-in DH parameters. You can create your own
1550 DH parameters file with the command
1551 <command>openssl dhparam -out dhparams.pem 2048</command>.
1552 </para>
1554 <para>
1555 This parameter can only be set in the <filename>postgresql.conf</filename>
1556 file or on the server command line.
1557 </para>
1558 </listitem>
1559 </varlistentry>
1561 <varlistentry id="guc-ssl-passphrase-command" xreflabel="ssl_passphrase_command">
1562 <term><varname>ssl_passphrase_command</varname> (<type>string</type>)
1563 <indexterm>
1564 <primary><varname>ssl_passphrase_command</varname> configuration parameter</primary>
1565 </indexterm>
1566 </term>
1567 <listitem>
1568 <para>
1569 Sets an external command to be invoked when a passphrase for
1570 decrypting an SSL file such as a private key needs to be obtained. By
1571 default, this parameter is empty, which means the built-in prompting
1572 mechanism is used.
1573 </para>
1574 <para>
1575 The command must print the passphrase to the standard output and exit
1576 with code 0. In the parameter value, <literal>%p</literal> is
1577 replaced by a prompt string. (Write <literal>%%</literal> for a
1578 literal <literal>%</literal>.) Note that the prompt string will
1579 probably contain whitespace, so be sure to quote adequately. A single
1580 newline is stripped from the end of the output if present.
1581 </para>
1582 <para>
1583 The command does not actually have to prompt the user for a
1584 passphrase. It can read it from a file, obtain it from a keychain
1585 facility, or similar. It is up to the user to make sure the chosen
1586 mechanism is adequately secure.
1587 </para>
1588 <para>
1589 This parameter can only be set in the <filename>postgresql.conf</filename>
1590 file or on the server command line.
1591 </para>
1592 </listitem>
1593 </varlistentry>
1595 <varlistentry id="guc-ssl-passphrase-command-supports-reload" xreflabel="ssl_passphrase_command_supports_reload">
1596 <term><varname>ssl_passphrase_command_supports_reload</varname> (<type>boolean</type>)
1597 <indexterm>
1598 <primary><varname>ssl_passphrase_command_supports_reload</varname> configuration parameter</primary>
1599 </indexterm>
1600 </term>
1601 <listitem>
1602 <para>
1603 This parameter determines whether the passphrase command set by
1604 <varname>ssl_passphrase_command</varname> will also be called during a
1605 configuration reload if a key file needs a passphrase. If this
1606 parameter is off (the default), then
1607 <varname>ssl_passphrase_command</varname> will be ignored during a
1608 reload and the SSL configuration will not be reloaded if a passphrase
1609 is needed. That setting is appropriate for a command that requires a
1610 TTY for prompting, which might not be available when the server is
1611 running. Setting this parameter to on might be appropriate if the
1612 passphrase is obtained from a file, for example.
1613 </para>
1614 <para>
1615 This parameter can only be set in the <filename>postgresql.conf</filename>
1616 file or on the server command line.
1617 </para>
1618 </listitem>
1619 </varlistentry>
1620 </variablelist>
1621 </sect2>
1622 </sect1>
1624 <sect1 id="runtime-config-resource">
1625 <title>Resource Consumption</title>
1627 <sect2 id="runtime-config-resource-memory">
1628 <title>Memory</title>
1630 <variablelist>
1631 <varlistentry id="guc-shared-buffers" xreflabel="shared_buffers">
1632 <term><varname>shared_buffers</varname> (<type>integer</type>)
1633 <indexterm>
1634 <primary><varname>shared_buffers</varname> configuration parameter</primary>
1635 </indexterm>
1636 </term>
1637 <listitem>
1638 <para>
1639 Sets the amount of memory the database server uses for shared
1640 memory buffers. The default is typically 128 megabytes
1641 (<literal>128MB</literal>), but might be less if your kernel settings will
1642 not support it (as determined during <application>initdb</application>).
1643 This setting must be at least 128 kilobytes. However,
1644 settings significantly higher than the minimum are usually needed
1645 for good performance.
1646 If this value is specified without units, it is taken as blocks,
1647 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
1648 (Non-default values of <symbol>BLCKSZ</symbol> change the minimum
1649 value.)
1650 This parameter can only be set at server start.
1651 </para>
1653 <para>
1654 If you have a dedicated database server with 1GB or more of RAM, a
1655 reasonable starting value for <varname>shared_buffers</varname> is 25%
1656 of the memory in your system. There are some workloads where even
1657 larger settings for <varname>shared_buffers</varname> are effective, but
1658 because <productname>PostgreSQL</productname> also relies on the
1659 operating system cache, it is unlikely that an allocation of more than
1660 40% of RAM to <varname>shared_buffers</varname> will work better than a
1661 smaller amount. Larger settings for <varname>shared_buffers</varname>
1662 usually require a corresponding increase in
1663 <varname>max_wal_size</varname>, in order to spread out the
1664 process of writing large quantities of new or changed data over a
1665 longer period of time.
1666 </para>
1668 <para>
1669 On systems with less than 1GB of RAM, a smaller percentage of RAM is
1670 appropriate, so as to leave adequate space for the operating system.
1671 </para>
1673 </listitem>
1674 </varlistentry>
1676 <varlistentry id="guc-huge-pages" xreflabel="huge_pages">
1677 <term><varname>huge_pages</varname> (<type>enum</type>)
1678 <indexterm>
1679 <primary><varname>huge_pages</varname> configuration parameter</primary>
1680 </indexterm>
1681 </term>
1682 <listitem>
1683 <para>
1684 Controls whether huge pages are requested for the main shared memory
1685 area. Valid values are <literal>try</literal> (the default),
1686 <literal>on</literal>, and <literal>off</literal>. With
1687 <varname>huge_pages</varname> set to <literal>try</literal>, the
1688 server will try to request huge pages, but fall back to the default if
1689 that fails. With <literal>on</literal>, failure to request huge pages
1690 will prevent the server from starting up. With <literal>off</literal>,
1691 huge pages will not be requested. The actual state of huge pages is
1692 indicated by the server variable
1693 <xref linkend="guc-huge-pages-status"/>.
1694 </para>
1696 <para>
1697 At present, this setting is supported only on Linux and Windows. The
1698 setting is ignored on other systems when set to
1699 <literal>try</literal>. On Linux, it is only supported when
1700 <varname>shared_memory_type</varname> is set to <literal>mmap</literal>
1701 (the default).
1702 </para>
1704 <para>
1705 The use of huge pages results in smaller page tables and less CPU time
1706 spent on memory management, increasing performance. For more details about
1707 using huge pages on Linux, see <xref linkend="linux-huge-pages"/>.
1708 </para>
1710 <para>
1711 Huge pages are known as large pages on Windows. To use them, you need to
1712 assign the user right <quote>Lock pages in memory</quote> to the Windows user account
1713 that runs <productname>PostgreSQL</productname>.
1714 You can use Windows Group Policy tool (gpedit.msc) to assign the user right
1715 <quote>Lock pages in memory</quote>.
1716 To start the database server on the command prompt as a standalone process,
1717 not as a Windows service, the command prompt must be run as an administrator or
1718 User Access Control (UAC) must be disabled. When the UAC is enabled, the normal
1719 command prompt revokes the user right <quote>Lock pages in memory</quote> when started.
1720 </para>
1722 <para>
1723 Note that this setting only affects the main shared memory area.
1724 Operating systems such as Linux, FreeBSD, and Illumos can also use
1725 huge pages (also known as <quote>super</quote> pages or
1726 <quote>large</quote> pages) automatically for normal memory
1727 allocation, without an explicit request from
1728 <productname>PostgreSQL</productname>. On Linux, this is called
1729 <quote>transparent huge pages</quote><indexterm><primary>transparent
1730 huge pages</primary></indexterm> (THP). That feature has been known to
1731 cause performance degradation with
1732 <productname>PostgreSQL</productname> for some users on some Linux
1733 versions, so its use is currently discouraged (unlike explicit use of
1734 <varname>huge_pages</varname>).
1735 </para>
1736 </listitem>
1737 </varlistentry>
1739 <varlistentry id="guc-huge-page-size" xreflabel="huge_page_size">
1740 <term><varname>huge_page_size</varname> (<type>integer</type>)
1741 <indexterm>
1742 <primary><varname>huge_page_size</varname> configuration parameter</primary>
1743 </indexterm>
1744 </term>
1745 <listitem>
1746 <para>
1747 Controls the size of huge pages, when they are enabled with
1748 <xref linkend="guc-huge-pages"/>.
1749 The default is zero (<literal>0</literal>).
1750 When set to <literal>0</literal>, the default huge page size on the
1751 system will be used. This parameter can only be set at server start.
1752 </para>
1753 <para>
1754 Some commonly available page sizes on modern 64 bit server architectures include:
1755 <literal>2MB</literal> and <literal>1GB</literal> (Intel and AMD), <literal>16MB</literal> and
1756 <literal>16GB</literal> (IBM POWER), and <literal>64kB</literal>, <literal>2MB</literal>,
1757 <literal>32MB</literal> and <literal>1GB</literal> (ARM). For more information
1758 about usage and support, see <xref linkend="linux-huge-pages"/>.
1759 </para>
1760 <para>
1761 Non-default settings are currently supported only on Linux.
1762 </para>
1763 </listitem>
1764 </varlistentry>
1766 <varlistentry id="guc-temp-buffers" xreflabel="temp_buffers">
1767 <term><varname>temp_buffers</varname> (<type>integer</type>)
1768 <indexterm>
1769 <primary><varname>temp_buffers</varname> configuration parameter</primary>
1770 </indexterm>
1771 </term>
1772 <listitem>
1773 <para>
1774 Sets the maximum amount of memory used for temporary buffers within
1775 each database session. These are session-local buffers used only
1776 for access to temporary tables.
1777 If this value is specified without units, it is taken as blocks,
1778 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
1779 The default is eight megabytes (<literal>8MB</literal>).
1780 (If <symbol>BLCKSZ</symbol> is not 8kB, the default value scales
1781 proportionally to it.)
1782 This setting can be changed within individual
1783 sessions, but only before the first use of temporary tables
1784 within the session; subsequent attempts to change the value will
1785 have no effect on that session.
1786 </para>
1788 <para>
1789 A session will allocate temporary buffers as needed up to the limit
1790 given by <varname>temp_buffers</varname>. The cost of setting a large
1791 value in sessions that do not actually need many temporary
1792 buffers is only a buffer descriptor, or about 64 bytes, per
1793 increment in <varname>temp_buffers</varname>. However if a buffer is
1794 actually used an additional 8192 bytes will be consumed for it
1795 (or in general, <symbol>BLCKSZ</symbol> bytes).
1796 </para>
1797 </listitem>
1798 </varlistentry>
1800 <varlistentry id="guc-max-prepared-transactions" xreflabel="max_prepared_transactions">
1801 <term><varname>max_prepared_transactions</varname> (<type>integer</type>)
1802 <indexterm>
1803 <primary><varname>max_prepared_transactions</varname> configuration parameter</primary>
1804 </indexterm>
1805 </term>
1806 <listitem>
1807 <para>
1808 Sets the maximum number of transactions that can be in the
1809 <quote>prepared</quote> state simultaneously (see <xref
1810 linkend="sql-prepare-transaction"/>).
1811 Setting this parameter to zero (which is the default)
1812 disables the prepared-transaction feature.
1813 This parameter can only be set at server start.
1814 </para>
1816 <para>
1817 If you are not planning to use prepared transactions, this parameter
1818 should be set to zero to prevent accidental creation of prepared
1819 transactions. If you are using prepared transactions, you will
1820 probably want <varname>max_prepared_transactions</varname> to be at
1821 least as large as <xref linkend="guc-max-connections"/>, so that every
1822 session can have a prepared transaction pending.
1823 </para>
1825 <para>
1826 When running a standby server, you must set this parameter to the
1827 same or higher value than on the primary server. Otherwise, queries
1828 will not be allowed in the standby server.
1829 </para>
1830 </listitem>
1831 </varlistentry>
1833 <varlistentry id="guc-work-mem" xreflabel="work_mem">
1834 <term><varname>work_mem</varname> (<type>integer</type>)
1835 <indexterm>
1836 <primary><varname>work_mem</varname> configuration parameter</primary>
1837 </indexterm>
1838 </term>
1839 <listitem>
1840 <para>
1841 Sets the base maximum amount of memory to be used by a query operation
1842 (such as a sort or hash table) before writing to temporary disk files.
1843 If this value is specified without units, it is taken as kilobytes.
1844 The default value is four megabytes (<literal>4MB</literal>).
1845 Note that a complex query might perform several sort and hash
1846 operations at the same time, with each operation generally being
1847 allowed to use as much memory as this value specifies before
1848 it starts
1849 to write data into temporary files. Also, several running
1850 sessions could be doing such operations concurrently.
1851 Therefore, the total memory used could be many times the value
1852 of <varname>work_mem</varname>; it is necessary to keep this
1853 fact in mind when choosing the value. Sort operations are used
1854 for <literal>ORDER BY</literal>, <literal>DISTINCT</literal>,
1855 and merge joins.
1856 Hash tables are used in hash joins, hash-based aggregation, memoize
1857 nodes and hash-based processing of <literal>IN</literal> subqueries.
1858 </para>
1859 <para>
1860 Hash-based operations are generally more sensitive to memory
1861 availability than equivalent sort-based operations. The
1862 memory limit for a hash table is computed by multiplying
1863 <varname>work_mem</varname> by
1864 <varname>hash_mem_multiplier</varname>. This makes it
1865 possible for hash-based operations to use an amount of memory
1866 that exceeds the usual <varname>work_mem</varname> base
1867 amount.
1868 </para>
1869 </listitem>
1870 </varlistentry>
1872 <varlistentry id="guc-hash-mem-multiplier" xreflabel="hash_mem_multiplier">
1873 <term><varname>hash_mem_multiplier</varname> (<type>floating point</type>)
1874 <indexterm>
1875 <primary><varname>hash_mem_multiplier</varname> configuration parameter</primary>
1876 </indexterm>
1877 </term>
1878 <listitem>
1879 <para>
1880 Used to compute the maximum amount of memory that hash-based
1881 operations can use. The final limit is determined by
1882 multiplying <varname>work_mem</varname> by
1883 <varname>hash_mem_multiplier</varname>. The default value is
1884 2.0, which makes hash-based operations use twice the usual
1885 <varname>work_mem</varname> base amount.
1886 </para>
1887 <para>
1888 Consider increasing <varname>hash_mem_multiplier</varname> in
1889 environments where spilling by query operations is a regular
1890 occurrence, especially when simply increasing
1891 <varname>work_mem</varname> results in memory pressure (memory
1892 pressure typically takes the form of intermittent out of
1893 memory errors). The default setting of 2.0 is often effective with
1894 mixed workloads. Higher settings in the range of 2.0 - 8.0 or
1895 more may be effective in environments where
1896 <varname>work_mem</varname> has already been increased to 40MB
1897 or more.
1898 </para>
1899 </listitem>
1900 </varlistentry>
1902 <varlistentry id="guc-maintenance-work-mem" xreflabel="maintenance_work_mem">
1903 <term><varname>maintenance_work_mem</varname> (<type>integer</type>)
1904 <indexterm>
1905 <primary><varname>maintenance_work_mem</varname> configuration parameter</primary>
1906 </indexterm>
1907 </term>
1908 <listitem>
1909 <para>
1910 Specifies the maximum amount of memory to be used by maintenance
1911 operations, such as <command>VACUUM</command>, <command>CREATE
1912 INDEX</command>, and <command>ALTER TABLE ADD FOREIGN KEY</command>.
1913 If this value is specified without units, it is taken as kilobytes.
1914 It defaults
1915 to 64 megabytes (<literal>64MB</literal>). Since only one of these
1916 operations can be executed at a time by a database session, and
1917 an installation normally doesn't have many of them running
1918 concurrently, it's safe to set this value significantly larger
1919 than <varname>work_mem</varname>. Larger settings might improve
1920 performance for vacuuming and for restoring database dumps.
1921 </para>
1922 <para>
1923 Note that when autovacuum runs, up to
1924 <xref linkend="guc-autovacuum-max-workers"/> times this memory
1925 may be allocated, so be careful not to set the default value
1926 too high. It may be useful to control for this by separately
1927 setting <xref linkend="guc-autovacuum-work-mem"/>.
1928 </para>
1929 </listitem>
1930 </varlistentry>
1932 <varlistentry id="guc-autovacuum-work-mem" xreflabel="autovacuum_work_mem">
1933 <term><varname>autovacuum_work_mem</varname> (<type>integer</type>)
1934 <indexterm>
1935 <primary><varname>autovacuum_work_mem</varname> configuration parameter</primary>
1936 </indexterm>
1937 </term>
1938 <listitem>
1939 <para>
1940 Specifies the maximum amount of memory to be used by each
1941 autovacuum worker process.
1942 If this value is specified without units, it is taken as kilobytes.
1943 It defaults to -1, indicating that
1944 the value of <xref linkend="guc-maintenance-work-mem"/> should
1945 be used instead. The setting has no effect on the behavior of
1946 <command>VACUUM</command> when run in other contexts.
1947 This parameter can only be set in the
1948 <filename>postgresql.conf</filename> file or on the server command
1949 line.
1950 </para>
1951 </listitem>
1952 </varlistentry>
1954 <varlistentry id="guc-vacuum-buffer-usage-limit" xreflabel="vacuum_buffer_usage_limit">
1955 <term>
1956 <varname>vacuum_buffer_usage_limit</varname> (<type>integer</type>)
1957 <indexterm>
1958 <primary><varname>vacuum_buffer_usage_limit</varname> configuration parameter</primary>
1959 </indexterm>
1960 </term>
1961 <listitem>
1962 <para>
1963 Specifies the size of the
1964 <glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm>
1965 used by the <command>VACUUM</command> and <command>ANALYZE</command>
1966 commands. A setting of <literal>0</literal> will allow the operation
1967 to use any number of <varname>shared_buffers</varname>. Otherwise
1968 valid sizes range from <literal>128 kB</literal> to
1969 <literal>16 GB</literal>. If the specified size would exceed 1/8 the
1970 size of <varname>shared_buffers</varname>, the size is silently capped
1971 to that value. The default value is <literal>2MB</literal>. If
1972 this value is specified without units, it is taken as kilobytes. This
1973 parameter can be set at any time. It can be overridden for
1974 <xref linkend="sql-vacuum"/> and <xref linkend="sql-analyze"/>
1975 when passing the <option>BUFFER_USAGE_LIMIT</option> option. Higher
1976 settings can allow <command>VACUUM</command> and
1977 <command>ANALYZE</command> to run more quickly, but having too large a
1978 setting may cause too many other useful pages to be evicted from
1979 shared buffers.
1980 </para>
1981 </listitem>
1982 </varlistentry>
1984 <varlistentry id="guc-logical-decoding-work-mem" xreflabel="logical_decoding_work_mem">
1985 <term><varname>logical_decoding_work_mem</varname> (<type>integer</type>)
1986 <indexterm>
1987 <primary><varname>logical_decoding_work_mem</varname> configuration parameter</primary>
1988 </indexterm>
1989 </term>
1990 <listitem>
1991 <para>
1992 Specifies the maximum amount of memory to be used by logical decoding,
1993 before some of the decoded changes are written to local disk. This
1994 limits the amount of memory used by logical streaming replication
1995 connections. It defaults to 64 megabytes (<literal>64MB</literal>).
1996 Since each replication connection only uses a single buffer of this size,
1997 and an installation normally doesn't have many such connections
1998 concurrently (as limited by <varname>max_wal_senders</varname>), it's
1999 safe to set this value significantly higher than <varname>work_mem</varname>,
2000 reducing the amount of decoded changes written to disk.
2001 </para>
2002 </listitem>
2003 </varlistentry>
2005 <varlistentry id="guc-commit-timestamp-buffers" xreflabel="commit_timestamp_buffers">
2006 <term><varname>commit_timestamp_buffers</varname> (<type>integer</type>)
2007 <indexterm>
2008 <primary><varname>commit_timestamp_buffers</varname> configuration parameter</primary>
2009 </indexterm>
2010 </term>
2011 <listitem>
2012 <para>
2013 Specifies the amount of memory to use to cache the contents of
2014 <literal>pg_commit_ts</literal> (see
2015 <xref linkend="pgdata-contents-table"/>).
2016 If this value is specified without units, it is taken as blocks,
2017 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2018 The default value is <literal>0</literal>, which requests
2019 <varname>shared_buffers</varname>/512 up to 1024 blocks,
2020 but not fewer than 16 blocks.
2021 This parameter can only be set at server start.
2022 </para>
2023 </listitem>
2024 </varlistentry>
2026 <varlistentry id="guc-multixact-member-buffers" xreflabel="multixact_member_buffers">
2027 <term><varname>multixact_member_buffers</varname> (<type>integer</type>)
2028 <indexterm>
2029 <primary><varname>multixact_member_buffers</varname> configuration parameter</primary>
2030 </indexterm>
2031 </term>
2032 <listitem>
2033 <para>
2034 Specifies the amount of shared memory to use to cache the contents
2035 of <literal>pg_multixact/members</literal> (see
2036 <xref linkend="pgdata-contents-table"/>).
2037 If this value is specified without units, it is taken as blocks,
2038 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2039 The default value is <literal>32</literal>.
2040 This parameter can only be set at server start.
2041 </para>
2042 </listitem>
2043 </varlistentry>
2045 <varlistentry id="guc-multixact-offset-buffers" xreflabel="multixact_offset_buffers">
2046 <term><varname>multixact_offset_buffers</varname> (<type>integer</type>)
2047 <indexterm>
2048 <primary><varname>multixact_offset_buffers</varname> configuration parameter</primary>
2049 </indexterm>
2050 </term>
2051 <listitem>
2052 <para>
2053 Specifies the amount of shared memory to use to cache the contents
2054 of <literal>pg_multixact/offsets</literal> (see
2055 <xref linkend="pgdata-contents-table"/>).
2056 If this value is specified without units, it is taken as blocks,
2057 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2058 The default value is <literal>16</literal>.
2059 This parameter can only be set at server start.
2060 </para>
2061 </listitem>
2062 </varlistentry>
2064 <varlistentry id="guc-notify-buffers" xreflabel="notify_buffers">
2065 <term><varname>notify_buffers</varname> (<type>integer</type>)
2066 <indexterm>
2067 <primary><varname>notify_buffers</varname> configuration parameter</primary>
2068 </indexterm>
2069 </term>
2070 <listitem>
2071 <para>
2072 Specifies the amount of shared memory to use to cache the contents
2073 of <literal>pg_notify</literal> (see
2074 <xref linkend="pgdata-contents-table"/>).
2075 If this value is specified without units, it is taken as blocks,
2076 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2077 The default value is <literal>16</literal>.
2078 This parameter can only be set at server start.
2079 </para>
2080 </listitem>
2081 </varlistentry>
2083 <varlistentry id="guc-serializable-buffers" xreflabel="serializable_buffers">
2084 <term><varname>serializable_buffers</varname> (<type>integer</type>)
2085 <indexterm>
2086 <primary><varname>serializable_buffers</varname> configuration parameter</primary>
2087 </indexterm>
2088 </term>
2089 <listitem>
2090 <para>
2091 Specifies the amount of shared memory to use to cache the contents
2092 of <literal>pg_serial</literal> (see
2093 <xref linkend="pgdata-contents-table"/>).
2094 If this value is specified without units, it is taken as blocks,
2095 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2096 The default value is <literal>32</literal>.
2097 This parameter can only be set at server start.
2098 </para>
2099 </listitem>
2100 </varlistentry>
2102 <varlistentry id="guc-subtransaction-buffers" xreflabel="subtransaction_buffers">
2103 <term><varname>subtransaction_buffers</varname> (<type>integer</type>)
2104 <indexterm>
2105 <primary><varname>subtransaction_buffers</varname> configuration parameter</primary>
2106 </indexterm>
2107 </term>
2108 <listitem>
2109 <para>
2110 Specifies the amount of shared memory to use to cache the contents
2111 of <literal>pg_subtrans</literal> (see
2112 <xref linkend="pgdata-contents-table"/>).
2113 If this value is specified without units, it is taken as blocks,
2114 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2115 The default value is <literal>0</literal>, which requests
2116 <varname>shared_buffers</varname>/512 up to 1024 blocks,
2117 but not fewer than 16 blocks.
2118 This parameter can only be set at server start.
2119 </para>
2120 </listitem>
2121 </varlistentry>
2123 <varlistentry id="guc-transaction-buffers" xreflabel="transaction_buffers">
2124 <term><varname>transaction_buffers</varname> (<type>integer</type>)
2125 <indexterm>
2126 <primary><varname>transaction_buffers</varname> configuration parameter</primary>
2127 </indexterm>
2128 </term>
2129 <listitem>
2130 <para>
2131 Specifies the amount of shared memory to use to cache the contents
2132 of <literal>pg_xact</literal> (see
2133 <xref linkend="pgdata-contents-table"/>).
2134 If this value is specified without units, it is taken as blocks,
2135 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2136 The default value is <literal>0</literal>, which requests
2137 <varname>shared_buffers</varname>/512 up to 1024 blocks,
2138 but not fewer than 16 blocks.
2139 This parameter can only be set at server start.
2140 </para>
2141 </listitem>
2142 </varlistentry>
2144 <varlistentry id="guc-max-stack-depth" xreflabel="max_stack_depth">
2145 <term><varname>max_stack_depth</varname> (<type>integer</type>)
2146 <indexterm>
2147 <primary><varname>max_stack_depth</varname> configuration parameter</primary>
2148 </indexterm>
2149 </term>
2150 <listitem>
2151 <para>
2152 Specifies the maximum safe depth of the server's execution stack.
2153 The ideal setting for this parameter is the actual stack size limit
2154 enforced by the kernel (as set by <literal>ulimit -s</literal> or local
2155 equivalent), less a safety margin of a megabyte or so. The safety
2156 margin is needed because the stack depth is not checked in every
2157 routine in the server, but only in key potentially-recursive routines.
2158 If this value is specified without units, it is taken as kilobytes.
2159 The default setting is two megabytes (<literal>2MB</literal>), which
2160 is conservatively small and unlikely to risk crashes. However,
2161 it might be too small to allow execution of complex functions.
2162 Only superusers and users with the appropriate <literal>SET</literal>
2163 privilege can change this setting.
2164 </para>
2166 <para>
2167 Setting <varname>max_stack_depth</varname> higher than
2168 the actual kernel limit will mean that a runaway recursive function
2169 can crash an individual backend process. On platforms where
2170 <productname>PostgreSQL</productname> can determine the kernel limit,
2171 the server will not allow this variable to be set to an unsafe
2172 value. However, not all platforms provide the information,
2173 so caution is recommended in selecting a value.
2174 </para>
2175 </listitem>
2176 </varlistentry>
2178 <varlistentry id="guc-shared-memory-type" xreflabel="shared_memory_type">
2179 <term><varname>shared_memory_type</varname> (<type>enum</type>)
2180 <indexterm>
2181 <primary><varname>shared_memory_type</varname> configuration parameter</primary>
2182 </indexterm>
2183 </term>
2184 <listitem>
2185 <para>
2186 Specifies the shared memory implementation that the server
2187 should use for the main shared memory region that holds
2188 <productname>PostgreSQL</productname>'s shared buffers and other
2189 shared data. Possible values are <literal>mmap</literal> (for
2190 anonymous shared memory allocated using <function>mmap</function>),
2191 <literal>sysv</literal> (for System V shared memory allocated via
2192 <function>shmget</function>) and <literal>windows</literal> (for Windows
2193 shared memory). Not all values are supported on all platforms; the
2194 first supported option is the default for that platform. The use of
2195 the <literal>sysv</literal> option, which is not the default on any
2196 platform, is generally discouraged because it typically requires
2197 non-default kernel settings to allow for large allocations (see <xref
2198 linkend="sysvipc"/>).
2199 </para>
2200 </listitem>
2201 </varlistentry>
2203 <varlistentry id="guc-dynamic-shared-memory-type" xreflabel="dynamic_shared_memory_type">
2204 <term><varname>dynamic_shared_memory_type</varname> (<type>enum</type>)
2205 <indexterm>
2206 <primary><varname>dynamic_shared_memory_type</varname> configuration parameter</primary>
2207 </indexterm>
2208 </term>
2209 <listitem>
2210 <para>
2211 Specifies the dynamic shared memory implementation that the server
2212 should use. Possible values are <literal>posix</literal> (for POSIX shared
2213 memory allocated using <literal>shm_open</literal>), <literal>sysv</literal>
2214 (for System V shared memory allocated via <literal>shmget</literal>),
2215 <literal>windows</literal> (for Windows shared memory),
2216 and <literal>mmap</literal> (to simulate shared memory using
2217 memory-mapped files stored in the data directory).
2218 Not all values are supported on all platforms; the first supported
2219 option is usually the default for that platform. The use of the
2220 <literal>mmap</literal> option, which is not the default on any platform,
2221 is generally discouraged because the operating system may write
2222 modified pages back to disk repeatedly, increasing system I/O load;
2223 however, it may be useful for debugging, when the
2224 <literal>pg_dynshmem</literal> directory is stored on a RAM disk, or when
2225 other shared memory facilities are not available.
2226 </para>
2227 </listitem>
2228 </varlistentry>
2230 <varlistentry id="guc-min-dynamic-shared-memory" xreflabel="min_dynamic_shared_memory">
2231 <term><varname>min_dynamic_shared_memory</varname> (<type>integer</type>)
2232 <indexterm>
2233 <primary><varname>min_dynamic_shared_memory</varname> configuration parameter</primary>
2234 </indexterm>
2235 </term>
2236 <listitem>
2237 <para>
2238 Specifies the amount of memory that should be allocated at server
2239 startup for use by parallel queries. When this memory region is
2240 insufficient or exhausted by concurrent queries, new parallel queries
2241 try to allocate extra shared memory temporarily from the operating
2242 system using the method configured with
2243 <varname>dynamic_shared_memory_type</varname>, which may be slower due
2244 to memory management overheads. Memory that is allocated at startup
2245 with <varname>min_dynamic_shared_memory</varname> is affected by
2246 the <varname>huge_pages</varname> setting on operating systems where
2247 that is supported, and may be more likely to benefit from larger pages
2248 on operating systems where that is managed automatically.
2249 The default value is <literal>0</literal> (none). This parameter can
2250 only be set at server start.
2251 </para>
2252 </listitem>
2253 </varlistentry>
2255 </variablelist>
2256 </sect2>
2258 <sect2 id="runtime-config-resource-disk">
2259 <title>Disk</title>
2261 <variablelist>
2262 <varlistentry id="guc-temp-file-limit" xreflabel="temp_file_limit">
2263 <term><varname>temp_file_limit</varname> (<type>integer</type>)
2264 <indexterm>
2265 <primary><varname>temp_file_limit</varname> configuration parameter</primary>
2266 </indexterm>
2267 </term>
2268 <listitem>
2269 <para>
2270 Specifies the maximum amount of disk space that a process can use
2271 for temporary files, such as sort and hash temporary files, or the
2272 storage file for a held cursor. A transaction attempting to exceed
2273 this limit will be canceled.
2274 If this value is specified without units, it is taken as kilobytes.
2275 <literal>-1</literal> (the default) means no limit.
2276 Only superusers and users with the appropriate <literal>SET</literal>
2277 privilege can change this setting.
2278 </para>
2279 <para>
2280 This setting constrains the total space used at any instant by all
2281 temporary files used by a given <productname>PostgreSQL</productname> process.
2282 It should be noted that disk space used for explicit temporary
2283 tables, as opposed to temporary files used behind-the-scenes in query
2284 execution, does <emphasis>not</emphasis> count against this limit.
2285 </para>
2286 </listitem>
2287 </varlistentry>
2289 <varlistentry id="guc-max-notify-queue-pages" xreflabel="max_notify_queue_pages">
2290 <term><varname>max_notify_queue_pages</varname> (<type>integer</type>)
2291 <indexterm>
2292 <primary><varname>max_notify_queue_pages</varname> configuration parameter</primary>
2293 </indexterm>
2294 </term>
2295 <listitem>
2296 <para>
2297 Specifies the maximum amount of allocated pages for
2298 <xref linkend="sql-notify"/> / <xref linkend="sql-listen"/> queue.
2299 The default value is 1048576. For 8 KB pages it allows to consume
2300 up to 8 GB of disk space.
2301 </para>
2302 </listitem>
2303 </varlistentry>
2305 </variablelist>
2306 </sect2>
2308 <sect2 id="runtime-config-resource-kernel">
2309 <title>Kernel Resource Usage</title>
2311 <variablelist>
2312 <varlistentry id="guc-max-files-per-process" xreflabel="max_files_per_process">
2313 <term><varname>max_files_per_process</varname> (<type>integer</type>)
2314 <indexterm>
2315 <primary><varname>max_files_per_process</varname> configuration parameter</primary>
2316 </indexterm>
2317 </term>
2318 <listitem>
2319 <para>
2320 Sets the maximum number of simultaneously open files allowed to each
2321 server subprocess. The default is one thousand files. If the kernel is enforcing
2322 a safe per-process limit, you don't need to worry about this setting.
2323 But on some platforms (notably, most BSD systems), the kernel will
2324 allow individual processes to open many more files than the system
2325 can actually support if many processes all try to open
2326 that many files. If you find yourself seeing <quote>Too many open
2327 files</quote> failures, try reducing this setting.
2328 This parameter can only be set at server start.
2329 </para>
2330 </listitem>
2331 </varlistentry>
2332 </variablelist>
2333 </sect2>
2335 <sect2 id="runtime-config-resource-vacuum-cost">
2336 <title>Cost-based Vacuum Delay</title>
2338 <para>
2339 During the execution of <xref linkend="sql-vacuum"/>
2340 and <xref linkend="sql-analyze"/>
2341 commands, the system maintains an
2342 internal counter that keeps track of the estimated cost of the
2343 various I/O operations that are performed. When the accumulated
2344 cost reaches a limit (specified by
2345 <varname>vacuum_cost_limit</varname>), the process performing
2346 the operation will sleep for a short period of time, as specified by
2347 <varname>vacuum_cost_delay</varname>. Then it will reset the
2348 counter and continue execution.
2349 </para>
2351 <para>
2352 The intent of this feature is to allow administrators to reduce
2353 the I/O impact of these commands on concurrent database
2354 activity. There are many situations where it is not
2355 important that maintenance commands like
2356 <command>VACUUM</command> and <command>ANALYZE</command> finish
2357 quickly; however, it is usually very important that these
2358 commands do not significantly interfere with the ability of the
2359 system to perform other database operations. Cost-based vacuum
2360 delay provides a way for administrators to achieve this.
2361 </para>
2363 <para>
2364 This feature is disabled by default for manually issued
2365 <command>VACUUM</command> commands. To enable it, set the
2366 <varname>vacuum_cost_delay</varname> variable to a nonzero
2367 value.
2368 </para>
2370 <variablelist>
2371 <varlistentry id="guc-vacuum-cost-delay" xreflabel="vacuum_cost_delay">
2372 <term><varname>vacuum_cost_delay</varname> (<type>floating point</type>)
2373 <indexterm>
2374 <primary><varname>vacuum_cost_delay</varname> configuration parameter</primary>
2375 </indexterm>
2376 </term>
2377 <listitem>
2378 <para>
2379 The amount of time that the process will sleep
2380 when the cost limit has been exceeded.
2381 If this value is specified without units, it is taken as milliseconds.
2382 The default value is zero, which disables the cost-based vacuum
2383 delay feature. Positive values enable cost-based vacuuming.
2384 </para>
2386 <para>
2387 When using cost-based vacuuming, appropriate values for
2388 <varname>vacuum_cost_delay</varname> are usually quite small, perhaps
2389 less than 1 millisecond. While <varname>vacuum_cost_delay</varname>
2390 can be set to fractional-millisecond values, such delays may not be
2391 measured accurately on older platforms. On such platforms,
2392 increasing <command>VACUUM</command>'s throttled resource consumption
2393 above what you get at 1ms will require changing the other vacuum cost
2394 parameters. You should, nonetheless,
2395 keep <varname>vacuum_cost_delay</varname> as small as your platform
2396 will consistently measure; large delays are not helpful.
2397 </para>
2398 </listitem>
2399 </varlistentry>
2401 <varlistentry id="guc-vacuum-cost-page-hit" xreflabel="vacuum_cost_page_hit">
2402 <term><varname>vacuum_cost_page_hit</varname> (<type>integer</type>)
2403 <indexterm>
2404 <primary><varname>vacuum_cost_page_hit</varname> configuration parameter</primary>
2405 </indexterm>
2406 </term>
2407 <listitem>
2408 <para>
2409 The estimated cost for vacuuming a buffer found in the shared buffer
2410 cache. It represents the cost to lock the buffer pool, lookup
2411 the shared hash table and scan the content of the page. The
2412 default value is one.
2413 </para>
2414 </listitem>
2415 </varlistentry>
2417 <varlistentry id="guc-vacuum-cost-page-miss" xreflabel="vacuum_cost_page_miss">
2418 <term><varname>vacuum_cost_page_miss</varname> (<type>integer</type>)
2419 <indexterm>
2420 <primary><varname>vacuum_cost_page_miss</varname> configuration parameter</primary>
2421 </indexterm>
2422 </term>
2423 <listitem>
2424 <para>
2425 The estimated cost for vacuuming a buffer that has to be read from
2426 disk. This represents the effort to lock the buffer pool,
2427 lookup the shared hash table, read the desired block in from
2428 the disk and scan its content. The default value is 2.
2429 </para>
2430 </listitem>
2431 </varlistentry>
2433 <varlistentry id="guc-vacuum-cost-page-dirty" xreflabel="vacuum_cost_page_dirty">
2434 <term><varname>vacuum_cost_page_dirty</varname> (<type>integer</type>)
2435 <indexterm>
2436 <primary><varname>vacuum_cost_page_dirty</varname> configuration parameter</primary>
2437 </indexterm>
2438 </term>
2439 <listitem>
2440 <para>
2441 The estimated cost charged when vacuum modifies a block that was
2442 previously clean. It represents the extra I/O required to
2443 flush the dirty block out to disk again. The default value is
2445 </para>
2446 </listitem>
2447 </varlistentry>
2449 <varlistentry id="guc-vacuum-cost-limit" xreflabel="vacuum_cost_limit">
2450 <term><varname>vacuum_cost_limit</varname> (<type>integer</type>)
2451 <indexterm>
2452 <primary><varname>vacuum_cost_limit</varname> configuration parameter</primary>
2453 </indexterm>
2454 </term>
2455 <listitem>
2456 <para>
2457 This is the accumulated cost that will cause the vacuuming process to sleep
2458 for <varname>vacuum_cost_delay</varname>. The default is 200.
2459 </para>
2460 </listitem>
2461 </varlistentry>
2462 </variablelist>
2464 <note>
2465 <para>
2466 There are certain operations that hold critical locks and should
2467 therefore complete as quickly as possible. Cost-based vacuum
2468 delays do not occur during such operations. Therefore it is
2469 possible that the cost accumulates far higher than the specified
2470 limit. To avoid uselessly long delays in such cases, the actual
2471 delay is calculated as <varname>vacuum_cost_delay</varname> *
2472 <varname>accumulated_balance</varname> /
2473 <varname>vacuum_cost_limit</varname> with a maximum of
2474 <varname>vacuum_cost_delay</varname> * 4.
2475 </para>
2476 </note>
2477 </sect2>
2479 <sect2 id="runtime-config-resource-background-writer">
2480 <title>Background Writer</title>
2482 <para>
2483 There is a separate server
2484 process called the <firstterm>background writer</firstterm>, whose function
2485 is to issue writes of <quote>dirty</quote> (new or modified) shared
2486 buffers. When the number of clean shared buffers appears to be
2487 insufficient, the background writer writes some dirty buffers to the
2488 file system and marks them as clean. This reduces the likelihood
2489 that server processes handling user queries will be unable to find
2490 clean buffers and have to write dirty buffers themselves.
2491 However, the background writer does cause a net overall
2492 increase in I/O load, because while a repeatedly-dirtied page might
2493 otherwise be written only once per checkpoint interval, the
2494 background writer might write it several times as it is dirtied
2495 in the same interval. The parameters discussed in this subsection
2496 can be used to tune the behavior for local needs.
2497 </para>
2499 <variablelist>
2500 <varlistentry id="guc-bgwriter-delay" xreflabel="bgwriter_delay">
2501 <term><varname>bgwriter_delay</varname> (<type>integer</type>)
2502 <indexterm>
2503 <primary><varname>bgwriter_delay</varname> configuration parameter</primary>
2504 </indexterm>
2505 </term>
2506 <listitem>
2507 <para>
2508 Specifies the delay between activity rounds for the
2509 background writer. In each round the writer issues writes
2510 for some number of dirty buffers (controllable by the
2511 following parameters). It then sleeps for
2512 the length of <varname>bgwriter_delay</varname>, and repeats.
2513 When there are no dirty buffers in the
2514 buffer pool, though, it goes into a longer sleep regardless of
2515 <varname>bgwriter_delay</varname>.
2516 If this value is specified without units, it is taken as milliseconds.
2517 The default value is 200
2518 milliseconds (<literal>200ms</literal>). Note that on some systems, the
2519 effective resolution of sleep delays is 10 milliseconds; setting
2520 <varname>bgwriter_delay</varname> to a value that is not a multiple of 10
2521 might have the same results as setting it to the next higher multiple
2522 of 10. This parameter can only be set in the
2523 <filename>postgresql.conf</filename> file or on the server command line.
2524 </para>
2525 </listitem>
2526 </varlistentry>
2528 <varlistentry id="guc-bgwriter-lru-maxpages" xreflabel="bgwriter_lru_maxpages">
2529 <term><varname>bgwriter_lru_maxpages</varname> (<type>integer</type>)
2530 <indexterm>
2531 <primary><varname>bgwriter_lru_maxpages</varname> configuration parameter</primary>
2532 </indexterm>
2533 </term>
2534 <listitem>
2535 <para>
2536 In each round, no more than this many buffers will be written
2537 by the background writer. Setting this to zero disables
2538 background writing. (Note that checkpoints, which are managed by
2539 a separate, dedicated auxiliary process, are unaffected.)
2540 The default value is 100 buffers.
2541 This parameter can only be set in the <filename>postgresql.conf</filename>
2542 file or on the server command line.
2543 </para>
2544 </listitem>
2545 </varlistentry>
2547 <varlistentry id="guc-bgwriter-lru-multiplier" xreflabel="bgwriter_lru_multiplier">
2548 <term><varname>bgwriter_lru_multiplier</varname> (<type>floating point</type>)
2549 <indexterm>
2550 <primary><varname>bgwriter_lru_multiplier</varname> configuration parameter</primary>
2551 </indexterm>
2552 </term>
2553 <listitem>
2554 <para>
2555 The number of dirty buffers written in each round is based on the
2556 number of new buffers that have been needed by server processes
2557 during recent rounds. The average recent need is multiplied by
2558 <varname>bgwriter_lru_multiplier</varname> to arrive at an estimate of the
2559 number of buffers that will be needed during the next round. Dirty
2560 buffers are written until there are that many clean, reusable buffers
2561 available. (However, no more than <varname>bgwriter_lru_maxpages</varname>
2562 buffers will be written per round.)
2563 Thus, a setting of 1.0 represents a <quote>just in time</quote> policy
2564 of writing exactly the number of buffers predicted to be needed.
2565 Larger values provide some cushion against spikes in demand,
2566 while smaller values intentionally leave writes to be done by
2567 server processes.
2568 The default is 2.0.
2569 This parameter can only be set in the <filename>postgresql.conf</filename>
2570 file or on the server command line.
2571 </para>
2572 </listitem>
2573 </varlistentry>
2575 <varlistentry id="guc-bgwriter-flush-after" xreflabel="bgwriter_flush_after">
2576 <term><varname>bgwriter_flush_after</varname> (<type>integer</type>)
2577 <indexterm>
2578 <primary><varname>bgwriter_flush_after</varname> configuration parameter</primary>
2579 </indexterm>
2580 </term>
2581 <listitem>
2582 <para>
2583 Whenever more than this amount of data has
2584 been written by the background writer, attempt to force the OS to issue these
2585 writes to the underlying storage. Doing so will limit the amount of
2586 dirty data in the kernel's page cache, reducing the likelihood of
2587 stalls when an <function>fsync</function> is issued at the end of a checkpoint, or when
2588 the OS writes data back in larger batches in the background. Often
2589 that will result in greatly reduced transaction latency, but there
2590 also are some cases, especially with workloads that are bigger than
2591 <xref linkend="guc-shared-buffers"/>, but smaller than the OS's page
2592 cache, where performance might degrade. This setting may have no
2593 effect on some platforms.
2594 If this value is specified without units, it is taken as blocks,
2595 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2596 The valid range is between
2597 <literal>0</literal>, which disables forced writeback, and
2598 <literal>2MB</literal>. The default is <literal>512kB</literal> on Linux,
2599 <literal>0</literal> elsewhere. (If <symbol>BLCKSZ</symbol> is not 8kB,
2600 the default and maximum values scale proportionally to it.)
2601 This parameter can only be set in the <filename>postgresql.conf</filename>
2602 file or on the server command line.
2603 </para>
2604 </listitem>
2605 </varlistentry>
2606 </variablelist>
2608 <para>
2609 Smaller values of <varname>bgwriter_lru_maxpages</varname> and
2610 <varname>bgwriter_lru_multiplier</varname> reduce the extra I/O load
2611 caused by the background writer, but make it more likely that server
2612 processes will have to issue writes for themselves, delaying interactive
2613 queries.
2614 </para>
2615 </sect2>
2617 <sect2 id="runtime-config-resource-async-behavior">
2618 <title>Asynchronous Behavior</title>
2620 <variablelist>
2621 <varlistentry id="guc-backend-flush-after" xreflabel="backend_flush_after">
2622 <term><varname>backend_flush_after</varname> (<type>integer</type>)
2623 <indexterm>
2624 <primary><varname>backend_flush_after</varname> configuration parameter</primary>
2625 </indexterm>
2626 </term>
2627 <listitem>
2628 <para>
2629 Whenever more than this amount of data has
2630 been written by a single backend, attempt to force the OS to issue
2631 these writes to the underlying storage. Doing so will limit the
2632 amount of dirty data in the kernel's page cache, reducing the
2633 likelihood of stalls when an <function>fsync</function> is issued at the end of a
2634 checkpoint, or when the OS writes data back in larger batches in the
2635 background. Often that will result in greatly reduced transaction
2636 latency, but there also are some cases, especially with workloads
2637 that are bigger than <xref linkend="guc-shared-buffers"/>, but smaller
2638 than the OS's page cache, where performance might degrade. This
2639 setting may have no effect on some platforms.
2640 If this value is specified without units, it is taken as blocks,
2641 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
2642 The valid range is
2643 between <literal>0</literal>, which disables forced writeback,
2644 and <literal>2MB</literal>. The default is <literal>0</literal>, i.e., no
2645 forced writeback. (If <symbol>BLCKSZ</symbol> is not 8kB,
2646 the maximum value scales proportionally to it.)
2647 </para>
2648 </listitem>
2649 </varlistentry>
2651 <varlistentry id="guc-effective-io-concurrency" xreflabel="effective_io_concurrency">
2652 <term><varname>effective_io_concurrency</varname> (<type>integer</type>)
2653 <indexterm>
2654 <primary><varname>effective_io_concurrency</varname> configuration parameter</primary>
2655 </indexterm>
2656 </term>
2657 <listitem>
2658 <para>
2659 Sets the number of concurrent disk I/O operations that
2660 <productname>PostgreSQL</productname> expects can be executed
2661 simultaneously. Raising this value will increase the number of I/O
2662 operations that any individual <productname>PostgreSQL</productname> session
2663 attempts to initiate in parallel. The allowed range is 1 to 1000,
2664 or zero to disable issuance of asynchronous I/O requests. Currently,
2665 this setting only affects bitmap heap scans.
2666 </para>
2668 <para>
2669 For magnetic drives, a good starting point for this setting is the
2670 number of separate
2671 drives comprising a RAID 0 stripe or RAID 1 mirror being used for the
2672 database. (For RAID 5 the parity drive should not be counted.)
2673 However, if the database is often busy with multiple queries issued in
2674 concurrent sessions, lower values may be sufficient to keep the disk
2675 array busy. A value higher than needed to keep the disks busy will
2676 only result in extra CPU overhead.
2677 SSDs and other memory-based storage can often process many
2678 concurrent requests, so the best value might be in the hundreds.
2679 </para>
2681 <para>
2682 Asynchronous I/O requires that the operating system supports issuing
2683 read-ahead advice. If there is no operating system support then
2684 setting this parameter to anything but zero will result in an error.
2685 </para>
2687 <para>
2688 The default is 1 on supported systems, otherwise 0. This value can
2689 be overridden for tables in a particular tablespace by setting the
2690 tablespace parameter of the same name (see
2691 <xref linkend="sql-altertablespace"/>).
2692 </para>
2693 </listitem>
2694 </varlistentry>
2696 <varlistentry id="guc-maintenance-io-concurrency" xreflabel="maintenance_io_concurrency">
2697 <term><varname>maintenance_io_concurrency</varname> (<type>integer</type>)
2698 <indexterm>
2699 <primary><varname>maintenance_io_concurrency</varname> configuration parameter</primary>
2700 </indexterm>
2701 </term>
2702 <listitem>
2703 <para>
2704 Similar to <varname>effective_io_concurrency</varname>, but used
2705 for maintenance work that is done on behalf of many client sessions.
2706 </para>
2707 <para>
2708 The default is 10 on supported systems, otherwise 0. This value can
2709 be overridden for tables in a particular tablespace by setting the
2710 tablespace parameter of the same name (see
2711 <xref linkend="sql-altertablespace"/>).
2712 </para>
2713 </listitem>
2714 </varlistentry>
2716 <varlistentry id="guc-io-combine-limit" xreflabel="io_combine_limit">
2717 <term><varname>io_combine_limit</varname> (<type>integer</type>)
2718 <indexterm>
2719 <primary><varname>io_combine_limit</varname> configuration parameter</primary>
2720 </indexterm>
2721 </term>
2722 <listitem>
2723 <para>
2724 Controls the largest I/O size in operations that combine I/O.
2725 The default is 128kB.
2726 </para>
2727 </listitem>
2728 </varlistentry>
2730 <varlistentry id="guc-max-worker-processes" xreflabel="max_worker_processes">
2731 <term><varname>max_worker_processes</varname> (<type>integer</type>)
2732 <indexterm>
2733 <primary><varname>max_worker_processes</varname> configuration parameter</primary>
2734 </indexterm>
2735 </term>
2736 <listitem>
2737 <para>
2738 Sets the maximum number of background processes that the cluster
2739 can support. This parameter can only be set at server start. The
2740 default is 8.
2741 </para>
2743 <para>
2744 When running a standby server, you must set this parameter to the
2745 same or higher value than on the primary server. Otherwise, queries
2746 will not be allowed in the standby server.
2747 </para>
2749 <para>
2750 When changing this value, consider also adjusting
2751 <xref linkend="guc-max-parallel-workers"/>,
2752 <xref linkend="guc-max-parallel-maintenance-workers"/>, and
2753 <xref linkend="guc-max-parallel-workers-per-gather"/>.
2754 </para>
2755 </listitem>
2756 </varlistentry>
2758 <varlistentry id="guc-max-parallel-workers-per-gather" xreflabel="max_parallel_workers_per_gather">
2759 <term><varname>max_parallel_workers_per_gather</varname> (<type>integer</type>)
2760 <indexterm>
2761 <primary><varname>max_parallel_workers_per_gather</varname> configuration parameter</primary>
2762 </indexterm>
2763 </term>
2764 <listitem>
2765 <para>
2766 Sets the maximum number of workers that can be started by a single
2767 <literal>Gather</literal> or <literal>Gather Merge</literal> node.
2768 Parallel workers are taken from the pool of processes established by
2769 <xref linkend="guc-max-worker-processes"/>, limited by
2770 <xref linkend="guc-max-parallel-workers"/>. Note that the requested
2771 number of workers may not actually be available at run time. If this
2772 occurs, the plan will run with fewer workers than expected, which may
2773 be inefficient. The default value is 2. Setting this value to 0
2774 disables parallel query execution.
2775 </para>
2777 <para>
2778 Note that parallel queries may consume very substantially more
2779 resources than non-parallel queries, because each worker process is
2780 a completely separate process which has roughly the same impact on the
2781 system as an additional user session. This should be taken into
2782 account when choosing a value for this setting, as well as when
2783 configuring other settings that control resource utilization, such
2784 as <xref linkend="guc-work-mem"/>. Resource limits such as
2785 <varname>work_mem</varname> are applied individually to each worker,
2786 which means the total utilization may be much higher across all
2787 processes than it would normally be for any single process.
2788 For example, a parallel query using 4 workers may use up to 5 times
2789 as much CPU time, memory, I/O bandwidth, and so forth as a query which
2790 uses no workers at all.
2791 </para>
2793 <para>
2794 For more information on parallel query, see
2795 <xref linkend="parallel-query"/>.
2796 </para>
2797 </listitem>
2798 </varlistentry>
2800 <varlistentry id="guc-max-parallel-maintenance-workers" xreflabel="max_parallel_maintenance_workers">
2801 <term><varname>max_parallel_maintenance_workers</varname> (<type>integer</type>)
2802 <indexterm>
2803 <primary><varname>max_parallel_maintenance_workers</varname> configuration parameter</primary>
2804 </indexterm>
2805 </term>
2806 <listitem>
2807 <para>
2808 Sets the maximum number of parallel workers that can be
2809 started by a single utility command. Currently, the parallel
2810 utility commands that support the use of parallel workers are
2811 <command>CREATE INDEX</command> only when building a B-tree index,
2812 and <command>VACUUM</command> without <literal>FULL</literal>
2813 option. Parallel workers are taken from the pool of processes
2814 established by <xref linkend="guc-max-worker-processes"/>, limited
2815 by <xref linkend="guc-max-parallel-workers"/>. Note that the requested
2816 number of workers may not actually be available at run time.
2817 If this occurs, the utility operation will run with fewer
2818 workers than expected. The default value is 2. Setting this
2819 value to 0 disables the use of parallel workers by utility
2820 commands.
2821 </para>
2823 <para>
2824 Note that parallel utility commands should not consume
2825 substantially more memory than equivalent non-parallel
2826 operations. This strategy differs from that of parallel
2827 query, where resource limits generally apply per worker
2828 process. Parallel utility commands treat the resource limit
2829 <varname>maintenance_work_mem</varname> as a limit to be applied to
2830 the entire utility command, regardless of the number of
2831 parallel worker processes. However, parallel utility
2832 commands may still consume substantially more CPU resources
2833 and I/O bandwidth.
2834 </para>
2835 </listitem>
2836 </varlistentry>
2838 <varlistentry id="guc-max-parallel-workers" xreflabel="max_parallel_workers">
2839 <term><varname>max_parallel_workers</varname> (<type>integer</type>)
2840 <indexterm>
2841 <primary><varname>max_parallel_workers</varname> configuration parameter</primary>
2842 </indexterm>
2843 </term>
2844 <listitem>
2845 <para>
2846 Sets the maximum number of workers that the cluster can support for
2847 parallel operations. The default value is 8. When increasing or
2848 decreasing this value, consider also adjusting
2849 <xref linkend="guc-max-parallel-maintenance-workers"/> and
2850 <xref linkend="guc-max-parallel-workers-per-gather"/>.
2851 Also, note that a setting for this value which is higher than
2852 <xref linkend="guc-max-worker-processes"/> will have no effect,
2853 since parallel workers are taken from the pool of worker processes
2854 established by that setting.
2855 </para>
2856 </listitem>
2857 </varlistentry>
2859 <varlistentry id="guc-parallel-leader-participation" xreflabel="parallel_leader_participation">
2860 <term>
2861 <varname>parallel_leader_participation</varname> (<type>boolean</type>)
2862 <indexterm>
2863 <primary><varname>parallel_leader_participation</varname> configuration parameter</primary>
2864 </indexterm>
2865 </term>
2866 <listitem>
2867 <para>
2868 Allows the leader process to execute the query plan under
2869 <literal>Gather</literal> and <literal>Gather Merge</literal> nodes
2870 instead of waiting for worker processes. The default is
2871 <literal>on</literal>. Setting this value to <literal>off</literal>
2872 reduces the likelihood that workers will become blocked because the
2873 leader is not reading tuples fast enough, but requires the leader
2874 process to wait for worker processes to start up before the first
2875 tuples can be produced. The degree to which the leader can help or
2876 hinder performance depends on the plan type, number of workers and
2877 query duration.
2878 </para>
2879 </listitem>
2880 </varlistentry>
2881 </variablelist>
2882 </sect2>
2883 </sect1>
2885 <sect1 id="runtime-config-wal">
2886 <title>Write Ahead Log</title>
2888 <para>
2889 For additional information on tuning these settings,
2890 see <xref linkend="wal-configuration"/>.
2891 </para>
2893 <sect2 id="runtime-config-wal-settings">
2894 <title>Settings</title>
2895 <variablelist>
2897 <varlistentry id="guc-wal-level" xreflabel="wal_level">
2898 <term><varname>wal_level</varname> (<type>enum</type>)
2899 <indexterm>
2900 <primary><varname>wal_level</varname> configuration parameter</primary>
2901 </indexterm>
2902 </term>
2903 <listitem>
2904 <para>
2905 <varname>wal_level</varname> determines how much information is written to
2906 the WAL. The default value is <literal>replica</literal>, which writes enough
2907 data to support WAL archiving and replication, including running
2908 read-only queries on a standby server. <literal>minimal</literal> removes all
2909 logging except the information required to recover from a crash or
2910 immediate shutdown. Finally,
2911 <literal>logical</literal> adds information necessary to support logical
2912 decoding. Each level includes the information logged at all lower
2913 levels. This parameter can only be set at server start.
2914 </para>
2915 <para>
2916 The <literal>minimal</literal> level generates the least WAL
2917 volume. It logs no row information for permanent relations
2918 in transactions that create or
2919 rewrite them. This can make operations much faster (see
2920 <xref linkend="populate-pitr"/>). Operations that initiate this
2921 optimization include:
2922 <simplelist>
2923 <member><command>ALTER ... SET TABLESPACE</command></member>
2924 <member><command>CLUSTER</command></member>
2925 <member><command>CREATE TABLE</command></member>
2926 <member><command>REFRESH MATERIALIZED VIEW</command>
2927 (without <option>CONCURRENTLY</option>)</member>
2928 <member><command>REINDEX</command></member>
2929 <member><command>TRUNCATE</command></member>
2930 </simplelist>
2931 However, minimal WAL does not contain sufficient information for
2932 point-in-time recovery, so <literal>replica</literal> or
2933 higher must be used to enable continuous archiving
2934 (<xref linkend="guc-archive-mode"/>) and streaming binary replication.
2935 In fact, the server will not even start in this mode if
2936 <varname>max_wal_senders</varname> is non-zero.
2937 Note that changing <varname>wal_level</varname> to
2938 <literal>minimal</literal> makes previous base backups unusable
2939 for point-in-time recovery and standby servers.
2940 </para>
2941 <para>
2942 In <literal>logical</literal> level, the same information is logged as
2943 with <literal>replica</literal>, plus information needed to
2944 extract logical change sets from the WAL. Using a level of
2945 <literal>logical</literal> will increase the WAL volume, particularly if many
2946 tables are configured for <literal>REPLICA IDENTITY FULL</literal> and
2947 many <command>UPDATE</command> and <command>DELETE</command> statements are
2948 executed.
2949 </para>
2950 <para>
2951 In releases prior to 9.6, this parameter also allowed the
2952 values <literal>archive</literal> and <literal>hot_standby</literal>.
2953 These are still accepted but mapped to <literal>replica</literal>.
2954 </para>
2955 </listitem>
2956 </varlistentry>
2958 <varlistentry id="guc-fsync" xreflabel="fsync">
2959 <term><varname>fsync</varname> (<type>boolean</type>)
2960 <indexterm>
2961 <primary><varname>fsync</varname> configuration parameter</primary>
2962 </indexterm>
2963 </term>
2964 <listitem>
2965 <para>
2966 If this parameter is on, the <productname>PostgreSQL</productname> server
2967 will try to make sure that updates are physically written to
2968 disk, by issuing <function>fsync()</function> system calls or various
2969 equivalent methods (see <xref linkend="guc-wal-sync-method"/>).
2970 This ensures that the database cluster can recover to a
2971 consistent state after an operating system or hardware crash.
2972 </para>
2974 <para>
2975 While turning off <varname>fsync</varname> is often a performance
2976 benefit, this can result in unrecoverable data corruption in
2977 the event of a power failure or system crash. Thus it
2978 is only advisable to turn off <varname>fsync</varname> if
2979 you can easily recreate your entire database from external
2980 data.
2981 </para>
2983 <para>
2984 Examples of safe circumstances for turning off
2985 <varname>fsync</varname> include the initial loading of a new
2986 database cluster from a backup file, using a database cluster
2987 for processing a batch of data after which the database
2988 will be thrown away and recreated,
2989 or for a read-only database clone which
2990 gets recreated frequently and is not used for failover. High
2991 quality hardware alone is not a sufficient justification for
2992 turning off <varname>fsync</varname>.
2993 </para>
2995 <para>
2996 For reliable recovery when changing <varname>fsync</varname>
2997 off to on, it is necessary to force all modified buffers in the
2998 kernel to durable storage. This can be done while the cluster
2999 is shutdown or while <varname>fsync</varname> is on by running <command>initdb
3000 --sync-only</command>, running <command>sync</command>, unmounting the
3001 file system, or rebooting the server.
3002 </para>
3004 <para>
3005 In many situations, turning off <xref linkend="guc-synchronous-commit"/>
3006 for noncritical transactions can provide much of the potential
3007 performance benefit of turning off <varname>fsync</varname>, without
3008 the attendant risks of data corruption.
3009 </para>
3011 <para>
3012 <varname>fsync</varname> can only be set in the <filename>postgresql.conf</filename>
3013 file or on the server command line.
3014 If you turn this parameter off, also consider turning off
3015 <xref linkend="guc-full-page-writes"/>.
3016 </para>
3017 </listitem>
3018 </varlistentry>
3020 <varlistentry id="guc-synchronous-commit" xreflabel="synchronous_commit">
3021 <term><varname>synchronous_commit</varname> (<type>enum</type>)
3022 <indexterm>
3023 <primary><varname>synchronous_commit</varname> configuration parameter</primary>
3024 </indexterm>
3025 </term>
3026 <listitem>
3027 <para>
3028 Specifies how much WAL processing must complete before
3029 the database server returns a <quote>success</quote>
3030 indication to the client. Valid values are
3031 <literal>remote_apply</literal>, <literal>on</literal>
3032 (the default), <literal>remote_write</literal>,
3033 <literal>local</literal>, and <literal>off</literal>.
3034 </para>
3036 <para>
3037 If <varname>synchronous_standby_names</varname> is empty,
3038 the only meaningful settings are <literal>on</literal> and
3039 <literal>off</literal>; <literal>remote_apply</literal>,
3040 <literal>remote_write</literal> and <literal>local</literal>
3041 all provide the same local synchronization level
3042 as <literal>on</literal>. The local behavior of all
3043 non-<literal>off</literal> modes is to wait for local flush of WAL
3044 to disk. In <literal>off</literal> mode, there is no waiting,
3045 so there can be a delay between when success is reported to the
3046 client and when the transaction is later guaranteed to be safe
3047 against a server crash. (The maximum
3048 delay is three times <xref linkend="guc-wal-writer-delay"/>.) Unlike
3049 <xref linkend="guc-fsync"/>, setting this parameter to <literal>off</literal>
3050 does not create any risk of database inconsistency: an operating
3051 system or database crash might
3052 result in some recent allegedly-committed transactions being lost, but
3053 the database state will be just the same as if those transactions had
3054 been aborted cleanly. So, turning <varname>synchronous_commit</varname> off
3055 can be a useful alternative when performance is more important than
3056 exact certainty about the durability of a transaction. For more
3057 discussion see <xref linkend="wal-async-commit"/>.
3058 </para>
3060 <para>
3061 If <xref linkend="guc-synchronous-standby-names"/> is non-empty,
3062 <varname>synchronous_commit</varname> also controls whether
3063 transaction commits will wait for their WAL records to be
3064 processed on the standby server(s).
3065 </para>
3067 <para>
3068 When set to <literal>remote_apply</literal>, commits will wait
3069 until replies from the current synchronous standby(s) indicate they
3070 have received the commit record of the transaction and applied
3071 it, so that it has become visible to queries on the standby(s),
3072 and also written to durable storage on the standbys. This will
3073 cause much larger commit delays than previous settings since
3074 it waits for WAL replay. When set to <literal>on</literal>,
3075 commits wait until replies
3076 from the current synchronous standby(s) indicate they have received
3077 the commit record of the transaction and flushed it to durable storage. This
3078 ensures the transaction will not be lost unless both the primary and
3079 all synchronous standbys suffer corruption of their database storage.
3080 When set to <literal>remote_write</literal>, commits will wait until replies
3081 from the current synchronous standby(s) indicate they have
3082 received the commit record of the transaction and written it to
3083 their file systems. This setting ensures data preservation if a standby instance of
3084 <productname>PostgreSQL</productname> crashes, but not if the standby
3085 suffers an operating-system-level crash because the data has not
3086 necessarily reached durable storage on the standby.
3087 The setting <literal>local</literal> causes commits to wait for
3088 local flush to disk, but not for replication. This is usually not
3089 desirable when synchronous replication is in use, but is provided for
3090 completeness.
3091 </para>
3093 <para>
3094 This parameter can be changed at any time; the behavior for any
3095 one transaction is determined by the setting in effect when it
3096 commits. It is therefore possible, and useful, to have some
3097 transactions commit synchronously and others asynchronously.
3098 For example, to make a single multistatement transaction commit
3099 asynchronously when the default is the opposite, issue <command>SET
3100 LOCAL synchronous_commit TO OFF</command> within the transaction.
3101 </para>
3103 <para>
3104 <xref linkend="synchronous-commit-matrix"/> summarizes the
3105 capabilities of the <varname>synchronous_commit</varname> settings.
3106 </para>
3108 <table id="synchronous-commit-matrix">
3109 <title>synchronous_commit Modes</title>
3110 <tgroup cols="5">
3111 <colspec colname="col1" colwidth="1.5*"/>
3112 <colspec colname="col2" colwidth="1*"/>
3113 <colspec colname="col3" colwidth="1*"/>
3114 <colspec colname="col4" colwidth="1*"/>
3115 <colspec colname="col5" colwidth="1*"/>
3116 <thead>
3117 <row>
3118 <entry>synchronous_commit setting</entry>
3119 <entry>local durable commit</entry>
3120 <entry>standby durable commit after PG crash</entry>
3121 <entry>standby durable commit after OS crash</entry>
3122 <entry>standby query consistency</entry>
3123 </row>
3124 </thead>
3126 <tbody>
3128 <row>
3129 <entry>remote_apply</entry>
3130 <entry align="center">&bull;</entry>
3131 <entry align="center">&bull;</entry>
3132 <entry align="center">&bull;</entry>
3133 <entry align="center">&bull;</entry>
3134 </row>
3136 <row>
3137 <entry>on</entry>
3138 <entry align="center">&bull;</entry>
3139 <entry align="center">&bull;</entry>
3140 <entry align="center">&bull;</entry>
3141 <entry align="center"></entry>
3142 </row>
3144 <row>
3145 <entry>remote_write</entry>
3146 <entry align="center">&bull;</entry>
3147 <entry align="center">&bull;</entry>
3148 <entry align="center"></entry>
3149 <entry align="center"></entry>
3150 </row>
3152 <row>
3153 <entry>local</entry>
3154 <entry align="center">&bull;</entry>
3155 <entry align="center"></entry>
3156 <entry align="center"></entry>
3157 <entry align="center"></entry>
3158 </row>
3160 <row>
3161 <entry>off</entry>
3162 <entry align="center"></entry>
3163 <entry align="center"></entry>
3164 <entry align="center"></entry>
3165 <entry align="center"></entry>
3166 </row>
3168 </tbody>
3169 </tgroup>
3170 </table>
3172 </listitem>
3173 </varlistentry>
3175 <varlistentry id="guc-wal-sync-method" xreflabel="wal_sync_method">
3176 <term><varname>wal_sync_method</varname> (<type>enum</type>)
3177 <indexterm>
3178 <primary><varname>wal_sync_method</varname> configuration parameter</primary>
3179 </indexterm>
3180 </term>
3181 <listitem>
3182 <para>
3183 Method used for forcing WAL updates out to disk.
3184 If <varname>fsync</varname> is off then this setting is irrelevant,
3185 since WAL file updates will not be forced out at all.
3186 Possible values are:
3187 </para>
3188 <itemizedlist>
3189 <listitem>
3190 <para>
3191 <literal>open_datasync</literal> (write WAL files with <function>open()</function> option <symbol>O_DSYNC</symbol>)
3192 </para>
3193 </listitem>
3194 <listitem>
3195 <para>
3196 <literal>fdatasync</literal> (call <function>fdatasync()</function> at each commit)
3197 </para>
3198 </listitem>
3199 <listitem>
3200 <para>
3201 <literal>fsync</literal> (call <function>fsync()</function> at each commit)
3202 </para>
3203 </listitem>
3204 <listitem>
3205 <para>
3206 <literal>fsync_writethrough</literal> (call <function>fsync()</function> at each commit, forcing write-through of any disk write cache)
3207 </para>
3208 </listitem>
3209 <listitem>
3210 <para>
3211 <literal>open_sync</literal> (write WAL files with <function>open()</function> option <symbol>O_SYNC</symbol>)
3212 </para>
3213 </listitem>
3214 </itemizedlist>
3215 <para>
3216 Not all of these choices are available on all platforms.
3217 The default is the first method in the above list that is supported
3218 by the platform, except that <literal>fdatasync</literal> is the default on
3219 Linux and FreeBSD. The default is not necessarily ideal; it might be
3220 necessary to change this setting or other aspects of your system
3221 configuration in order to create a crash-safe configuration or
3222 achieve optimal performance.
3223 These aspects are discussed in <xref linkend="wal-reliability"/>.
3224 This parameter can only be set in the <filename>postgresql.conf</filename>
3225 file or on the server command line.
3226 </para>
3227 </listitem>
3228 </varlistentry>
3230 <varlistentry id="guc-full-page-writes" xreflabel="full_page_writes">
3231 <term><varname>full_page_writes</varname> (<type>boolean</type>)
3232 <indexterm>
3233 <primary><varname>full_page_writes</varname> configuration parameter</primary>
3234 </indexterm>
3235 </term>
3236 <listitem>
3237 <para>
3238 When this parameter is on, the <productname>PostgreSQL</productname> server
3239 writes the entire content of each disk page to WAL during the
3240 first modification of that page after a checkpoint.
3241 This is needed because
3242 a page write that is in process during an operating system crash might
3243 be only partially completed, leading to an on-disk page
3244 that contains a mix of old and new data. The row-level change data
3245 normally stored in WAL will not be enough to completely restore
3246 such a page during post-crash recovery. Storing the full page image
3247 guarantees that the page can be correctly restored, but at the price
3248 of increasing the amount of data that must be written to WAL.
3249 (Because WAL replay always starts from a checkpoint, it is sufficient
3250 to do this during the first change of each page after a checkpoint.
3251 Therefore, one way to reduce the cost of full-page writes is to
3252 increase the checkpoint interval parameters.)
3253 </para>
3255 <para>
3256 Turning this parameter off speeds normal operation, but
3257 might lead to either unrecoverable data corruption, or silent
3258 data corruption, after a system failure. The risks are similar to turning off
3259 <varname>fsync</varname>, though smaller, and it should be turned off
3260 only based on the same circumstances recommended for that parameter.
3261 </para>
3263 <para>
3264 Turning off this parameter does not affect use of
3265 WAL archiving for point-in-time recovery (PITR)
3266 (see <xref linkend="continuous-archiving"/>).
3267 </para>
3269 <para>
3270 This parameter can only be set in the <filename>postgresql.conf</filename>
3271 file or on the server command line.
3272 The default is <literal>on</literal>.
3273 </para>
3274 </listitem>
3275 </varlistentry>
3277 <varlistentry id="guc-wal-log-hints" xreflabel="wal_log_hints">
3278 <term><varname>wal_log_hints</varname> (<type>boolean</type>)
3279 <indexterm>
3280 <primary><varname>wal_log_hints</varname> configuration parameter</primary>
3281 </indexterm>
3282 </term>
3283 <listitem>
3284 <para>
3285 When this parameter is <literal>on</literal>, the <productname>PostgreSQL</productname>
3286 server writes the entire content of each disk page to WAL during the
3287 first modification of that page after a checkpoint, even for
3288 non-critical modifications of so-called hint bits.
3289 </para>
3291 <para>
3292 If data checksums are enabled, hint bit updates are always WAL-logged
3293 and this setting is ignored. You can use this setting to test how much
3294 extra WAL-logging would occur if your database had data checksums
3295 enabled.
3296 </para>
3298 <para>
3299 This parameter can only be set at server start. The default value is <literal>off</literal>.
3300 </para>
3301 </listitem>
3302 </varlistentry>
3304 <varlistentry id="guc-wal-compression" xreflabel="wal_compression">
3305 <term><varname>wal_compression</varname> (<type>enum</type>)
3306 <indexterm>
3307 <primary><varname>wal_compression</varname> configuration parameter</primary>
3308 </indexterm>
3309 </term>
3310 <listitem>
3311 <para>
3312 This parameter enables compression of WAL using the specified
3313 compression method.
3314 When enabled, the <productname>PostgreSQL</productname>
3315 server compresses full page images written to WAL when
3316 <xref linkend="guc-full-page-writes"/> is on or during a base backup.
3317 A compressed page image will be decompressed during WAL replay.
3318 The supported methods are <literal>pglz</literal>,
3319 <literal>lz4</literal> (if <productname>PostgreSQL</productname>
3320 was compiled with <option>--with-lz4</option>) and
3321 <literal>zstd</literal> (if <productname>PostgreSQL</productname>
3322 was compiled with <option>--with-zstd</option>).
3323 The default value is <literal>off</literal>.
3324 Only superusers and users with the appropriate <literal>SET</literal>
3325 privilege can change this setting.
3326 </para>
3328 <para>
3329 Enabling compression can reduce the WAL volume without
3330 increasing the risk of unrecoverable data corruption,
3331 but at the cost of some extra CPU spent on the compression during
3332 WAL logging and on the decompression during WAL replay.
3333 </para>
3334 </listitem>
3335 </varlistentry>
3337 <varlistentry id="guc-wal-init-zero" xreflabel="wal_init_zero">
3338 <term><varname>wal_init_zero</varname> (<type>boolean</type>)
3339 <indexterm>
3340 <primary><varname>wal_init_zero</varname> configuration parameter</primary>
3341 </indexterm>
3342 </term>
3343 <listitem>
3344 <para>
3345 If set to <literal>on</literal> (the default), this option causes new
3346 WAL files to be filled with zeroes. On some file systems, this ensures
3347 that space is allocated before we need to write WAL records. However,
3348 <firstterm>Copy-On-Write</firstterm> (COW) file systems may not benefit
3349 from this technique, so the option is given to skip the unnecessary
3350 work. If set to <literal>off</literal>, only the final byte is written
3351 when the file is created so that it has the expected size.
3352 </para>
3353 </listitem>
3354 </varlistentry>
3356 <varlistentry id="guc-wal-recycle" xreflabel="wal_recycle">
3357 <term><varname>wal_recycle</varname> (<type>boolean</type>)
3358 <indexterm>
3359 <primary><varname>wal_recycle</varname> configuration parameter</primary>
3360 </indexterm>
3361 </term>
3362 <listitem>
3363 <para>
3364 If set to <literal>on</literal> (the default), this option causes WAL
3365 files to be recycled by renaming them, avoiding the need to create new
3366 ones. On COW file systems, it may be faster to create new ones, so the
3367 option is given to disable this behavior.
3368 </para>
3369 </listitem>
3370 </varlistentry>
3372 <varlistentry id="guc-wal-buffers" xreflabel="wal_buffers">
3373 <term><varname>wal_buffers</varname> (<type>integer</type>)
3374 <indexterm>
3375 <primary><varname>wal_buffers</varname> configuration parameter</primary>
3376 </indexterm>
3377 </term>
3378 <listitem>
3379 <para>
3380 The amount of shared memory used for WAL data that has not yet been
3381 written to disk. The default setting of -1 selects a size equal to
3382 1/32nd (about 3%) of <xref linkend="guc-shared-buffers"/>, but not less
3383 than <literal>64kB</literal> nor more than the size of one WAL
3384 segment, typically <literal>16MB</literal>. This value can be set
3385 manually if the automatic choice is too large or too small,
3386 but any positive value less than <literal>32kB</literal> will be
3387 treated as <literal>32kB</literal>.
3388 If this value is specified without units, it is taken as WAL blocks,
3389 that is <symbol>XLOG_BLCKSZ</symbol> bytes, typically 8kB.
3390 This parameter can only be set at server start.
3391 </para>
3393 <para>
3394 The contents of the WAL buffers are written out to disk at every
3395 transaction commit, so extremely large values are unlikely to
3396 provide a significant benefit. However, setting this value to at
3397 least a few megabytes can improve write performance on a busy
3398 server where many clients are committing at once. The auto-tuning
3399 selected by the default setting of -1 should give reasonable
3400 results in most cases.
3401 </para>
3403 </listitem>
3404 </varlistentry>
3406 <varlistentry id="guc-wal-writer-delay" xreflabel="wal_writer_delay">
3407 <term><varname>wal_writer_delay</varname> (<type>integer</type>)
3408 <indexterm>
3409 <primary><varname>wal_writer_delay</varname> configuration parameter</primary>
3410 </indexterm>
3411 </term>
3412 <listitem>
3413 <para>
3414 Specifies how often the WAL writer flushes WAL, in time terms.
3415 After flushing WAL the writer sleeps for the length of time given
3416 by <varname>wal_writer_delay</varname>, unless woken up sooner
3417 by an asynchronously committing transaction. If the last flush
3418 happened less than <varname>wal_writer_delay</varname> ago and less
3419 than <varname>wal_writer_flush_after</varname> worth of WAL has been
3420 produced since, then WAL is only written to the operating system, not
3421 flushed to disk.
3422 If this value is specified without units, it is taken as milliseconds.
3423 The default value is 200 milliseconds (<literal>200ms</literal>). Note that
3424 on some systems, the effective resolution of sleep delays is 10
3425 milliseconds; setting <varname>wal_writer_delay</varname> to a value that is
3426 not a multiple of 10 might have the same results as setting it to the
3427 next higher multiple of 10. This parameter can only be set in the
3428 <filename>postgresql.conf</filename> file or on the server command line.
3429 </para>
3430 </listitem>
3431 </varlistentry>
3433 <varlistentry id="guc-wal-writer-flush-after" xreflabel="wal_writer_flush_after">
3434 <term><varname>wal_writer_flush_after</varname> (<type>integer</type>)
3435 <indexterm>
3436 <primary><varname>wal_writer_flush_after</varname> configuration parameter</primary>
3437 </indexterm>
3438 </term>
3439 <listitem>
3440 <para>
3441 Specifies how often the WAL writer flushes WAL, in volume terms.
3442 If the last flush happened less
3443 than <varname>wal_writer_delay</varname> ago and less
3444 than <varname>wal_writer_flush_after</varname> worth of WAL has been
3445 produced since, then WAL is only written to the operating system, not
3446 flushed to disk. If <varname>wal_writer_flush_after</varname> is set
3447 to <literal>0</literal> then WAL data is always flushed immediately.
3448 If this value is specified without units, it is taken as WAL blocks,
3449 that is <symbol>XLOG_BLCKSZ</symbol> bytes, typically 8kB.
3450 The default is <literal>1MB</literal>.
3451 This parameter can only be set in the
3452 <filename>postgresql.conf</filename> file or on the server command line.
3453 </para>
3454 </listitem>
3455 </varlistentry>
3457 <varlistentry id="guc-wal-skip-threshold" xreflabel="wal_skip_threshold">
3458 <term><varname>wal_skip_threshold</varname> (<type>integer</type>)
3459 <indexterm>
3460 <primary><varname>wal_skip_threshold</varname> configuration parameter</primary>
3461 </indexterm>
3462 </term>
3463 <listitem>
3464 <para>
3465 When <varname>wal_level</varname> is <literal>minimal</literal> and a
3466 transaction commits after creating or rewriting a permanent relation,
3467 this setting determines how to persist the new data. If the data is
3468 smaller than this setting, write it to the WAL log; otherwise, use an
3469 fsync of affected files. Depending on the properties of your storage,
3470 raising or lowering this value might help if such commits are slowing
3471 concurrent transactions. If this value is specified without units, it
3472 is taken as kilobytes. The default is two megabytes
3473 (<literal>2MB</literal>).
3474 </para>
3475 </listitem>
3476 </varlistentry>
3478 <varlistentry id="guc-commit-delay" xreflabel="commit_delay">
3479 <term><varname>commit_delay</varname> (<type>integer</type>)
3480 <indexterm>
3481 <primary><varname>commit_delay</varname> configuration parameter</primary>
3482 </indexterm>
3483 </term>
3484 <listitem>
3485 <para>
3486 Setting <varname>commit_delay</varname> adds a time delay
3487 before a WAL flush is initiated. This can improve
3488 group commit throughput by allowing a larger number of transactions
3489 to commit via a single WAL flush, if system load is high enough
3490 that additional transactions become ready to commit within the
3491 given interval. However, it also increases latency by up to the
3492 <varname>commit_delay</varname> for each WAL
3493 flush. Because the delay is just wasted if no other transactions
3494 become ready to commit, a delay is only performed if at least
3495 <varname>commit_siblings</varname> other transactions are active
3496 when a flush is about to be initiated. Also, no delays are
3497 performed if <varname>fsync</varname> is disabled.
3498 If this value is specified without units, it is taken as microseconds.
3499 The default <varname>commit_delay</varname> is zero (no delay).
3500 Only superusers and users with the appropriate <literal>SET</literal>
3501 privilege can change this setting.
3502 </para>
3503 <para>
3504 In <productname>PostgreSQL</productname> releases prior to 9.3,
3505 <varname>commit_delay</varname> behaved differently and was much
3506 less effective: it affected only commits, rather than all WAL flushes,
3507 and waited for the entire configured delay even if the WAL flush
3508 was completed sooner. Beginning in <productname>PostgreSQL</productname> 9.3,
3509 the first process that becomes ready to flush waits for the configured
3510 interval, while subsequent processes wait only until the leader
3511 completes the flush operation.
3512 </para>
3513 </listitem>
3514 </varlistentry>
3516 <varlistentry id="guc-commit-siblings" xreflabel="commit_siblings">
3517 <term><varname>commit_siblings</varname> (<type>integer</type>)
3518 <indexterm>
3519 <primary><varname>commit_siblings</varname> configuration parameter</primary>
3520 </indexterm>
3521 </term>
3522 <listitem>
3523 <para>
3524 Minimum number of concurrent open transactions to require
3525 before performing the <varname>commit_delay</varname> delay. A larger
3526 value makes it more probable that at least one other
3527 transaction will become ready to commit during the delay
3528 interval. The default is five transactions.
3529 </para>
3530 </listitem>
3531 </varlistentry>
3533 </variablelist>
3534 </sect2>
3535 <sect2 id="runtime-config-wal-checkpoints">
3536 <title>Checkpoints</title>
3538 <variablelist>
3539 <varlistentry id="guc-checkpoint-timeout" xreflabel="checkpoint_timeout">
3540 <term><varname>checkpoint_timeout</varname> (<type>integer</type>)
3541 <indexterm>
3542 <primary><varname>checkpoint_timeout</varname> configuration parameter</primary>
3543 </indexterm>
3544 </term>
3545 <listitem>
3546 <para>
3547 Maximum time between automatic WAL checkpoints.
3548 If this value is specified without units, it is taken as seconds.
3549 The valid range is between 30 seconds and one day.
3550 The default is five minutes (<literal>5min</literal>).
3551 Increasing this parameter can increase the amount of time needed
3552 for crash recovery.
3553 This parameter can only be set in the <filename>postgresql.conf</filename>
3554 file or on the server command line.
3555 </para>
3556 </listitem>
3557 </varlistentry>
3559 <varlistentry id="guc-checkpoint-completion-target" xreflabel="checkpoint_completion_target">
3560 <term><varname>checkpoint_completion_target</varname> (<type>floating point</type>)
3561 <indexterm>
3562 <primary><varname>checkpoint_completion_target</varname> configuration parameter</primary>
3563 </indexterm>
3564 </term>
3565 <listitem>
3566 <para>
3567 Specifies the target of checkpoint completion, as a fraction of
3568 total time between checkpoints. The default is 0.9, which spreads the
3569 checkpoint across almost all of the available interval, providing fairly
3570 consistent I/O load while also leaving some time for checkpoint
3571 completion overhead. Reducing this parameter is not recommended because
3572 it causes the checkpoint to complete faster. This results in a higher
3573 rate of I/O during the checkpoint followed by a period of less I/O between
3574 the checkpoint completion and the next scheduled checkpoint. This
3575 parameter can only be set in the <filename>postgresql.conf</filename> file
3576 or on the server command line.
3577 </para>
3578 </listitem>
3579 </varlistentry>
3581 <varlistentry id="guc-checkpoint-flush-after" xreflabel="checkpoint_flush_after">
3582 <term><varname>checkpoint_flush_after</varname> (<type>integer</type>)
3583 <indexterm>
3584 <primary><varname>checkpoint_flush_after</varname> configuration parameter</primary>
3585 </indexterm>
3586 </term>
3587 <listitem>
3588 <para>
3589 Whenever more than this amount of data has been
3590 written while performing a checkpoint, attempt to force the
3591 OS to issue these writes to the underlying storage. Doing so will
3592 limit the amount of dirty data in the kernel's page cache, reducing
3593 the likelihood of stalls when an <function>fsync</function> is issued at the end of the
3594 checkpoint, or when the OS writes data back in larger batches in the
3595 background. Often that will result in greatly reduced transaction
3596 latency, but there also are some cases, especially with workloads
3597 that are bigger than <xref linkend="guc-shared-buffers"/>, but smaller
3598 than the OS's page cache, where performance might degrade. This
3599 setting may have no effect on some platforms.
3600 If this value is specified without units, it is taken as blocks,
3601 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
3602 The valid range is
3603 between <literal>0</literal>, which disables forced writeback,
3604 and <literal>2MB</literal>. The default is <literal>256kB</literal> on
3605 Linux, <literal>0</literal> elsewhere. (If <symbol>BLCKSZ</symbol> is not
3606 8kB, the default and maximum values scale proportionally to it.)
3607 This parameter can only be set in the <filename>postgresql.conf</filename>
3608 file or on the server command line.
3609 </para>
3610 </listitem>
3611 </varlistentry>
3613 <varlistentry id="guc-checkpoint-warning" xreflabel="checkpoint_warning">
3614 <term><varname>checkpoint_warning</varname> (<type>integer</type>)
3615 <indexterm>
3616 <primary><varname>checkpoint_warning</varname> configuration parameter</primary>
3617 </indexterm>
3618 </term>
3619 <listitem>
3620 <para>
3621 Write a message to the server log if checkpoints caused by
3622 the filling of WAL segment files happen closer together
3623 than this amount of time (which suggests that
3624 <varname>max_wal_size</varname> ought to be raised).
3625 If this value is specified without units, it is taken as seconds.
3626 The default is 30 seconds (<literal>30s</literal>).
3627 Zero disables the warning.
3628 No warnings will be generated if <varname>checkpoint_timeout</varname>
3629 is less than <varname>checkpoint_warning</varname>.
3630 This parameter can only be set in the <filename>postgresql.conf</filename>
3631 file or on the server command line.
3632 </para>
3633 </listitem>
3634 </varlistentry>
3636 <varlistentry id="guc-max-wal-size" xreflabel="max_wal_size">
3637 <term><varname>max_wal_size</varname> (<type>integer</type>)
3638 <indexterm>
3639 <primary><varname>max_wal_size</varname> configuration parameter</primary>
3640 </indexterm>
3641 </term>
3642 <listitem>
3643 <para>
3644 Maximum size to let the WAL grow during automatic
3645 checkpoints. This is a soft limit; WAL size can exceed
3646 <varname>max_wal_size</varname> under special circumstances, such as
3647 heavy load, a failing <varname>archive_command</varname> or <varname>archive_library</varname>, or a high
3648 <varname>wal_keep_size</varname> setting.
3649 If this value is specified without units, it is taken as megabytes.
3650 The default is 1 GB.
3651 Increasing this parameter can increase the amount of time needed for
3652 crash recovery.
3653 This parameter can only be set in the <filename>postgresql.conf</filename>
3654 file or on the server command line.
3655 </para>
3656 </listitem>
3657 </varlistentry>
3659 <varlistentry id="guc-min-wal-size" xreflabel="min_wal_size">
3660 <term><varname>min_wal_size</varname> (<type>integer</type>)
3661 <indexterm>
3662 <primary><varname>min_wal_size</varname> configuration parameter</primary>
3663 </indexterm>
3664 </term>
3665 <listitem>
3666 <para>
3667 As long as WAL disk usage stays below this setting, old WAL files are
3668 always recycled for future use at a checkpoint, rather than removed.
3669 This can be used to ensure that enough WAL space is reserved to
3670 handle spikes in WAL usage, for example when running large batch
3671 jobs.
3672 If this value is specified without units, it is taken as megabytes.
3673 The default is 80 MB.
3674 This parameter can only be set in the <filename>postgresql.conf</filename>
3675 file or on the server command line.
3676 </para>
3677 </listitem>
3678 </varlistentry>
3680 </variablelist>
3681 </sect2>
3682 <sect2 id="runtime-config-wal-archiving">
3683 <title>Archiving</title>
3685 <variablelist>
3686 <varlistentry id="guc-archive-mode" xreflabel="archive_mode">
3687 <term><varname>archive_mode</varname> (<type>enum</type>)
3688 <indexterm>
3689 <primary><varname>archive_mode</varname> configuration parameter</primary>
3690 </indexterm>
3691 </term>
3692 <listitem>
3693 <para>
3694 When <varname>archive_mode</varname> is enabled, completed WAL segments
3695 are sent to archive storage by setting
3696 <xref linkend="guc-archive-command"/> or
3697 <xref linkend="guc-archive-library"/>. In addition to <literal>off</literal>,
3698 to disable, there are two modes: <literal>on</literal>, and
3699 <literal>always</literal>. During normal operation, there is no
3700 difference between the two modes, but when set to <literal>always</literal>
3701 the WAL archiver is enabled also during archive recovery or standby
3702 mode. In <literal>always</literal> mode, all files restored from the archive
3703 or streamed with streaming replication will be archived (again). See
3704 <xref linkend="continuous-archiving-in-standby"/> for details.
3705 </para>
3706 <para>
3707 <varname>archive_mode</varname> is a separate setting from
3708 <varname>archive_command</varname> and
3709 <varname>archive_library</varname> so that
3710 <varname>archive_command</varname> and
3711 <varname>archive_library</varname> can be changed without leaving
3712 archiving mode.
3713 This parameter can only be set at server start.
3714 <varname>archive_mode</varname> cannot be enabled when
3715 <varname>wal_level</varname> is set to <literal>minimal</literal>.
3716 </para>
3717 </listitem>
3718 </varlistentry>
3720 <varlistentry id="guc-archive-command" xreflabel="archive_command">
3721 <term><varname>archive_command</varname> (<type>string</type>)
3722 <indexterm>
3723 <primary><varname>archive_command</varname> configuration parameter</primary>
3724 </indexterm>
3725 </term>
3726 <listitem>
3727 <para>
3728 The local shell command to execute to archive a completed WAL file
3729 segment. Any <literal>%p</literal> in the string is
3730 replaced by the path name of the file to archive, and any
3731 <literal>%f</literal> is replaced by only the file name.
3732 (The path name is relative to the working directory of the server,
3733 i.e., the cluster's data directory.)
3734 Use <literal>%%</literal> to embed an actual <literal>%</literal> character in the
3735 command. It is important for the command to return a zero
3736 exit status only if it succeeds. For more information see
3737 <xref linkend="backup-archiving-wal"/>.
3738 </para>
3739 <para>
3740 This parameter can only be set in the <filename>postgresql.conf</filename>
3741 file or on the server command line. It is only used if
3742 <varname>archive_mode</varname> was enabled at server start and
3743 <varname>archive_library</varname> is set to an empty string. If both
3744 <varname>archive_command</varname> and <varname>archive_library</varname>
3745 are set, an error will be raised.
3746 If <varname>archive_command</varname> is an empty string (the default) while
3747 <varname>archive_mode</varname> is enabled (and <varname>archive_library</varname>
3748 is set to an empty string), WAL archiving is temporarily
3749 disabled, but the server continues to accumulate WAL segment files in
3750 the expectation that a command will soon be provided. Setting
3751 <varname>archive_command</varname> to a command that does nothing but
3752 return true, e.g., <literal>/bin/true</literal> (<literal>REM</literal> on
3753 Windows), effectively disables
3754 archiving, but also breaks the chain of WAL files needed for
3755 archive recovery, so it should only be used in unusual circumstances.
3756 </para>
3757 </listitem>
3758 </varlistentry>
3760 <varlistentry id="guc-archive-library" xreflabel="archive_library">
3761 <term><varname>archive_library</varname> (<type>string</type>)
3762 <indexterm>
3763 <primary><varname>archive_library</varname> configuration parameter</primary>
3764 </indexterm>
3765 </term>
3766 <listitem>
3767 <para>
3768 The library to use for archiving completed WAL file segments. If set to
3769 an empty string (the default), archiving via shell is enabled, and
3770 <xref linkend="guc-archive-command"/> is used. If both
3771 <varname>archive_command</varname> and <varname>archive_library</varname>
3772 are set, an error will be raised. Otherwise, the specified
3773 shared library is used for archiving. The WAL archiver process is
3774 restarted by the postmaster when this parameter changes. For more
3775 information, see <xref linkend="backup-archiving-wal"/> and
3776 <xref linkend="archive-modules"/>.
3777 </para>
3778 <para>
3779 This parameter can only be set in the
3780 <filename>postgresql.conf</filename> file or on the server command line.
3781 </para>
3782 </listitem>
3783 </varlistentry>
3785 <varlistentry id="guc-archive-timeout" xreflabel="archive_timeout">
3786 <term><varname>archive_timeout</varname> (<type>integer</type>)
3787 <indexterm>
3788 <primary><varname>archive_timeout</varname> configuration parameter</primary>
3789 </indexterm>
3790 </term>
3791 <listitem>
3792 <para>
3793 The <xref linkend="guc-archive-command"/> or <xref linkend="guc-archive-library"/> is only invoked for
3794 completed WAL segments. Hence, if your server generates little WAL
3795 traffic (or has slack periods where it does so), there could be a
3796 long delay between the completion of a transaction and its safe
3797 recording in archive storage. To limit how old unarchived
3798 data can be, you can set <varname>archive_timeout</varname> to force the
3799 server to switch to a new WAL segment file periodically. When this
3800 parameter is greater than zero, the server will switch to a new
3801 segment file whenever this amount of time has elapsed since the last
3802 segment file switch, and there has been any database activity,
3803 including a single checkpoint (checkpoints are skipped if there is
3804 no database activity). Note that archived files that are closed
3805 early due to a forced switch are still the same length as completely
3806 full files. Therefore, it is unwise to use a very short
3807 <varname>archive_timeout</varname> &mdash; it will bloat your archive
3808 storage. <varname>archive_timeout</varname> settings of a minute or so are
3809 usually reasonable. You should consider using streaming replication,
3810 instead of archiving, if you want data to be copied off the primary
3811 server more quickly than that.
3812 If this value is specified without units, it is taken as seconds.
3813 This parameter can only be set in the
3814 <filename>postgresql.conf</filename> file or on the server command line.
3815 </para>
3816 </listitem>
3817 </varlistentry>
3819 </variablelist>
3820 </sect2>
3822 <sect2 id="runtime-config-wal-recovery">
3824 <title>Recovery</title>
3826 <indexterm>
3827 <primary>configuration</primary>
3828 <secondary>of recovery</secondary>
3829 <tertiary>general settings</tertiary>
3830 </indexterm>
3832 <para>
3833 This section describes the settings that apply to recovery in general,
3834 affecting crash recovery, streaming replication and archive-based
3835 replication.
3836 </para>
3839 <variablelist>
3840 <varlistentry id="guc-recovery-prefetch" xreflabel="recovery_prefetch">
3841 <term><varname>recovery_prefetch</varname> (<type>enum</type>)
3842 <indexterm>
3843 <primary><varname>recovery_prefetch</varname> configuration parameter</primary>
3844 </indexterm>
3845 </term>
3846 <listitem>
3847 <para>
3848 Whether to try to prefetch blocks that are referenced in the WAL that
3849 are not yet in the buffer pool, during recovery. Valid values are
3850 <literal>off</literal>, <literal>on</literal> and
3851 <literal>try</literal> (the default). The setting
3852 <literal>try</literal> enables
3853 prefetching only if the operating system provides support for issuing
3854 read-ahead advice.
3855 </para>
3856 <para>
3857 Prefetching blocks that will soon be needed can reduce I/O wait times
3858 during recovery with some workloads.
3859 See also the <xref linkend="guc-wal-decode-buffer-size"/> and
3860 <xref linkend="guc-maintenance-io-concurrency"/> settings, which limit
3861 prefetching activity.
3862 </para>
3863 </listitem>
3864 </varlistentry>
3866 <varlistentry id="guc-wal-decode-buffer-size" xreflabel="wal_decode_buffer_size">
3867 <term><varname>wal_decode_buffer_size</varname> (<type>integer</type>)
3868 <indexterm>
3869 <primary><varname>wal_decode_buffer_size</varname> configuration parameter</primary>
3870 </indexterm>
3871 </term>
3872 <listitem>
3873 <para>
3874 A limit on how far ahead the server can look in the WAL, to find
3875 blocks to prefetch. If this value is specified without units, it is
3876 taken as bytes.
3877 The default is 512kB.
3878 </para>
3879 </listitem>
3880 </varlistentry>
3882 </variablelist>
3883 </sect2>
3885 <sect2 id="runtime-config-wal-archive-recovery">
3887 <title>Archive Recovery</title>
3889 <indexterm>
3890 <primary>configuration</primary>
3891 <secondary>of recovery</secondary>
3892 <tertiary>of a standby server</tertiary>
3893 </indexterm>
3895 <para>
3896 This section describes the settings that apply only for the duration of
3897 the recovery. They must be reset for any subsequent recovery you wish to
3898 perform.
3899 </para>
3901 <para>
3902 <quote>Recovery</quote> covers using the server as a standby or for
3903 executing a targeted recovery. Typically, standby mode would be used to
3904 provide high availability and/or read scalability, whereas a targeted
3905 recovery is used to recover from data loss.
3906 </para>
3908 <para>
3909 To start the server in standby mode, create a file called
3910 <filename>standby.signal</filename><indexterm><primary>standby.signal</primary></indexterm>
3911 in the data directory. The server will enter recovery and will not stop
3912 recovery when the end of archived WAL is reached, but will keep trying to
3913 continue recovery by connecting to the sending server as specified by the
3914 <varname>primary_conninfo</varname> setting and/or by fetching new WAL
3915 segments using <varname>restore_command</varname>. For this mode, the
3916 parameters from this section and <xref
3917 linkend="runtime-config-replication-standby"/> are of interest.
3918 Parameters from <xref linkend="runtime-config-wal-recovery-target"/> will
3919 also be applied but are typically not useful in this mode.
3920 </para>
3922 <para>
3923 To start the server in targeted recovery mode, create a file called
3924 <filename>recovery.signal</filename><indexterm><primary>recovery.signal</primary></indexterm>
3925 in the data directory. If both <filename>standby.signal</filename> and
3926 <filename>recovery.signal</filename> files are created, standby mode
3927 takes precedence. Targeted recovery mode ends when the archived WAL is
3928 fully replayed, or when <varname>recovery_target</varname> is reached.
3929 In this mode, the parameters from both this section and <xref
3930 linkend="runtime-config-wal-recovery-target"/> will be used.
3931 </para>
3933 <variablelist>
3934 <varlistentry id="guc-restore-command" xreflabel="restore_command">
3935 <term><varname>restore_command</varname> (<type>string</type>)
3936 <indexterm>
3937 <primary><varname>restore_command</varname> configuration parameter</primary>
3938 </indexterm>
3939 </term>
3940 <listitem>
3941 <para>
3942 The local shell command to execute to retrieve an archived segment of
3943 the WAL file series. This parameter is required for archive recovery,
3944 but optional for streaming replication.
3945 Any <literal>%f</literal> in the string is
3946 replaced by the name of the file to retrieve from the archive,
3947 and any <literal>%p</literal> is replaced by the copy destination path name
3948 on the server.
3949 (The path name is relative to the current working directory,
3950 i.e., the cluster's data directory.)
3951 Any <literal>%r</literal> is replaced by the name of the file containing the
3952 last valid restart point. That is the earliest file that must be kept
3953 to allow a restore to be restartable, so this information can be used
3954 to truncate the archive to just the minimum required to support
3955 restarting from the current restore. <literal>%r</literal> is typically only
3956 used by warm-standby configurations
3957 (see <xref linkend="warm-standby"/>).
3958 Write <literal>%%</literal> to embed an actual <literal>%</literal> character.
3959 </para>
3961 <para>
3962 It is important for the command to return a zero exit status
3963 only if it succeeds. The command <emphasis>will</emphasis> be asked for file
3964 names that are not present in the archive; it must return nonzero
3965 when so asked. Examples:
3966 <programlisting>
3967 restore_command = 'cp /mnt/server/archivedir/%f "%p"'
3968 restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
3969 </programlisting>
3970 An exception is that if the command was terminated by a signal (other
3971 than <systemitem>SIGTERM</systemitem>, which is used as part of a
3972 database server shutdown) or an error by the shell (such as command
3973 not found), then recovery will abort and the server will not start up.
3974 </para>
3976 <para>
3977 This parameter can only be set in the <filename>postgresql.conf</filename>
3978 file or on the server command line.
3979 </para>
3980 </listitem>
3981 </varlistentry>
3983 <varlistentry id="guc-archive-cleanup-command" xreflabel="archive_cleanup_command">
3984 <term><varname>archive_cleanup_command</varname> (<type>string</type>)
3985 <indexterm>
3986 <primary><varname>archive_cleanup_command</varname> configuration parameter</primary>
3987 </indexterm>
3988 </term>
3989 <listitem>
3990 <para>
3991 This optional parameter specifies a shell command that will be executed
3992 at every restartpoint. The purpose of
3993 <varname>archive_cleanup_command</varname> is to provide a mechanism for
3994 cleaning up old archived WAL files that are no longer needed by the
3995 standby server.
3996 Any <literal>%r</literal> is replaced by the name of the file containing the
3997 last valid restart point.
3998 That is the earliest file that must be <emphasis>kept</emphasis> to allow a
3999 restore to be restartable, and so all files earlier than <literal>%r</literal>
4000 may be safely removed.
4001 This information can be used to truncate the archive to just the
4002 minimum required to support restart from the current restore.
4003 The <xref linkend="pgarchivecleanup"/> module
4004 is often used in <varname>archive_cleanup_command</varname> for
4005 single-standby configurations, for example:
4006 <programlisting>archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'</programlisting>
4007 Note however that if multiple standby servers are restoring from the
4008 same archive directory, you will need to ensure that you do not delete
4009 WAL files until they are no longer needed by any of the servers.
4010 <varname>archive_cleanup_command</varname> would typically be used in a
4011 warm-standby configuration (see <xref linkend="warm-standby"/>).
4012 Write <literal>%%</literal> to embed an actual <literal>%</literal> character in the
4013 command.
4014 </para>
4015 <para>
4016 If the command returns a nonzero exit status then a warning log
4017 message will be written. An exception is that if the command was
4018 terminated by a signal or an error by the shell (such as command not
4019 found), a fatal error will be raised.
4020 </para>
4021 <para>
4022 This parameter can only be set in the <filename>postgresql.conf</filename>
4023 file or on the server command line.
4024 </para>
4025 </listitem>
4026 </varlistentry>
4028 <varlistentry id="guc-recovery-end-command" xreflabel="recovery_end_command">
4029 <term><varname>recovery_end_command</varname> (<type>string</type>)
4030 <indexterm>
4031 <primary><varname>recovery_end_command</varname> configuration parameter</primary>
4032 </indexterm>
4033 </term>
4034 <listitem>
4035 <para>
4036 This parameter specifies a shell command that will be executed once only
4037 at the end of recovery. This parameter is optional. The purpose of the
4038 <varname>recovery_end_command</varname> is to provide a mechanism for cleanup
4039 following replication or recovery.
4040 Any <literal>%r</literal> is replaced by the name of the file containing the
4041 last valid restart point, like in <xref linkend="guc-archive-cleanup-command"/>.
4042 </para>
4043 <para>
4044 If the command returns a nonzero exit status then a warning log
4045 message will be written and the database will proceed to start up
4046 anyway. An exception is that if the command was terminated by a
4047 signal or an error by the shell (such as command not found), the
4048 database will not proceed with startup.
4049 </para>
4050 <para>
4051 This parameter can only be set in the <filename>postgresql.conf</filename>
4052 file or on the server command line.
4053 </para>
4054 </listitem>
4055 </varlistentry>
4057 </variablelist>
4059 </sect2>
4061 <sect2 id="runtime-config-wal-recovery-target">
4063 <title>Recovery Target</title>
4065 <para>
4066 By default, recovery will recover to the end of the WAL log. The
4067 following parameters can be used to specify an earlier stopping point.
4068 At most one of <varname>recovery_target</varname>,
4069 <varname>recovery_target_lsn</varname>, <varname>recovery_target_name</varname>,
4070 <varname>recovery_target_time</varname>, or <varname>recovery_target_xid</varname>
4071 can be used; if more than one of these is specified in the configuration
4072 file, an error will be raised.
4073 These parameters can only be set at server start.
4074 </para>
4076 <variablelist>
4077 <varlistentry id="guc-recovery-target" xreflabel="recovery_target">
4078 <term><varname>recovery_target</varname><literal> = 'immediate'</literal>
4079 <indexterm>
4080 <primary><varname>recovery_target</varname> configuration parameter</primary>
4081 </indexterm>
4082 </term>
4083 <listitem>
4084 <para>
4085 This parameter specifies that recovery should end as soon as a
4086 consistent state is reached, i.e., as early as possible. When restoring
4087 from an online backup, this means the point where taking the backup
4088 ended.
4089 </para>
4090 <para>
4091 Technically, this is a string parameter, but <literal>'immediate'</literal>
4092 is currently the only allowed value.
4093 </para>
4094 </listitem>
4095 </varlistentry>
4097 <varlistentry id="guc-recovery-target-name" xreflabel="recovery_target_name">
4098 <term><varname>recovery_target_name</varname> (<type>string</type>)
4099 <indexterm>
4100 <primary><varname>recovery_target_name</varname> configuration parameter</primary>
4101 </indexterm>
4102 </term>
4103 <listitem>
4104 <para>
4105 This parameter specifies the named restore point (created with
4106 <function>pg_create_restore_point()</function>) to which recovery will proceed.
4107 </para>
4108 </listitem>
4109 </varlistentry>
4111 <varlistentry id="guc-recovery-target-time" xreflabel="recovery_target_time">
4112 <term><varname>recovery_target_time</varname> (<type>timestamp</type>)
4113 <indexterm>
4114 <primary><varname>recovery_target_time</varname> configuration parameter</primary>
4115 </indexterm>
4116 </term>
4117 <listitem>
4118 <para>
4119 This parameter specifies the time stamp up to which recovery
4120 will proceed.
4121 The precise stopping point is also influenced by
4122 <xref linkend="guc-recovery-target-inclusive"/>.
4123 </para>
4125 <para>
4126 The value of this parameter is a time stamp in the same format
4127 accepted by the <type>timestamp with time zone</type> data type,
4128 except that you cannot use a time zone abbreviation (unless the
4129 <xref linkend="guc-timezone-abbreviations"/> variable has been set
4130 earlier in the configuration file). Preferred style is to use a
4131 numeric offset from UTC, or you can write a full time zone name,
4132 e.g., <literal>Europe/Helsinki</literal> not <literal>EEST</literal>.
4133 </para>
4134 </listitem>
4135 </varlistentry>
4137 <varlistentry id="guc-recovery-target-xid" xreflabel="recovery_target_xid">
4138 <term><varname>recovery_target_xid</varname> (<type>string</type>)
4139 <indexterm>
4140 <primary><varname>recovery_target_xid</varname> configuration parameter</primary>
4141 </indexterm>
4142 </term>
4143 <listitem>
4144 <para>
4145 This parameter specifies the transaction ID up to which recovery
4146 will proceed. Keep in mind
4147 that while transaction IDs are assigned sequentially at transaction
4148 start, transactions can complete in a different numeric order.
4149 The transactions that will be recovered are those that committed
4150 before (and optionally including) the specified one.
4151 The precise stopping point is also influenced by
4152 <xref linkend="guc-recovery-target-inclusive"/>.
4153 </para>
4154 </listitem>
4155 </varlistentry>
4157 <varlistentry id="guc-recovery-target-lsn" xreflabel="recovery_target_lsn">
4158 <term><varname>recovery_target_lsn</varname> (<type>pg_lsn</type>)
4159 <indexterm>
4160 <primary><varname>recovery_target_lsn</varname> configuration parameter</primary>
4161 </indexterm>
4162 </term>
4163 <listitem>
4164 <para>
4165 This parameter specifies the LSN of the write-ahead log location up
4166 to which recovery will proceed. The precise stopping point is also
4167 influenced by <xref linkend="guc-recovery-target-inclusive"/>. This
4168 parameter is parsed using the system data type
4169 <link linkend="datatype-pg-lsn"><type>pg_lsn</type></link>.
4170 </para>
4171 </listitem>
4172 </varlistentry>
4173 </variablelist>
4175 <para>
4176 The following options further specify the recovery target, and affect
4177 what happens when the target is reached:
4178 </para>
4180 <variablelist>
4181 <varlistentry id="guc-recovery-target-inclusive"
4182 xreflabel="recovery_target_inclusive">
4183 <term><varname>recovery_target_inclusive</varname> (<type>boolean</type>)
4184 <indexterm>
4185 <primary><varname>recovery_target_inclusive</varname> configuration parameter</primary>
4186 </indexterm>
4187 </term>
4188 <listitem>
4189 <para>
4190 Specifies whether to stop just after the specified recovery target
4191 (<literal>on</literal>), or just before the recovery target
4192 (<literal>off</literal>).
4193 Applies when <xref linkend="guc-recovery-target-lsn"/>,
4194 <xref linkend="guc-recovery-target-time"/>, or
4195 <xref linkend="guc-recovery-target-xid"/> is specified.
4196 This setting controls whether transactions
4197 having exactly the target WAL location (LSN), commit time, or transaction ID, respectively, will
4198 be included in the recovery. Default is <literal>on</literal>.
4199 </para>
4200 </listitem>
4201 </varlistentry>
4203 <varlistentry id="guc-recovery-target-timeline"
4204 xreflabel="recovery_target_timeline">
4205 <term><varname>recovery_target_timeline</varname> (<type>string</type>)
4206 <indexterm>
4207 <primary><varname>recovery_target_timeline</varname> configuration parameter</primary>
4208 </indexterm>
4209 </term>
4210 <listitem>
4211 <para>
4212 Specifies recovering into a particular timeline. The value can be a
4213 numeric timeline ID or a special value. The value
4214 <literal>current</literal> recovers along the same timeline that was
4215 current when the base backup was taken. The
4216 value <literal>latest</literal> recovers
4217 to the latest timeline found in the archive, which is useful in
4218 a standby server. <literal>latest</literal> is the default.
4219 </para>
4221 <para>
4222 To specify a timeline ID in hexadecimal (for example, if extracted
4223 from a WAL file name or history file), prefix it with a
4224 <literal>0x</literal>. For instance, if the WAL file name is
4225 <filename>00000011000000A10000004F</filename>, then the timeline ID is
4226 <literal>0x11</literal> (or 17 decimal).
4227 </para>
4229 <para>
4230 You usually only need to set this parameter
4231 in complex re-recovery situations, where you need to return to
4232 a state that itself was reached after a point-in-time recovery.
4233 See <xref linkend="backup-timelines"/> for discussion.
4234 </para>
4235 </listitem>
4236 </varlistentry>
4238 <varlistentry id="guc-recovery-target-action"
4239 xreflabel="recovery_target_action">
4240 <term><varname>recovery_target_action</varname> (<type>enum</type>)
4241 <indexterm>
4242 <primary><varname>recovery_target_action</varname> configuration parameter</primary>
4243 </indexterm>
4244 </term>
4245 <listitem>
4246 <para>
4247 Specifies what action the server should take once the recovery target is
4248 reached. The default is <literal>pause</literal>, which means recovery will
4249 be paused. <literal>promote</literal> means the recovery process will finish
4250 and the server will start to accept connections.
4251 Finally <literal>shutdown</literal> will stop the server after reaching the
4252 recovery target.
4253 </para>
4254 <para>
4255 The intended use of the <literal>pause</literal> setting is to allow queries
4256 to be executed against the database to check if this recovery target
4257 is the most desirable point for recovery.
4258 The paused state can be resumed by
4259 using <function>pg_wal_replay_resume()</function> (see
4260 <xref linkend="functions-recovery-control-table"/>), which then
4261 causes recovery to end. If this recovery target is not the
4262 desired stopping point, then shut down the server, change the
4263 recovery target settings to a later target and restart to
4264 continue recovery.
4265 </para>
4266 <para>
4267 The <literal>shutdown</literal> setting is useful to have the instance ready
4268 at the exact replay point desired. The instance will still be able to
4269 replay more WAL records (and in fact will have to replay WAL records
4270 since the last checkpoint next time it is started).
4271 </para>
4272 <para>
4273 Note that because <filename>recovery.signal</filename> will not be
4274 removed when <varname>recovery_target_action</varname> is set to <literal>shutdown</literal>,
4275 any subsequent start will end with immediate shutdown unless the
4276 configuration is changed or the <filename>recovery.signal</filename>
4277 file is removed manually.
4278 </para>
4279 <para>
4280 This setting has no effect if no recovery target is set.
4281 If <xref linkend="guc-hot-standby"/> is not enabled, a setting of
4282 <literal>pause</literal> will act the same as <literal>shutdown</literal>.
4283 If the recovery target is reached while a promotion is ongoing,
4284 a setting of <literal>pause</literal> will act the same as
4285 <literal>promote</literal>.
4286 </para>
4287 <para>
4288 In any case, if a recovery target is configured but the archive
4289 recovery ends before the target is reached, the server will shut down
4290 with a fatal error.
4291 </para>
4292 </listitem>
4293 </varlistentry>
4295 </variablelist>
4296 </sect2>
4298 <sect2 id="runtime-config-wal-summarization">
4299 <title>WAL Summarization</title>
4301 <para>
4302 These settings control WAL summarization, a feature which must be
4303 enabled in order to perform an
4304 <link linkend="backup-incremental-backup">incremental backup</link>.
4305 </para>
4307 <variablelist>
4308 <varlistentry id="guc-summarize-wal" xreflabel="summarize_wal">
4309 <term><varname>summarize_wal</varname> (<type>boolean</type>)
4310 <indexterm>
4311 <primary><varname>summarize_wal</varname> configuration parameter</primary>
4312 </indexterm>
4313 </term>
4314 <listitem>
4315 <para>
4316 Enables the WAL summarizer process. Note that WAL summarization can
4317 be enabled either on a primary or on a standby. This parameter can only
4318 be set in the <filename>postgresql.conf</filename> file or on the server
4319 command line. The default is <literal>off</literal>.
4320 </para>
4321 <para>
4322 The server cannot be started with <literal>summarize_wal=on</literal>
4323 if <literal>wal_level</literal> is set to <literal>minimal</literal>. If
4324 <literal>summarize_wal=on</literal> is configured after server startup
4325 while <literal>wal_level=minimal</literal>, the summarizer will run
4326 but refuse to generate summary files for any WAL generated with
4327 <literal>wal_level=minimal</literal>.
4328 </para>
4329 </listitem>
4330 </varlistentry>
4332 <varlistentry id="guc-wal-summary-keep-time" xreflabel="wal_summary_keep_time">
4333 <term><varname>wal_summary_keep_time</varname> (<type>integer</type>)
4334 <indexterm>
4335 <primary><varname>wal_summary_keep_time</varname> configuration parameter</primary>
4336 </indexterm>
4337 </term>
4338 <listitem>
4339 <para>
4340 Configures the amount of time after which the WAL summarizer
4341 automatically removes old WAL summaries. The file timestamp is used to
4342 determine which files are old enough to remove. Typically, you should set
4343 this comfortably higher than the time that could pass between a backup
4344 and a later incremental backup that depends on it. WAL summaries must
4345 be available for the entire range of WAL records between the preceding
4346 backup and the new one being taken; if not, the incremental backup will
4347 fail. If this parameter is set to zero, WAL summaries will not be
4348 automatically deleted, but it is safe to manually remove files that you
4349 know will not be required for future incremental backups.
4350 This parameter can only be set in the
4351 <filename>postgresql.conf</filename> file or on the server command line.
4352 If this value is specified without units, it is taken as minutes.
4353 The default is 10 days. If <literal>summarize_wal = off</literal>,
4354 existing WAL summaries will not be removed regardless of the value of
4355 this parameter, because the WAL summarizer will not run.
4356 </para>
4357 </listitem>
4358 </varlistentry>
4360 </variablelist>
4362 </sect2>
4364 </sect1>
4366 <sect1 id="runtime-config-replication">
4367 <title>Replication</title>
4369 <para>
4370 These settings control the behavior of the built-in
4371 <firstterm>streaming replication</firstterm> feature (see
4372 <xref linkend="streaming-replication"/>), and the built-in
4373 <firstterm>logical replication</firstterm> feature (see
4374 <xref linkend="logical-replication"/>).
4375 </para>
4377 <para>
4378 For <emphasis>streaming replication</emphasis>, servers will be either a
4379 primary or a standby server. Primaries can send data, while standbys
4380 are always receivers of replicated data. When cascading replication
4381 (see <xref linkend="cascading-replication"/>) is used, standby servers
4382 can also be senders, as well as receivers.
4383 Parameters are mainly for sending and standby servers, though some
4384 parameters have meaning only on the primary server. Settings may vary
4385 across the cluster without problems if that is required.
4386 </para>
4388 <para>
4389 For <emphasis>logical replication</emphasis>, <firstterm>publishers</firstterm>
4390 (servers that do <link linkend="sql-createpublication"><command>CREATE PUBLICATION</command></link>)
4391 replicate data to <firstterm>subscribers</firstterm>
4392 (servers that do <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>).
4393 Servers can also be publishers and subscribers at the same time. Note,
4394 the following sections refer to publishers as "senders". For more details
4395 about logical replication configuration settings refer to
4396 <xref linkend="logical-replication-config"/>.
4397 </para>
4399 <sect2 id="runtime-config-replication-sender">
4400 <title>Sending Servers</title>
4402 <para>
4403 These parameters can be set on any server that is
4404 to send replication data to one or more standby servers.
4405 The primary is always a sending server, so these parameters must
4406 always be set on the primary.
4407 The role and meaning of these parameters does not change after a
4408 standby becomes the primary.
4409 </para>
4411 <variablelist>
4412 <varlistentry id="guc-max-wal-senders" xreflabel="max_wal_senders">
4413 <term><varname>max_wal_senders</varname> (<type>integer</type>)
4414 <indexterm>
4415 <primary><varname>max_wal_senders</varname> configuration parameter</primary>
4416 </indexterm>
4417 </term>
4418 <listitem>
4419 <para>
4420 Specifies the maximum number of concurrent connections from standby
4421 servers or streaming base backup clients (i.e., the maximum number of
4422 simultaneously running WAL sender processes). The default is
4423 <literal>10</literal>. The value <literal>0</literal> means
4424 replication is disabled. Abrupt disconnection of a streaming client might
4425 leave an orphaned connection slot behind until a timeout is reached,
4426 so this parameter should be set slightly higher than the maximum
4427 number of expected clients so disconnected clients can immediately
4428 reconnect. This parameter can only be set at server start. Also,
4429 <varname>wal_level</varname> must be set to
4430 <literal>replica</literal> or higher to allow connections from standby
4431 servers.
4432 </para>
4434 <para>
4435 When running a standby server, you must set this parameter to the
4436 same or higher value than on the primary server. Otherwise, queries
4437 will not be allowed in the standby server.
4438 </para>
4439 </listitem>
4440 </varlistentry>
4442 <varlistentry id="guc-max-replication-slots" xreflabel="max_replication_slots">
4443 <term><varname>max_replication_slots</varname> (<type>integer</type>)
4444 <indexterm>
4445 <primary><varname>max_replication_slots</varname> configuration parameter</primary>
4446 <secondary>in a sending server</secondary>
4447 </indexterm>
4448 </term>
4449 <listitem>
4450 <para>
4451 Specifies the maximum number of replication slots
4452 (see <xref linkend="streaming-replication-slots"/>) that the server
4453 can support. The default is 10. This parameter can only be set at
4454 server start.
4455 Setting it to a lower value than the number of currently
4456 existing replication slots will prevent the server from starting.
4457 Also, <varname>wal_level</varname> must be set
4458 to <literal>replica</literal> or higher to allow replication slots to
4459 be used.
4460 </para>
4462 <para>
4463 Note that this parameter also applies on the subscriber side, but with
4464 a different meaning.
4465 </para>
4466 </listitem>
4467 </varlistentry>
4469 <varlistentry id="guc-wal-keep-size" xreflabel="wal_keep_size">
4470 <term><varname>wal_keep_size</varname> (<type>integer</type>)
4471 <indexterm>
4472 <primary><varname>wal_keep_size</varname> configuration parameter</primary>
4473 </indexterm>
4474 </term>
4475 <listitem>
4476 <para>
4477 Specifies the minimum size of past WAL files kept in the
4478 <filename>pg_wal</filename>
4479 directory, in case a standby server needs to fetch them for streaming
4480 replication. If a standby
4481 server connected to the sending server falls behind by more than
4482 <varname>wal_keep_size</varname> megabytes, the sending server might
4483 remove a WAL segment still needed by the standby, in which case the
4484 replication connection will be terminated. Downstream connections
4485 will also eventually fail as a result. (However, the standby
4486 server can recover by fetching the segment from archive, if WAL
4487 archiving is in use.)
4488 </para>
4490 <para>
4491 This sets only the minimum size of segments retained in
4492 <filename>pg_wal</filename>; the system might need to retain more segments
4493 for WAL archival or to recover from a checkpoint. If
4494 <varname>wal_keep_size</varname> is zero (the default), the system
4495 doesn't keep any extra segments for standby purposes, so the number
4496 of old WAL segments available to standby servers is a function of
4497 the location of the previous checkpoint and status of WAL
4498 archiving.
4499 If this value is specified without units, it is taken as megabytes.
4500 This parameter can only be set in the
4501 <filename>postgresql.conf</filename> file or on the server command line.
4502 </para>
4503 </listitem>
4504 </varlistentry>
4506 <varlistentry id="guc-max-slot-wal-keep-size" xreflabel="max_slot_wal_keep_size">
4507 <term><varname>max_slot_wal_keep_size</varname> (<type>integer</type>)
4508 <indexterm>
4509 <primary><varname>max_slot_wal_keep_size</varname> configuration parameter</primary>
4510 </indexterm>
4511 </term>
4512 <listitem>
4513 <para>
4514 Specify the maximum size of WAL files
4515 that <link linkend="streaming-replication-slots">replication
4516 slots</link> are allowed to retain in the <filename>pg_wal</filename>
4517 directory at checkpoint time.
4518 If <varname>max_slot_wal_keep_size</varname> is -1 (the default),
4519 replication slots may retain an unlimited amount of WAL files. Otherwise, if
4520 restart_lsn of a replication slot falls behind the current LSN by more
4521 than the given size, the standby using the slot may no longer be able
4522 to continue replication due to removal of required WAL files. You
4523 can see the WAL availability of replication slots
4524 in <link linkend="view-pg-replication-slots">pg_replication_slots</link>.
4525 If this value is specified without units, it is taken as megabytes.
4526 This parameter can only be set in the <filename>postgresql.conf</filename>
4527 file or on the server command line.
4528 </para>
4529 </listitem>
4530 </varlistentry>
4532 <varlistentry id="guc-wal-sender-timeout" xreflabel="wal_sender_timeout">
4533 <term><varname>wal_sender_timeout</varname> (<type>integer</type>)
4534 <indexterm>
4535 <primary><varname>wal_sender_timeout</varname> configuration parameter</primary>
4536 </indexterm>
4537 </term>
4538 <listitem>
4539 <para>
4540 Terminate replication connections that are inactive for longer
4541 than this amount of time. This is useful for
4542 the sending server to detect a standby crash or network outage.
4543 If this value is specified without units, it is taken as milliseconds.
4544 The default value is 60 seconds.
4545 A value of zero disables the timeout mechanism.
4546 </para>
4547 <para>
4548 With a cluster distributed across multiple geographic
4549 locations, using different values per location brings more flexibility
4550 in the cluster management. A smaller value is useful for faster
4551 failure detection with a standby having a low-latency network
4552 connection, and a larger value helps in judging better the health
4553 of a standby if located on a remote location, with a high-latency
4554 network connection.
4555 </para>
4556 </listitem>
4557 </varlistentry>
4559 <varlistentry id="guc-track-commit-timestamp" xreflabel="track_commit_timestamp">
4560 <term><varname>track_commit_timestamp</varname> (<type>boolean</type>)
4561 <indexterm>
4562 <primary><varname>track_commit_timestamp</varname> configuration parameter</primary>
4563 </indexterm>
4564 </term>
4565 <listitem>
4566 <para>
4567 Record commit time of transactions. This parameter
4568 can only be set in <filename>postgresql.conf</filename> file or on the server
4569 command line. The default value is <literal>off</literal>.
4570 </para>
4571 </listitem>
4572 </varlistentry>
4574 <varlistentry id="guc-synchronized-standby-slots" xreflabel="synchronized_standby_slots">
4575 <term><varname>synchronized_standby_slots</varname> (<type>string</type>)
4576 <indexterm>
4577 <primary><varname>synchronized_standby_slots</varname> configuration parameter</primary>
4578 </indexterm>
4579 </term>
4580 <listitem>
4581 <para>
4582 A comma-separated list of streaming replication standby server slot names
4583 that logical WAL sender processes will wait for. Logical WAL sender processes
4584 will send decoded changes to plugins only after the specified replication
4585 slots confirm receiving WAL. This guarantees that logical replication
4586 failover slots do not consume changes until those changes are received
4587 and flushed to corresponding physical standbys. If a
4588 logical replication connection is meant to switch to a physical standby
4589 after the standby is promoted, the physical replication slot for the
4590 standby should be listed here. Note that logical replication will not
4591 proceed if the slots specified in the
4592 <varname>synchronized_standby_slots</varname> do not exist or are invalidated.
4593 Additionally, the replication management functions
4594 <link linkend="pg-replication-slot-advance">
4595 <function>pg_replication_slot_advance</function></link>,
4596 <link linkend="pg-logical-slot-get-changes">
4597 <function>pg_logical_slot_get_changes</function></link>, and
4598 <link linkend="pg-logical-slot-peek-changes">
4599 <function>pg_logical_slot_peek_changes</function></link>,
4600 when used with logical failover slots, will block until all
4601 physical slots specified in <varname>synchronized_standby_slots</varname> have
4602 confirmed WAL receipt.
4603 </para>
4604 <para>
4605 The standbys corresponding to the physical replication slots in
4606 <varname>synchronized_standby_slots</varname> must configure
4607 <literal>sync_replication_slots = true</literal> so they can receive
4608 logical failover slot changes from the primary.
4609 </para>
4610 </listitem>
4611 </varlistentry>
4613 </variablelist>
4614 </sect2>
4616 <sect2 id="runtime-config-replication-primary">
4617 <title>Primary Server</title>
4619 <para>
4620 These parameters can be set on the primary server that is
4621 to send replication data to one or more standby servers.
4622 Note that in addition to these parameters,
4623 <xref linkend="guc-wal-level"/> must be set appropriately on the primary
4624 server, and optionally WAL archiving can be enabled as
4625 well (see <xref linkend="runtime-config-wal-archiving"/>).
4626 The values of these parameters on standby servers are irrelevant,
4627 although you may wish to set them there in preparation for the
4628 possibility of a standby becoming the primary.
4629 </para>
4631 <variablelist>
4633 <varlistentry id="guc-synchronous-standby-names" xreflabel="synchronous_standby_names">
4634 <term><varname>synchronous_standby_names</varname> (<type>string</type>)
4635 <indexterm>
4636 <primary><varname>synchronous_standby_names</varname> configuration parameter</primary>
4637 </indexterm>
4638 </term>
4639 <listitem>
4640 <para>
4641 Specifies a list of standby servers that can support
4642 <firstterm>synchronous replication</firstterm>, as described in
4643 <xref linkend="synchronous-replication"/>.
4644 There will be one or more active synchronous standbys;
4645 transactions waiting for commit will be allowed to proceed after
4646 these standby servers confirm receipt of their data.
4647 The synchronous standbys will be those whose names appear
4648 in this list, and
4649 that are both currently connected and streaming data in real-time
4650 (as shown by a state of <literal>streaming</literal> in the
4651 <link linkend="monitoring-pg-stat-replication-view">
4652 <structname>pg_stat_replication</structname></link> view).
4653 Specifying more than one synchronous standby can allow for very high
4654 availability and protection against data loss.
4655 </para>
4656 <para>
4657 The name of a standby server for this purpose is the
4658 <varname>application_name</varname> setting of the standby, as set in the
4659 standby's connection information. In case of a physical replication
4660 standby, this should be set in the <varname>primary_conninfo</varname>
4661 setting; the default is the setting of <xref linkend="guc-cluster-name"/>
4662 if set, else <literal>walreceiver</literal>.
4663 For logical replication, this can be set in the connection
4664 information of the subscription, and it defaults to the
4665 subscription name. For other replication stream consumers,
4666 consult their documentation.
4667 </para>
4668 <para>
4669 This parameter specifies a list of standby servers using
4670 either of the following syntaxes:
4671 <synopsis>
4672 [FIRST] <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="parameter">standby_name</replaceable> [, ...] )
4673 ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="parameter">standby_name</replaceable> [, ...] )
4674 <replaceable class="parameter">standby_name</replaceable> [, ...]
4675 </synopsis>
4676 where <replaceable class="parameter">num_sync</replaceable> is
4677 the number of synchronous standbys that transactions need to
4678 wait for replies from,
4679 and <replaceable class="parameter">standby_name</replaceable>
4680 is the name of a standby server.
4681 <literal>FIRST</literal> and <literal>ANY</literal> specify the method to choose
4682 synchronous standbys from the listed servers.
4683 </para>
4684 <para>
4685 The keyword <literal>FIRST</literal>, coupled with
4686 <replaceable class="parameter">num_sync</replaceable>, specifies a
4687 priority-based synchronous replication and makes transaction commits
4688 wait until their WAL records are replicated to
4689 <replaceable class="parameter">num_sync</replaceable> synchronous
4690 standbys chosen based on their priorities. For example, a setting of
4691 <literal>FIRST 3 (s1, s2, s3, s4)</literal> will cause each commit to wait for
4692 replies from three higher-priority standbys chosen from standby servers
4693 <literal>s1</literal>, <literal>s2</literal>, <literal>s3</literal> and <literal>s4</literal>.
4694 The standbys whose names appear earlier in the list are given higher
4695 priority and will be considered as synchronous. Other standby servers
4696 appearing later in this list represent potential synchronous standbys.
4697 If any of the current synchronous standbys disconnects for whatever
4698 reason, it will be replaced immediately with the next-highest-priority
4699 standby. The keyword <literal>FIRST</literal> is optional.
4700 </para>
4701 <para>
4702 The keyword <literal>ANY</literal>, coupled with
4703 <replaceable class="parameter">num_sync</replaceable>, specifies a
4704 quorum-based synchronous replication and makes transaction commits
4705 wait until their WAL records are replicated to <emphasis>at least</emphasis>
4706 <replaceable class="parameter">num_sync</replaceable> listed standbys.
4707 For example, a setting of <literal>ANY 3 (s1, s2, s3, s4)</literal> will cause
4708 each commit to proceed as soon as at least any three standbys of
4709 <literal>s1</literal>, <literal>s2</literal>, <literal>s3</literal> and <literal>s4</literal>
4710 reply.
4711 </para>
4712 <para>
4713 <literal>FIRST</literal> and <literal>ANY</literal> are case-insensitive. If these
4714 keywords are used as the name of a standby server,
4715 its <replaceable class="parameter">standby_name</replaceable> must
4716 be double-quoted.
4717 </para>
4718 <para>
4719 The third syntax was used before <productname>PostgreSQL</productname>
4720 version 9.6 and is still supported. It's the same as the first syntax
4721 with <literal>FIRST</literal> and
4722 <replaceable class="parameter">num_sync</replaceable> equal to 1.
4723 For example, <literal>FIRST 1 (s1, s2)</literal> and <literal>s1, s2</literal> have
4724 the same meaning: either <literal>s1</literal> or <literal>s2</literal> is chosen
4725 as a synchronous standby.
4726 </para>
4727 <para>
4728 The special entry <literal>*</literal> matches any standby name.
4729 </para>
4730 <para>
4731 There is no mechanism to enforce uniqueness of standby names. In case
4732 of duplicates one of the matching standbys will be considered as
4733 higher priority, though exactly which one is indeterminate.
4734 </para>
4735 <note>
4736 <para>
4737 Each <replaceable class="parameter">standby_name</replaceable>
4738 should have the form of a valid SQL identifier, unless it
4739 is <literal>*</literal>. You can use double-quoting if necessary. But note
4740 that <replaceable class="parameter">standby_name</replaceable>s are
4741 compared to standby application names case-insensitively, whether
4742 double-quoted or not.
4743 </para>
4744 </note>
4745 <para>
4746 If no synchronous standby names are specified here, then synchronous
4747 replication is not enabled and transaction commits will not wait for
4748 replication. This is the default configuration. Even when
4749 synchronous replication is enabled, individual transactions can be
4750 configured not to wait for replication by setting the
4751 <xref linkend="guc-synchronous-commit"/> parameter to
4752 <literal>local</literal> or <literal>off</literal>.
4753 </para>
4754 <para>
4755 This parameter can only be set in the <filename>postgresql.conf</filename>
4756 file or on the server command line.
4757 </para>
4758 </listitem>
4759 </varlistentry>
4761 </variablelist>
4762 </sect2>
4764 <sect2 id="runtime-config-replication-standby">
4765 <title>Standby Servers</title>
4767 <para>
4768 These settings control the behavior of a
4769 <link linkend="standby-server-operation">standby server</link>
4770 that is
4771 to receive replication data. Their values on the primary server
4772 are irrelevant.
4773 </para>
4775 <variablelist>
4777 <varlistentry id="guc-primary-conninfo" xreflabel="primary_conninfo">
4778 <term><varname>primary_conninfo</varname> (<type>string</type>)
4779 <indexterm>
4780 <primary><varname>primary_conninfo</varname> configuration parameter</primary>
4781 </indexterm>
4782 </term>
4783 <listitem>
4784 <para>
4785 Specifies a connection string to be used for the standby server
4786 to connect with a sending server. This string is in the format
4787 described in <xref linkend="libpq-connstring"/>. If any option is
4788 unspecified in this string, then the corresponding environment
4789 variable (see <xref linkend="libpq-envars"/>) is checked. If the
4790 environment variable is not set either, then
4791 defaults are used.
4792 </para>
4793 <para>
4794 The connection string should specify the host name (or address)
4795 of the sending server, as well as the port number if it is not
4796 the same as the standby server's default.
4797 Also specify a user name corresponding to a suitably-privileged role
4798 on the sending server (see
4799 <xref linkend="streaming-replication-authentication"/>).
4800 A password needs to be provided too, if the sender demands password
4801 authentication. It can be provided in the
4802 <varname>primary_conninfo</varname> string, or in a separate
4803 <filename>~/.pgpass</filename> file on the standby server (use
4804 <literal>replication</literal> as the database name).
4805 </para>
4806 <para>
4807 For replication slot synchronization (see
4808 <xref linkend="logicaldecoding-replication-slots-synchronization"/>),
4809 it is also necessary to specify a valid <literal>dbname</literal>
4810 in the <varname>primary_conninfo</varname> string. This will only be
4811 used for slot synchronization. It is ignored for streaming.
4812 </para>
4813 <para>
4814 This parameter can only be set in the <filename>postgresql.conf</filename>
4815 file or on the server command line.
4816 If this parameter is changed while the WAL receiver process is
4817 running, that process is signaled to shut down and expected to
4818 restart with the new setting (except if <varname>primary_conninfo</varname>
4819 is an empty string).
4820 This setting has no effect if the server is not in standby mode.
4821 </para>
4822 </listitem>
4823 </varlistentry>
4824 <varlistentry id="guc-primary-slot-name" xreflabel="primary_slot_name">
4825 <term><varname>primary_slot_name</varname> (<type>string</type>)
4826 <indexterm>
4827 <primary><varname>primary_slot_name</varname> configuration parameter</primary>
4828 </indexterm>
4829 </term>
4830 <listitem>
4831 <para>
4832 Optionally specifies an existing replication slot to be used when
4833 connecting to the sending server via streaming replication to control
4834 resource removal on the upstream node
4835 (see <xref linkend="streaming-replication-slots"/>).
4836 This parameter can only be set in the <filename>postgresql.conf</filename>
4837 file or on the server command line.
4838 If this parameter is changed while the WAL receiver process is running,
4839 that process is signaled to shut down and expected to restart with the
4840 new setting.
4841 This setting has no effect if <varname>primary_conninfo</varname> is not
4842 set or the server is not in standby mode.
4843 </para>
4844 </listitem>
4845 </varlistentry>
4847 <varlistentry id="guc-hot-standby" xreflabel="hot_standby">
4848 <term><varname>hot_standby</varname> (<type>boolean</type>)
4849 <indexterm>
4850 <primary><varname>hot_standby</varname> configuration parameter</primary>
4851 </indexterm>
4852 </term>
4853 <listitem>
4854 <para>
4855 Specifies whether or not you can connect and run queries during
4856 recovery, as described in <xref linkend="hot-standby"/>.
4857 The default value is <literal>on</literal>.
4858 This parameter can only be set at server start. It only has effect
4859 during archive recovery or in standby mode.
4860 </para>
4861 </listitem>
4862 </varlistentry>
4864 <varlistentry id="guc-max-standby-archive-delay" xreflabel="max_standby_archive_delay">
4865 <term><varname>max_standby_archive_delay</varname> (<type>integer</type>)
4866 <indexterm>
4867 <primary><varname>max_standby_archive_delay</varname> configuration parameter</primary>
4868 </indexterm>
4869 </term>
4870 <listitem>
4871 <para>
4872 When hot standby is active, this parameter determines how long the
4873 standby server should wait before canceling standby queries that
4874 conflict with about-to-be-applied WAL entries, as described in
4875 <xref linkend="hot-standby-conflict"/>.
4876 <varname>max_standby_archive_delay</varname> applies when WAL data is
4877 being read from WAL archive (and is therefore not current).
4878 If this value is specified without units, it is taken as milliseconds.
4879 The default is 30 seconds.
4880 A value of -1 allows the standby to wait forever for conflicting
4881 queries to complete.
4882 This parameter can only be set in the <filename>postgresql.conf</filename>
4883 file or on the server command line.
4884 </para>
4885 <para>
4886 Note that <varname>max_standby_archive_delay</varname> is not the same as the
4887 maximum length of time a query can run before cancellation; rather it
4888 is the maximum total time allowed to apply any one WAL segment's data.
4889 Thus, if one query has resulted in significant delay earlier in the
4890 WAL segment, subsequent conflicting queries will have much less grace
4891 time.
4892 </para>
4893 </listitem>
4894 </varlistentry>
4896 <varlistentry id="guc-max-standby-streaming-delay" xreflabel="max_standby_streaming_delay">
4897 <term><varname>max_standby_streaming_delay</varname> (<type>integer</type>)
4898 <indexterm>
4899 <primary><varname>max_standby_streaming_delay</varname> configuration parameter</primary>
4900 </indexterm>
4901 </term>
4902 <listitem>
4903 <para>
4904 When hot standby is active, this parameter determines how long the
4905 standby server should wait before canceling standby queries that
4906 conflict with about-to-be-applied WAL entries, as described in
4907 <xref linkend="hot-standby-conflict"/>.
4908 <varname>max_standby_streaming_delay</varname> applies when WAL data is
4909 being received via streaming replication.
4910 If this value is specified without units, it is taken as milliseconds.
4911 The default is 30 seconds.
4912 A value of -1 allows the standby to wait forever for conflicting
4913 queries to complete.
4914 This parameter can only be set in the <filename>postgresql.conf</filename>
4915 file or on the server command line.
4916 </para>
4917 <para>
4918 Note that <varname>max_standby_streaming_delay</varname> is not the same as
4919 the maximum length of time a query can run before cancellation; rather
4920 it is the maximum total time allowed to apply WAL data once it has
4921 been received from the primary server. Thus, if one query has
4922 resulted in significant delay, subsequent conflicting queries will
4923 have much less grace time until the standby server has caught up
4924 again.
4925 </para>
4926 </listitem>
4927 </varlistentry>
4929 <varlistentry id="guc-wal-receiver-create-temp-slot" xreflabel="wal_receiver_create_temp_slot">
4930 <term><varname>wal_receiver_create_temp_slot</varname> (<type>boolean</type>)
4931 <indexterm>
4932 <primary><varname>wal_receiver_create_temp_slot</varname> configuration parameter</primary>
4933 </indexterm>
4934 </term>
4935 <listitem>
4936 <para>
4937 Specifies whether the WAL receiver process should create a temporary replication
4938 slot on the remote instance when no permanent replication slot to use
4939 has been configured (using <xref linkend="guc-primary-slot-name"/>).
4940 The default is off. This parameter can only be set in the
4941 <filename>postgresql.conf</filename> file or on the server command line.
4942 If this parameter is changed while the WAL receiver process is running,
4943 that process is signaled to shut down and expected to restart with
4944 the new setting.
4945 </para>
4946 </listitem>
4947 </varlistentry>
4949 <varlistentry id="guc-wal-receiver-status-interval" xreflabel="wal_receiver_status_interval">
4950 <term><varname>wal_receiver_status_interval</varname> (<type>integer</type>)
4951 <indexterm>
4952 <primary><varname>wal_receiver_status_interval</varname> configuration parameter</primary>
4953 </indexterm>
4954 </term>
4955 <listitem>
4956 <para>
4957 Specifies the minimum frequency for the WAL receiver
4958 process on the standby to send information about replication progress
4959 to the primary or upstream standby, where it can be seen using the
4960 <link linkend="monitoring-pg-stat-replication-view">
4961 <structname>pg_stat_replication</structname></link>
4962 view. The standby will report
4963 the last write-ahead log location it has written, the last position it
4964 has flushed to disk, and the last position it has applied.
4965 This parameter's value is the maximum amount of time between reports.
4966 Updates are sent each time the write or flush positions change, or as
4967 often as specified by this parameter if set to a non-zero value.
4968 There are additional cases where updates are sent while ignoring this
4969 parameter; for example, when processing of the existing WAL completes
4970 or when <varname>synchronous_commit</varname> is set to
4971 <literal>remote_apply</literal>.
4972 Thus, the apply position may lag slightly behind the true position.
4973 If this value is specified without units, it is taken as seconds.
4974 The default value is 10 seconds. This parameter can only be set in
4975 the <filename>postgresql.conf</filename> file or on the server
4976 command line.
4977 </para>
4978 </listitem>
4979 </varlistentry>
4981 <varlistentry id="guc-hot-standby-feedback" xreflabel="hot_standby_feedback">
4982 <term><varname>hot_standby_feedback</varname> (<type>boolean</type>)
4983 <indexterm>
4984 <primary><varname>hot_standby_feedback</varname> configuration parameter</primary>
4985 </indexterm>
4986 </term>
4987 <listitem>
4988 <para>
4989 Specifies whether or not a hot standby will send feedback to the primary
4990 or upstream standby
4991 about queries currently executing on the standby. This parameter can
4992 be used to eliminate query cancels caused by cleanup records, but
4993 can cause database bloat on the primary for some workloads.
4994 Feedback messages will not be sent more frequently than once per
4995 <varname>wal_receiver_status_interval</varname>. The default value is
4996 <literal>off</literal>. This parameter can only be set in the
4997 <filename>postgresql.conf</filename> file or on the server command line.
4998 </para>
4999 <para>
5000 If cascaded replication is in use the feedback is passed upstream
5001 until it eventually reaches the primary. Standbys make no other use
5002 of feedback they receive other than to pass upstream.
5003 </para>
5004 </listitem>
5005 </varlistentry>
5007 <varlistentry id="guc-wal-receiver-timeout" xreflabel="wal_receiver_timeout">
5008 <term><varname>wal_receiver_timeout</varname> (<type>integer</type>)
5009 <indexterm>
5010 <primary><varname>wal_receiver_timeout</varname> configuration parameter</primary>
5011 </indexterm>
5012 </term>
5013 <listitem>
5014 <para>
5015 Terminate replication connections that are inactive for longer
5016 than this amount of time. This is useful for
5017 the receiving standby server to detect a primary node crash or network
5018 outage.
5019 If this value is specified without units, it is taken as milliseconds.
5020 The default value is 60 seconds.
5021 A value of zero disables the timeout mechanism.
5022 This parameter can only be set in
5023 the <filename>postgresql.conf</filename> file or on the server
5024 command line.
5025 </para>
5026 </listitem>
5027 </varlistentry>
5029 <varlistentry id="guc-wal-retrieve-retry-interval" xreflabel="wal_retrieve_retry_interval">
5030 <term><varname>wal_retrieve_retry_interval</varname> (<type>integer</type>)
5031 <indexterm>
5032 <primary><varname>wal_retrieve_retry_interval</varname> configuration parameter</primary>
5033 </indexterm>
5034 </term>
5035 <listitem>
5036 <para>
5037 Specifies how long the standby server should wait when WAL data is not
5038 available from any sources (streaming replication,
5039 local <filename>pg_wal</filename> or WAL archive) before trying
5040 again to retrieve WAL data.
5041 If this value is specified without units, it is taken as milliseconds.
5042 The default value is 5 seconds.
5043 This parameter can only be set in
5044 the <filename>postgresql.conf</filename> file or on the server
5045 command line.
5046 </para>
5047 <para>
5048 This parameter is useful in configurations where a node in recovery
5049 needs to control the amount of time to wait for new WAL data to be
5050 available. For example, in archive recovery, it is possible to
5051 make the recovery more responsive in the detection of a new WAL
5052 file by reducing the value of this parameter. On a system with
5053 low WAL activity, increasing it reduces the amount of requests necessary
5054 to access WAL archives, something useful for example in cloud
5055 environments where the number of times an infrastructure is accessed
5056 is taken into account.
5057 </para>
5058 <para>
5059 In logical replication, this parameter also limits how often a failing
5060 replication apply worker will be respawned.
5061 </para>
5062 </listitem>
5063 </varlistentry>
5065 <varlistentry id="guc-recovery-min-apply-delay" xreflabel="recovery_min_apply_delay">
5066 <term><varname>recovery_min_apply_delay</varname> (<type>integer</type>)
5067 <indexterm>
5068 <primary><varname>recovery_min_apply_delay</varname> configuration parameter</primary>
5069 </indexterm>
5070 </term>
5071 <listitem>
5072 <para>
5073 By default, a standby server restores WAL records from the
5074 sending server as soon as possible. It may be useful to have a time-delayed
5075 copy of the data, offering opportunities to correct data loss errors.
5076 This parameter allows you to delay recovery by a specified amount
5077 of time. For example, if
5078 you set this parameter to <literal>5min</literal>, the standby will
5079 replay each transaction commit only when the system time on the standby
5080 is at least five minutes past the commit time reported by the primary.
5081 If this value is specified without units, it is taken as milliseconds.
5082 The default is zero, adding no delay.
5083 </para>
5084 <para>
5085 It is possible that the replication delay between servers exceeds the
5086 value of this parameter, in which case no delay is added.
5087 Note that the delay is calculated between the WAL time stamp as written
5088 on primary and the current time on the standby. Delays in transfer
5089 because of network lag or cascading replication configurations
5090 may reduce the actual wait time significantly. If the system
5091 clocks on primary and standby are not synchronized, this may lead to
5092 recovery applying records earlier than expected; but that is not a
5093 major issue because useful settings of this parameter are much larger
5094 than typical time deviations between servers.
5095 </para>
5096 <para>
5097 The delay occurs only on WAL records for transaction commits.
5098 Other records are replayed as quickly as possible, which
5099 is not a problem because MVCC visibility rules ensure their effects
5100 are not visible until the corresponding commit record is applied.
5101 </para>
5102 <para>
5103 The delay occurs once the database in recovery has reached a consistent
5104 state, until the standby is promoted or triggered. After that the standby
5105 will end recovery without further waiting.
5106 </para>
5107 <para>
5108 WAL records must be kept on the standby until they are ready to be
5109 applied. Therefore, longer delays will result in a greater accumulation
5110 of WAL files, increasing disk space requirements for the standby's
5111 <filename>pg_wal</filename> directory.
5112 </para>
5113 <para>
5114 This parameter is intended for use with streaming replication deployments;
5115 however, if the parameter is specified it will be honored in all cases
5116 except crash recovery.
5118 <varname>hot_standby_feedback</varname> will be delayed by use of this feature
5119 which could lead to bloat on the primary; use both together with care.
5121 <warning>
5122 <para>
5123 Synchronous replication is affected by this setting when <varname>synchronous_commit</varname>
5124 is set to <literal>remote_apply</literal>; every <literal>COMMIT</literal>
5125 will need to wait to be applied.
5126 </para>
5127 </warning>
5128 </para>
5129 <para>
5130 This parameter can only be set in the <filename>postgresql.conf</filename>
5131 file or on the server command line.
5132 </para>
5133 </listitem>
5134 </varlistentry>
5136 <varlistentry id="guc-sync-replication-slots" xreflabel="sync_replication_slots">
5137 <term><varname>sync_replication_slots</varname> (<type>boolean</type>)
5138 <indexterm>
5139 <primary><varname>sync_replication_slots</varname> configuration parameter</primary>
5140 </indexterm>
5141 </term>
5142 <listitem>
5143 <para>
5144 It enables a physical standby to synchronize logical failover slots
5145 from the primary server so that logical subscribers can resume
5146 replication from the new primary server after failover.
5147 </para>
5148 <para>
5149 It is disabled by default. This parameter can only be set in the
5150 <filename>postgresql.conf</filename> file or on the server command line.
5151 </para>
5152 </listitem>
5153 </varlistentry>
5154 </variablelist>
5155 </sect2>
5157 <sect2 id="runtime-config-replication-subscriber">
5158 <title>Subscribers</title>
5160 <para>
5161 These settings control the behavior of a logical replication subscriber.
5162 Their values on the publisher are irrelevant.
5163 See <xref linkend="logical-replication-config"/> for more details.
5164 </para>
5166 <variablelist>
5168 <varlistentry id="guc-max-replication-slots-subscriber" xreflabel="max_replication_slots">
5169 <term><varname>max_replication_slots</varname> (<type>integer</type>)
5170 <indexterm>
5171 <primary><varname>max_replication_slots</varname> configuration parameter</primary>
5172 <secondary>in a subscriber</secondary>
5173 </indexterm>
5174 </term>
5175 <listitem>
5176 <para>
5177 Specifies how many replication origins (see
5178 <xref linkend="replication-origins"/>) can be tracked simultaneously,
5179 effectively limiting how many logical replication subscriptions can
5180 be created on the server. Setting it to a lower value than the current
5181 number of tracked replication origins (reflected in
5182 <link linkend="view-pg-replication-origin-status">pg_replication_origin_status</link>)
5183 will prevent the server from starting.
5184 <literal>max_replication_slots</literal> must be set to at least the
5185 number of subscriptions that will be added to the subscriber, plus some
5186 reserve for table synchronization.
5187 </para>
5189 <para>
5190 Note that this parameter also applies on a sending server, but with
5191 a different meaning.
5192 </para>
5193 </listitem>
5194 </varlistentry>
5196 <varlistentry id="guc-max-logical-replication-workers" xreflabel="max_logical_replication_workers">
5197 <term><varname>max_logical_replication_workers</varname> (<type>integer</type>)
5198 <indexterm>
5199 <primary><varname>max_logical_replication_workers</varname> configuration parameter</primary>
5200 </indexterm>
5201 </term>
5202 <listitem>
5203 <para>
5204 Specifies maximum number of logical replication workers. This includes
5205 leader apply workers, parallel apply workers, and table synchronization
5206 workers.
5207 </para>
5208 <para>
5209 Logical replication workers are taken from the pool defined by
5210 <varname>max_worker_processes</varname>.
5211 </para>
5212 <para>
5213 The default value is 4. This parameter can only be set at server
5214 start.
5215 </para>
5216 </listitem>
5217 </varlistentry>
5219 <varlistentry id="guc-max-sync-workers-per-subscription" xreflabel="max_sync_workers_per_subscription">
5220 <term><varname>max_sync_workers_per_subscription</varname> (<type>integer</type>)
5221 <indexterm>
5222 <primary><varname>max_sync_workers_per_subscription</varname> configuration parameter</primary>
5223 </indexterm>
5224 </term>
5225 <listitem>
5226 <para>
5227 Maximum number of synchronization workers per subscription. This
5228 parameter controls the amount of parallelism of the initial data copy
5229 during the subscription initialization or when new tables are added.
5230 </para>
5231 <para>
5232 Currently, there can be only one synchronization worker per table.
5233 </para>
5234 <para>
5235 The synchronization workers are taken from the pool defined by
5236 <varname>max_logical_replication_workers</varname>.
5237 </para>
5238 <para>
5239 The default value is 2. This parameter can only be set in the
5240 <filename>postgresql.conf</filename> file or on the server command
5241 line.
5242 </para>
5243 </listitem>
5244 </varlistentry>
5246 <varlistentry id="guc-max-parallel-apply-workers-per-subscription" xreflabel="max_parallel_apply_workers_per_subscription">
5247 <term><varname>max_parallel_apply_workers_per_subscription</varname> (<type>integer</type>)
5248 <indexterm>
5249 <primary><varname>max_parallel_apply_workers_per_subscription</varname> configuration parameter</primary>
5250 </indexterm>
5251 </term>
5252 <listitem>
5253 <para>
5254 Maximum number of parallel apply workers per subscription. This
5255 parameter controls the amount of parallelism for streaming of
5256 in-progress transactions with subscription parameter
5257 <literal>streaming = parallel</literal>.
5258 </para>
5259 <para>
5260 The parallel apply workers are taken from the pool defined by
5261 <varname>max_logical_replication_workers</varname>.
5262 </para>
5263 <para>
5264 The default value is 2. This parameter can only be set in the
5265 <filename>postgresql.conf</filename> file or on the server command
5266 line.
5267 </para>
5268 </listitem>
5269 </varlistentry>
5271 </variablelist>
5272 </sect2>
5274 </sect1>
5276 <sect1 id="runtime-config-query">
5277 <title>Query Planning</title>
5279 <sect2 id="runtime-config-query-enable">
5280 <title>Planner Method Configuration</title>
5282 <para>
5283 These configuration parameters provide a crude method of
5284 influencing the query plans chosen by the query optimizer. If
5285 the default plan chosen by the optimizer for a particular query
5286 is not optimal, a <emphasis>temporary</emphasis> solution is to use one
5287 of these configuration parameters to force the optimizer to
5288 choose a different plan.
5289 Better ways to improve the quality of the
5290 plans chosen by the optimizer include adjusting the planner cost
5291 constants (see <xref linkend="runtime-config-query-constants"/>),
5292 running <link linkend="sql-analyze"><command>ANALYZE</command></link> manually, increasing
5293 the value of the <xref
5294 linkend="guc-default-statistics-target"/> configuration parameter,
5295 and increasing the amount of statistics collected for
5296 specific columns using <command>ALTER TABLE SET
5297 STATISTICS</command>.
5298 </para>
5300 <variablelist>
5301 <varlistentry id="guc-enable-async-append" xreflabel="enable_async_append">
5302 <term><varname>enable_async_append</varname> (<type>boolean</type>)
5303 <indexterm>
5304 <primary><varname>enable_async_append</varname> configuration parameter</primary>
5305 </indexterm>
5306 </term>
5307 <listitem>
5308 <para>
5309 Enables or disables the query planner's use of async-aware
5310 append plan types. The default is <literal>on</literal>.
5311 </para>
5312 </listitem>
5313 </varlistentry>
5315 <varlistentry id="guc-enable-bitmapscan" xreflabel="enable_bitmapscan">
5316 <term><varname>enable_bitmapscan</varname> (<type>boolean</type>)
5317 <indexterm>
5318 <primary>bitmap scan</primary>
5319 </indexterm>
5320 <indexterm>
5321 <primary><varname>enable_bitmapscan</varname> configuration parameter</primary>
5322 </indexterm>
5323 </term>
5324 <listitem>
5325 <para>
5326 Enables or disables the query planner's use of bitmap-scan plan
5327 types. The default is <literal>on</literal>.
5328 </para>
5329 </listitem>
5330 </varlistentry>
5332 <varlistentry id="guc-enable-gathermerge" xreflabel="enable_gathermerge">
5333 <term><varname>enable_gathermerge</varname> (<type>boolean</type>)
5334 <indexterm>
5335 <primary><varname>enable_gathermerge</varname> configuration parameter</primary>
5336 </indexterm>
5337 </term>
5338 <listitem>
5339 <para>
5340 Enables or disables the query planner's use of gather
5341 merge plan types. The default is <literal>on</literal>.
5342 </para>
5343 </listitem>
5344 </varlistentry>
5346 <varlistentry id="guc-enable-groupby-reordering" xreflabel="enable_group_by_reordering">
5347 <term><varname>enable_group_by_reordering</varname> (<type>boolean</type>)
5348 <indexterm>
5349 <primary><varname>enable_group_by_reordering</varname> configuration parameter</primary>
5350 </indexterm>
5351 </term>
5352 <listitem>
5353 <para>
5354 Controls if the query planner will produce a plan which will provide
5355 <literal>GROUP BY</literal> keys sorted in the order of keys of
5356 a child node of the plan, such as an index scan. When disabled, the
5357 query planner will produce a plan with <literal>GROUP BY</literal>
5358 keys only sorted to match the <literal>ORDER BY</literal> clause,
5359 if any. When enabled, the planner will try to produce a more
5360 efficient plan. The default value is <literal>on</literal>.
5361 </para>
5362 </listitem>
5363 </varlistentry>
5365 <varlistentry id="guc-enable-hashagg" xreflabel="enable_hashagg">
5366 <term><varname>enable_hashagg</varname> (<type>boolean</type>)
5367 <indexterm>
5368 <primary><varname>enable_hashagg</varname> configuration parameter</primary>
5369 </indexterm>
5370 </term>
5371 <listitem>
5372 <para>
5373 Enables or disables the query planner's use of hashed
5374 aggregation plan types. The default is <literal>on</literal>.
5375 </para>
5376 </listitem>
5377 </varlistentry>
5379 <varlistentry id="guc-enable-hashjoin" xreflabel="enable_hashjoin">
5380 <term><varname>enable_hashjoin</varname> (<type>boolean</type>)
5381 <indexterm>
5382 <primary><varname>enable_hashjoin</varname> configuration parameter</primary>
5383 </indexterm>
5384 </term>
5385 <listitem>
5386 <para>
5387 Enables or disables the query planner's use of hash-join plan
5388 types. The default is <literal>on</literal>.
5389 </para>
5390 </listitem>
5391 </varlistentry>
5393 <varlistentry id="guc-enable-incremental-sort" xreflabel="enable_incremental_sort">
5394 <term><varname>enable_incremental_sort</varname> (<type>boolean</type>)
5395 <indexterm>
5396 <primary><varname>enable_incremental_sort</varname> configuration parameter</primary>
5397 </indexterm>
5398 </term>
5399 <listitem>
5400 <para>
5401 Enables or disables the query planner's use of incremental sort steps.
5402 The default is <literal>on</literal>.
5403 </para>
5404 </listitem>
5405 </varlistentry>
5407 <varlistentry id="guc-enable-indexscan" xreflabel="enable_indexscan">
5408 <term><varname>enable_indexscan</varname> (<type>boolean</type>)
5409 <indexterm>
5410 <primary>index scan</primary>
5411 </indexterm>
5412 <indexterm>
5413 <primary><varname>enable_indexscan</varname> configuration parameter</primary>
5414 </indexterm>
5415 </term>
5416 <listitem>
5417 <para>
5418 Enables or disables the query planner's use of index-scan plan
5419 types. The default is <literal>on</literal>.
5420 </para>
5421 </listitem>
5422 </varlistentry>
5424 <varlistentry id="guc-enable-indexonlyscan" xreflabel="enable_indexonlyscan">
5425 <term><varname>enable_indexonlyscan</varname> (<type>boolean</type>)
5426 <indexterm>
5427 <primary><varname>enable_indexonlyscan</varname> configuration parameter</primary>
5428 </indexterm>
5429 </term>
5430 <listitem>
5431 <para>
5432 Enables or disables the query planner's use of index-only-scan plan
5433 types (see <xref linkend="indexes-index-only-scans"/>).
5434 The default is <literal>on</literal>.
5435 </para>
5436 </listitem>
5437 </varlistentry>
5439 <varlistentry id="guc-enable-material" xreflabel="enable_material">
5440 <term><varname>enable_material</varname> (<type>boolean</type>)
5441 <indexterm>
5442 <primary><varname>enable_material</varname> configuration parameter</primary>
5443 </indexterm>
5444 </term>
5445 <listitem>
5446 <para>
5447 Enables or disables the query planner's use of materialization.
5448 It is impossible to suppress materialization entirely,
5449 but turning this variable off prevents the planner from inserting
5450 materialize nodes except in cases where it is required for correctness.
5451 The default is <literal>on</literal>.
5452 </para>
5453 </listitem>
5454 </varlistentry>
5456 <varlistentry id="guc-enable-memoize" xreflabel="enable_memoize">
5457 <term><varname>enable_memoize</varname> (<type>boolean</type>)
5458 <indexterm>
5459 <primary><varname>enable_memoize</varname> configuration parameter</primary>
5460 </indexterm>
5461 </term>
5462 <listitem>
5463 <para>
5464 Enables or disables the query planner's use of memoize plans for
5465 caching results from parameterized scans inside nested-loop joins.
5466 This plan type allows scans to the underlying plans to be skipped when
5467 the results for the current parameters are already in the cache. Less
5468 commonly looked up results may be evicted from the cache when more
5469 space is required for new entries. The default is
5470 <literal>on</literal>.
5471 </para>
5472 </listitem>
5473 </varlistentry>
5475 <varlistentry id="guc-enable-mergejoin" xreflabel="enable_mergejoin">
5476 <term><varname>enable_mergejoin</varname> (<type>boolean</type>)
5477 <indexterm>
5478 <primary><varname>enable_mergejoin</varname> configuration parameter</primary>
5479 </indexterm>
5480 </term>
5481 <listitem>
5482 <para>
5483 Enables or disables the query planner's use of merge-join plan
5484 types. The default is <literal>on</literal>.
5485 </para>
5486 </listitem>
5487 </varlistentry>
5489 <varlistentry id="guc-enable-nestloop" xreflabel="enable_nestloop">
5490 <term><varname>enable_nestloop</varname> (<type>boolean</type>)
5491 <indexterm>
5492 <primary><varname>enable_nestloop</varname> configuration parameter</primary>
5493 </indexterm>
5494 </term>
5495 <listitem>
5496 <para>
5497 Enables or disables the query planner's use of nested-loop join
5498 plans. It is impossible to suppress nested-loop joins entirely,
5499 but turning this variable off discourages the planner from using
5500 one if there are other methods available. The default is
5501 <literal>on</literal>.
5502 </para>
5503 </listitem>
5504 </varlistentry>
5506 <varlistentry id="guc-enable-parallel-append" xreflabel="enable_parallel_append">
5507 <term><varname>enable_parallel_append</varname> (<type>boolean</type>)
5508 <indexterm>
5509 <primary><varname>enable_parallel_append</varname> configuration parameter</primary>
5510 </indexterm>
5511 </term>
5512 <listitem>
5513 <para>
5514 Enables or disables the query planner's use of parallel-aware
5515 append plan types. The default is <literal>on</literal>.
5516 </para>
5517 </listitem>
5518 </varlistentry>
5520 <varlistentry id="guc-enable-parallel-hash" xreflabel="enable_parallel_hash">
5521 <term><varname>enable_parallel_hash</varname> (<type>boolean</type>)
5522 <indexterm>
5523 <primary><varname>enable_parallel_hash</varname> configuration parameter</primary>
5524 </indexterm>
5525 </term>
5526 <listitem>
5527 <para>
5528 Enables or disables the query planner's use of hash-join plan
5529 types with parallel hash. Has no effect if hash-join plans are not
5530 also enabled. The default is <literal>on</literal>.
5531 </para>
5532 </listitem>
5533 </varlistentry>
5535 <varlistentry id="guc-enable-partition-pruning" xreflabel="enable_partition_pruning">
5536 <term><varname>enable_partition_pruning</varname> (<type>boolean</type>)
5537 <indexterm>
5538 <primary><varname>enable_partition_pruning</varname> configuration parameter</primary>
5539 </indexterm>
5540 </term>
5541 <listitem>
5542 <para>
5543 Enables or disables the query planner's ability to eliminate a
5544 partitioned table's partitions from query plans. This also controls
5545 the planner's ability to generate query plans which allow the query
5546 executor to remove (ignore) partitions during query execution. The
5547 default is <literal>on</literal>.
5548 See <xref linkend="ddl-partition-pruning"/> for details.
5549 </para>
5550 </listitem>
5551 </varlistentry>
5553 <varlistentry id="guc-enable-partitionwise-join" xreflabel="enable_partitionwise_join">
5554 <term><varname>enable_partitionwise_join</varname> (<type>boolean</type>)
5555 <indexterm>
5556 <primary><varname>enable_partitionwise_join</varname> configuration parameter</primary>
5557 </indexterm>
5558 </term>
5559 <listitem>
5560 <para>
5561 Enables or disables the query planner's use of partitionwise join,
5562 which allows a join between partitioned tables to be performed by
5563 joining the matching partitions. Partitionwise join currently applies
5564 only when the join conditions include all the partition keys, which
5565 must be of the same data type and have one-to-one matching sets of
5566 child partitions. With this setting enabled, the number of nodes
5567 whose memory usage is restricted by <varname>work_mem</varname>
5568 appearing in the final plan can increase linearly according to the
5569 number of partitions being scanned. This can result in a large
5570 increase in overall memory consumption during the execution of the
5571 query. Query planning also becomes significantly more expensive in
5572 terms of memory and CPU. The default value is <literal>off</literal>.
5573 </para>
5574 </listitem>
5575 </varlistentry>
5577 <varlistentry id="guc-enable-partitionwise-aggregate" xreflabel="enable_partitionwise_aggregate">
5578 <term><varname>enable_partitionwise_aggregate</varname> (<type>boolean</type>)
5579 <indexterm>
5580 <primary><varname>enable_partitionwise_aggregate</varname> configuration parameter</primary>
5581 </indexterm>
5582 </term>
5583 <listitem>
5584 <para>
5585 Enables or disables the query planner's use of partitionwise grouping
5586 or aggregation, which allows grouping or aggregation on partitioned
5587 tables to be performed separately for each partition. If the
5588 <literal>GROUP BY</literal> clause does not include the partition
5589 keys, only partial aggregation can be performed on a per-partition
5590 basis, and finalization must be performed later. With this setting
5591 enabled, the number of nodes whose memory usage is restricted by
5592 <varname>work_mem</varname> appearing in the final plan can increase
5593 linearly according to the number of partitions being scanned. This
5594 can result in a large increase in overall memory consumption during
5595 the execution of the query. Query planning also becomes significantly
5596 more expensive in terms of memory and CPU. The default value is
5597 <literal>off</literal>.
5598 </para>
5599 </listitem>
5600 </varlistentry>
5602 <varlistentry id="guc-enable-presorted-aggregate" xreflabel="enable_presorted_aggregate">
5603 <term><varname>enable_presorted_aggregate</varname> (<type>boolean</type>)
5604 <indexterm>
5605 <primary><varname>enable_presorted_aggregate</varname> configuration parameter</primary>
5606 </indexterm>
5607 </term>
5608 <listitem>
5609 <para>
5610 Controls if the query planner will produce a plan which will provide
5611 rows which are presorted in the order required for the query's
5612 <literal>ORDER BY</literal> / <literal>DISTINCT</literal> aggregate
5613 functions. When disabled, the query planner will produce a plan which
5614 will always require the executor to perform a sort before performing
5615 aggregation of each aggregate function containing an
5616 <literal>ORDER BY</literal> or <literal>DISTINCT</literal> clause.
5617 When enabled, the planner will try to produce a more efficient plan
5618 which provides input to the aggregate functions which is presorted in
5619 the order they require for aggregation. The default value is
5620 <literal>on</literal>.
5621 </para>
5622 </listitem>
5623 </varlistentry>
5625 <varlistentry id="guc-enable-seqscan" xreflabel="enable_seqscan">
5626 <term><varname>enable_seqscan</varname> (<type>boolean</type>)
5627 <indexterm>
5628 <primary>sequential scan</primary>
5629 </indexterm>
5630 <indexterm>
5631 <primary><varname>enable_seqscan</varname> configuration parameter</primary>
5632 </indexterm>
5633 </term>
5634 <listitem>
5635 <para>
5636 Enables or disables the query planner's use of sequential scan
5637 plan types. It is impossible to suppress sequential scans
5638 entirely, but turning this variable off discourages the planner
5639 from using one if there are other methods available. The
5640 default is <literal>on</literal>.
5641 </para>
5642 </listitem>
5643 </varlistentry>
5645 <varlistentry id="guc-enable-sort" xreflabel="enable_sort">
5646 <term><varname>enable_sort</varname> (<type>boolean</type>)
5647 <indexterm>
5648 <primary><varname>enable_sort</varname> configuration parameter</primary>
5649 </indexterm>
5650 </term>
5651 <listitem>
5652 <para>
5653 Enables or disables the query planner's use of explicit sort
5654 steps. It is impossible to suppress explicit sorts entirely,
5655 but turning this variable off discourages the planner from
5656 using one if there are other methods available. The default
5657 is <literal>on</literal>.
5658 </para>
5659 </listitem>
5660 </varlistentry>
5662 <varlistentry id="guc-enable-tidscan" xreflabel="enable_tidscan">
5663 <term><varname>enable_tidscan</varname> (<type>boolean</type>)
5664 <indexterm>
5665 <primary><varname>enable_tidscan</varname> configuration parameter</primary>
5666 </indexterm>
5667 </term>
5668 <listitem>
5669 <para>
5670 Enables or disables the query planner's use of <acronym>TID</acronym>
5671 scan plan types. The default is <literal>on</literal>.
5672 </para>
5673 </listitem>
5674 </varlistentry>
5676 </variablelist>
5677 </sect2>
5678 <sect2 id="runtime-config-query-constants">
5679 <title>Planner Cost Constants</title>
5681 <para>
5682 The <firstterm>cost</firstterm> variables described in this section are measured
5683 on an arbitrary scale. Only their relative values matter, hence
5684 scaling them all up or down by the same factor will result in no change
5685 in the planner's choices. By default, these cost variables are based on
5686 the cost of sequential page fetches; that is,
5687 <varname>seq_page_cost</varname> is conventionally set to <literal>1.0</literal>
5688 and the other cost variables are set with reference to that. But
5689 you can use a different scale if you prefer, such as actual execution
5690 times in milliseconds on a particular machine.
5691 </para>
5693 <note>
5694 <para>
5695 Unfortunately, there is no well-defined method for determining ideal
5696 values for the cost variables. They are best treated as averages over
5697 the entire mix of queries that a particular installation will receive. This
5698 means that changing them on the basis of just a few experiments is very
5699 risky.
5700 </para>
5701 </note>
5703 <variablelist>
5705 <varlistentry id="guc-seq-page-cost" xreflabel="seq_page_cost">
5706 <term><varname>seq_page_cost</varname> (<type>floating point</type>)
5707 <indexterm>
5708 <primary><varname>seq_page_cost</varname> configuration parameter</primary>
5709 </indexterm>
5710 </term>
5711 <listitem>
5712 <para>
5713 Sets the planner's estimate of the cost of a disk page fetch
5714 that is part of a series of sequential fetches. The default is 1.0.
5715 This value can be overridden for tables and indexes in a particular
5716 tablespace by setting the tablespace parameter of the same name
5717 (see <xref linkend="sql-altertablespace"/>).
5718 </para>
5719 </listitem>
5720 </varlistentry>
5722 <varlistentry id="guc-random-page-cost" xreflabel="random_page_cost">
5723 <term><varname>random_page_cost</varname> (<type>floating point</type>)
5724 <indexterm>
5725 <primary><varname>random_page_cost</varname> configuration parameter</primary>
5726 </indexterm>
5727 </term>
5728 <listitem>
5729 <para>
5730 Sets the planner's estimate of the cost of a
5731 non-sequentially-fetched disk page. The default is 4.0.
5732 This value can be overridden for tables and indexes in a particular
5733 tablespace by setting the tablespace parameter of the same name
5734 (see <xref linkend="sql-altertablespace"/>).
5735 </para>
5737 <para>
5738 Reducing this value relative to <varname>seq_page_cost</varname>
5739 will cause the system to prefer index scans; raising it will
5740 make index scans look relatively more expensive. You can raise
5741 or lower both values together to change the importance of disk I/O
5742 costs relative to CPU costs, which are described by the following
5743 parameters.
5744 </para>
5746 <para>
5747 Random access to mechanical disk storage is normally much more expensive
5748 than four times sequential access. However, a lower default is used
5749 (4.0) because the majority of random accesses to disk, such as indexed
5750 reads, are assumed to be in cache. The default value can be thought of
5751 as modeling random access as 40 times slower than sequential, while
5752 expecting 90% of random reads to be cached.
5753 </para>
5755 <para>
5756 If you believe a 90% cache rate is an incorrect assumption
5757 for your workload, you can increase random_page_cost to better
5758 reflect the true cost of random storage reads. Correspondingly,
5759 if your data is likely to be completely in cache, such as when
5760 the database is smaller than the total server memory, decreasing
5761 random_page_cost can be appropriate. Storage that has a low random
5762 read cost relative to sequential, e.g., solid-state drives, might
5763 also be better modeled with a lower value for random_page_cost,
5764 e.g., <literal>1.1</literal>.
5765 </para>
5767 <tip>
5768 <para>
5769 Although the system will let you set <varname>random_page_cost</varname> to
5770 less than <varname>seq_page_cost</varname>, it is not physically sensible
5771 to do so. However, setting them equal makes sense if the database
5772 is entirely cached in RAM, since in that case there is no penalty
5773 for touching pages out of sequence. Also, in a heavily-cached
5774 database you should lower both values relative to the CPU parameters,
5775 since the cost of fetching a page already in RAM is much smaller
5776 than it would normally be.
5777 </para>
5778 </tip>
5779 </listitem>
5780 </varlistentry>
5782 <varlistentry id="guc-cpu-tuple-cost" xreflabel="cpu_tuple_cost">
5783 <term><varname>cpu_tuple_cost</varname> (<type>floating point</type>)
5784 <indexterm>
5785 <primary><varname>cpu_tuple_cost</varname> configuration parameter</primary>
5786 </indexterm>
5787 </term>
5788 <listitem>
5789 <para>
5790 Sets the planner's estimate of the cost of processing
5791 each row during a query.
5792 The default is 0.01.
5793 </para>
5794 </listitem>
5795 </varlistentry>
5797 <varlistentry id="guc-cpu-index-tuple-cost" xreflabel="cpu_index_tuple_cost">
5798 <term><varname>cpu_index_tuple_cost</varname> (<type>floating point</type>)
5799 <indexterm>
5800 <primary><varname>cpu_index_tuple_cost</varname> configuration parameter</primary>
5801 </indexterm>
5802 </term>
5803 <listitem>
5804 <para>
5805 Sets the planner's estimate of the cost of processing
5806 each index entry during an index scan.
5807 The default is 0.005.
5808 </para>
5809 </listitem>
5810 </varlistentry>
5812 <varlistentry id="guc-cpu-operator-cost" xreflabel="cpu_operator_cost">
5813 <term><varname>cpu_operator_cost</varname> (<type>floating point</type>)
5814 <indexterm>
5815 <primary><varname>cpu_operator_cost</varname> configuration parameter</primary>
5816 </indexterm>
5817 </term>
5818 <listitem>
5819 <para>
5820 Sets the planner's estimate of the cost of processing each
5821 operator or function executed during a query.
5822 The default is 0.0025.
5823 </para>
5824 </listitem>
5825 </varlistentry>
5827 <varlistentry id="guc-parallel-setup-cost" xreflabel="parallel_setup_cost">
5828 <term><varname>parallel_setup_cost</varname> (<type>floating point</type>)
5829 <indexterm>
5830 <primary><varname>parallel_setup_cost</varname> configuration parameter</primary>
5831 </indexterm>
5832 </term>
5833 <listitem>
5834 <para>
5835 Sets the planner's estimate of the cost of launching parallel worker
5836 processes.
5837 The default is 1000.
5838 </para>
5839 </listitem>
5840 </varlistentry>
5842 <varlistentry id="guc-parallel-tuple-cost" xreflabel="parallel_tuple_cost">
5843 <term><varname>parallel_tuple_cost</varname> (<type>floating point</type>)
5844 <indexterm>
5845 <primary><varname>parallel_tuple_cost</varname> configuration parameter</primary>
5846 </indexterm>
5847 </term>
5848 <listitem>
5849 <para>
5850 Sets the planner's estimate of the cost of transferring one tuple
5851 from a parallel worker process to another process.
5852 The default is 0.1.
5853 </para>
5854 </listitem>
5855 </varlistentry>
5857 <varlistentry id="guc-min-parallel-table-scan-size" xreflabel="min_parallel_table_scan_size">
5858 <term><varname>min_parallel_table_scan_size</varname> (<type>integer</type>)
5859 <indexterm>
5860 <primary><varname>min_parallel_table_scan_size</varname> configuration parameter</primary>
5861 </indexterm>
5862 </term>
5863 <listitem>
5864 <para>
5865 Sets the minimum amount of table data that must be scanned in order
5866 for a parallel scan to be considered. For a parallel sequential scan,
5867 the amount of table data scanned is always equal to the size of the
5868 table, but when indexes are used the amount of table data
5869 scanned will normally be less.
5870 If this value is specified without units, it is taken as blocks,
5871 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
5872 The default is 8 megabytes (<literal>8MB</literal>).
5873 </para>
5874 </listitem>
5875 </varlistentry>
5877 <varlistentry id="guc-min-parallel-index-scan-size" xreflabel="min_parallel_index_scan_size">
5878 <term><varname>min_parallel_index_scan_size</varname> (<type>integer</type>)
5879 <indexterm>
5880 <primary><varname>min_parallel_index_scan_size</varname> configuration parameter</primary>
5881 </indexterm>
5882 </term>
5883 <listitem>
5884 <para>
5885 Sets the minimum amount of index data that must be scanned in order
5886 for a parallel scan to be considered. Note that a parallel index scan
5887 typically won't touch the entire index; it is the number of pages
5888 which the planner believes will actually be touched by the scan which
5889 is relevant. This parameter is also used to decide whether a
5890 particular index can participate in a parallel vacuum. See
5891 <xref linkend="sql-vacuum"/>.
5892 If this value is specified without units, it is taken as blocks,
5893 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
5894 The default is 512 kilobytes (<literal>512kB</literal>).
5895 </para>
5896 </listitem>
5897 </varlistentry>
5899 <varlistentry id="guc-effective-cache-size" xreflabel="effective_cache_size">
5900 <term><varname>effective_cache_size</varname> (<type>integer</type>)
5901 <indexterm>
5902 <primary><varname>effective_cache_size</varname> configuration parameter</primary>
5903 </indexterm>
5904 </term>
5905 <listitem>
5906 <para>
5907 Sets the planner's assumption about the effective size of the
5908 disk cache that is available to a single query. This is
5909 factored into estimates of the cost of using an index; a
5910 higher value makes it more likely index scans will be used, a
5911 lower value makes it more likely sequential scans will be
5912 used. When setting this parameter you should consider both
5913 <productname>PostgreSQL</productname>'s shared buffers and the
5914 portion of the kernel's disk cache that will be used for
5915 <productname>PostgreSQL</productname> data files, though some
5916 data might exist in both places. Also, take
5917 into account the expected number of concurrent queries on different
5918 tables, since they will have to share the available
5919 space. This parameter has no effect on the size of shared
5920 memory allocated by <productname>PostgreSQL</productname>, nor
5921 does it reserve kernel disk cache; it is used only for estimation
5922 purposes. The system also does not assume data remains in
5923 the disk cache between queries.
5924 If this value is specified without units, it is taken as blocks,
5925 that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
5926 The default is 4 gigabytes (<literal>4GB</literal>).
5927 (If <symbol>BLCKSZ</symbol> is not 8kB, the default value scales
5928 proportionally to it.)
5929 </para>
5930 </listitem>
5931 </varlistentry>
5933 <varlistentry id="guc-jit-above-cost" xreflabel="jit_above_cost">
5934 <term><varname>jit_above_cost</varname> (<type>floating point</type>)
5935 <indexterm>
5936 <primary><varname>jit_above_cost</varname> configuration parameter</primary>
5937 </indexterm>
5938 </term>
5939 <listitem>
5940 <para>
5941 Sets the query cost above which JIT compilation is activated, if
5942 enabled (see <xref linkend="jit"/>).
5943 Performing <acronym>JIT</acronym> costs planning time but can
5944 accelerate query execution.
5945 Setting this to <literal>-1</literal> disables JIT compilation.
5946 The default is <literal>100000</literal>.
5947 </para>
5948 </listitem>
5949 </varlistentry>
5951 <varlistentry id="guc-jit-inline-above-cost" xreflabel="jit_inline_above_cost">
5952 <term><varname>jit_inline_above_cost</varname> (<type>floating point</type>)
5953 <indexterm>
5954 <primary><varname>jit_inline_above_cost</varname> configuration parameter</primary>
5955 </indexterm>
5956 </term>
5957 <listitem>
5958 <para>
5959 Sets the query cost above which JIT compilation attempts to inline
5960 functions and operators. Inlining adds planning time, but can
5961 improve execution speed. It is not meaningful to set this to less
5962 than <varname>jit_above_cost</varname>.
5963 Setting this to <literal>-1</literal> disables inlining.
5964 The default is <literal>500000</literal>.
5965 </para>
5966 </listitem>
5967 </varlistentry>
5969 <varlistentry id="guc-jit-optimize-above-cost" xreflabel="jit_optimize_above_cost">
5970 <term><varname>jit_optimize_above_cost</varname> (<type>floating point</type>)
5971 <indexterm>
5972 <primary><varname>jit_optimize_above_cost</varname> configuration parameter</primary>
5973 </indexterm>
5974 </term>
5975 <listitem>
5976 <para>
5977 Sets the query cost above which JIT compilation applies expensive
5978 optimizations. Such optimization adds planning time, but can improve
5979 execution speed. It is not meaningful to set this to less
5980 than <varname>jit_above_cost</varname>, and it is unlikely to be
5981 beneficial to set it to more
5982 than <varname>jit_inline_above_cost</varname>.
5983 Setting this to <literal>-1</literal> disables expensive optimizations.
5984 The default is <literal>500000</literal>.
5985 </para>
5986 </listitem>
5987 </varlistentry>
5989 </variablelist>
5991 </sect2>
5992 <sect2 id="runtime-config-query-geqo">
5993 <title>Genetic Query Optimizer</title>
5995 <para>
5996 The genetic query optimizer (GEQO) is an algorithm that does query
5997 planning using heuristic searching. This reduces planning time for
5998 complex queries (those joining many relations), at the cost of producing
5999 plans that are sometimes inferior to those found by the normal
6000 exhaustive-search algorithm.
6001 For more information see <xref linkend="geqo"/>.
6002 </para>
6004 <variablelist>
6006 <varlistentry id="guc-geqo" xreflabel="geqo">
6007 <term><varname>geqo</varname> (<type>boolean</type>)
6008 <indexterm>
6009 <primary>genetic query optimization</primary>
6010 </indexterm>
6011 <indexterm>
6012 <primary>GEQO</primary>
6013 <see>genetic query optimization</see>
6014 </indexterm>
6015 <indexterm>
6016 <primary><varname>geqo</varname> configuration parameter</primary>
6017 </indexterm>
6018 </term>
6019 <listitem>
6020 <para>
6021 Enables or disables genetic query optimization.
6022 This is on by default. It is usually best not to turn it off in
6023 production; the <varname>geqo_threshold</varname> variable provides
6024 more granular control of GEQO.
6025 </para>
6026 </listitem>
6027 </varlistentry>
6029 <varlistentry id="guc-geqo-threshold" xreflabel="geqo_threshold">
6030 <term><varname>geqo_threshold</varname> (<type>integer</type>)
6031 <indexterm>
6032 <primary><varname>geqo_threshold</varname> configuration parameter</primary>
6033 </indexterm>
6034 </term>
6035 <listitem>
6036 <para>
6037 Use genetic query optimization to plan queries with at least
6038 this many <literal>FROM</literal> items involved. (Note that a
6039 <literal>FULL OUTER JOIN</literal> construct counts as only one <literal>FROM</literal>
6040 item.) The default is 12. For simpler queries it is usually best
6041 to use the regular, exhaustive-search planner, but for queries with
6042 many tables the exhaustive search takes too long, often
6043 longer than the penalty of executing a suboptimal plan. Thus,
6044 a threshold on the size of the query is a convenient way to manage
6045 use of GEQO.
6046 </para>
6047 </listitem>
6048 </varlistentry>
6050 <varlistentry id="guc-geqo-effort" xreflabel="geqo_effort">
6051 <term><varname>geqo_effort</varname> (<type>integer</type>)
6052 <indexterm>
6053 <primary><varname>geqo_effort</varname> configuration parameter</primary>
6054 </indexterm>
6055 </term>
6056 <listitem>
6057 <para>
6058 Controls the trade-off between planning time and query plan
6059 quality in GEQO. This variable must be an integer in the
6060 range from 1 to 10. The default value is five. Larger values
6061 increase the time spent doing query planning, but also
6062 increase the likelihood that an efficient query plan will be
6063 chosen.
6064 </para>
6066 <para>
6067 <varname>geqo_effort</varname> doesn't actually do anything
6068 directly; it is only used to compute the default values for
6069 the other variables that influence GEQO behavior (described
6070 below). If you prefer, you can set the other parameters by
6071 hand instead.
6072 </para>
6073 </listitem>
6074 </varlistentry>
6076 <varlistentry id="guc-geqo-pool-size" xreflabel="geqo_pool_size">
6077 <term><varname>geqo_pool_size</varname> (<type>integer</type>)
6078 <indexterm>
6079 <primary><varname>geqo_pool_size</varname> configuration parameter</primary>
6080 </indexterm>
6081 </term>
6082 <listitem>
6083 <para>
6084 Controls the pool size used by GEQO, that is the
6085 number of individuals in the genetic population. It must be
6086 at least two, and useful values are typically 100 to 1000. If
6087 it is set to zero (the default setting) then a suitable
6088 value is chosen based on <varname>geqo_effort</varname> and
6089 the number of tables in the query.
6090 </para>
6091 </listitem>
6092 </varlistentry>
6094 <varlistentry id="guc-geqo-generations" xreflabel="geqo_generations">
6095 <term><varname>geqo_generations</varname> (<type>integer</type>)
6096 <indexterm>
6097 <primary><varname>geqo_generations</varname> configuration parameter</primary>
6098 </indexterm>
6099 </term>
6100 <listitem>
6101 <para>
6102 Controls the number of generations used by GEQO, that is
6103 the number of iterations of the algorithm. It must
6104 be at least one, and useful values are in the same range as
6105 the pool size. If it is set to zero (the default setting)
6106 then a suitable value is chosen based on
6107 <varname>geqo_pool_size</varname>.
6108 </para>
6109 </listitem>
6110 </varlistentry>
6112 <varlistentry id="guc-geqo-selection-bias" xreflabel="geqo_selection_bias">
6113 <term><varname>geqo_selection_bias</varname> (<type>floating point</type>)
6114 <indexterm>
6115 <primary><varname>geqo_selection_bias</varname> configuration parameter</primary>
6116 </indexterm>
6117 </term>
6118 <listitem>
6119 <para>
6120 Controls the selection bias used by GEQO. The selection bias
6121 is the selective pressure within the population. Values can be
6122 from 1.50 to 2.00; the latter is the default.
6123 </para>
6124 </listitem>
6125 </varlistentry>
6127 <varlistentry id="guc-geqo-seed" xreflabel="geqo_seed">
6128 <term><varname>geqo_seed</varname> (<type>floating point</type>)
6129 <indexterm>
6130 <primary><varname>geqo_seed</varname> configuration parameter</primary>
6131 </indexterm>
6132 </term>
6133 <listitem>
6134 <para>
6135 Controls the initial value of the random number generator used
6136 by GEQO to select random paths through the join order search space.
6137 The value can range from zero (the default) to one. Varying the
6138 value changes the set of join paths explored, and may result in a
6139 better or worse best path being found.
6140 </para>
6141 </listitem>
6142 </varlistentry>
6144 </variablelist>
6145 </sect2>
6146 <sect2 id="runtime-config-query-other">
6147 <title>Other Planner Options</title>
6149 <variablelist>
6151 <varlistentry id="guc-default-statistics-target" xreflabel="default_statistics_target">
6152 <term><varname>default_statistics_target</varname> (<type>integer</type>)
6153 <indexterm>
6154 <primary><varname>default_statistics_target</varname> configuration parameter</primary>
6155 </indexterm>
6156 </term>
6157 <listitem>
6158 <para>
6159 Sets the default statistics target for table columns without
6160 a column-specific target set via <command>ALTER TABLE
6161 SET STATISTICS</command>. Larger values increase the time needed to
6162 do <command>ANALYZE</command>, but might improve the quality of the
6163 planner's estimates. The default is 100. For more information
6164 on the use of statistics by the <productname>PostgreSQL</productname>
6165 query planner, refer to <xref linkend="planner-stats"/>.
6166 </para>
6167 </listitem>
6168 </varlistentry>
6170 <varlistentry id="guc-constraint-exclusion" xreflabel="constraint_exclusion">
6171 <term><varname>constraint_exclusion</varname> (<type>enum</type>)
6172 <indexterm>
6173 <primary>constraint exclusion</primary>
6174 </indexterm>
6175 <indexterm>
6176 <primary><varname>constraint_exclusion</varname> configuration parameter</primary>
6177 </indexterm>
6178 </term>
6179 <listitem>
6180 <para>
6181 Controls the query planner's use of table constraints to
6182 optimize queries.
6183 The allowed values of <varname>constraint_exclusion</varname> are
6184 <literal>on</literal> (examine constraints for all tables),
6185 <literal>off</literal> (never examine constraints), and
6186 <literal>partition</literal> (examine constraints only for inheritance
6187 child tables and <literal>UNION ALL</literal> subqueries).
6188 <literal>partition</literal> is the default setting.
6189 It is often used with traditional inheritance trees to improve
6190 performance.
6191 </para>
6193 <para>
6194 When this parameter allows it for a particular table, the planner
6195 compares query conditions with the table's <literal>CHECK</literal>
6196 constraints, and omits scanning tables for which the conditions
6197 contradict the constraints. For example:
6199 <programlisting>
6200 CREATE TABLE parent(key integer, ...);
6201 CREATE TABLE child1000(check (key between 1000 and 1999)) INHERITS(parent);
6202 CREATE TABLE child2000(check (key between 2000 and 2999)) INHERITS(parent);
6204 SELECT * FROM parent WHERE key = 2400;
6205 </programlisting>
6207 With constraint exclusion enabled, this <command>SELECT</command>
6208 will not scan <structname>child1000</structname> at all, improving performance.
6209 </para>
6211 <para>
6212 Currently, constraint exclusion is enabled by default
6213 only for cases that are often used to implement table partitioning via
6214 inheritance trees. Turning it on for all tables imposes extra
6215 planning overhead that is quite noticeable on simple queries, and most
6216 often will yield no benefit for simple queries. If you have no
6217 tables that are partitioned using traditional inheritance, you might
6218 prefer to turn it off entirely. (Note that the equivalent feature for
6219 partitioned tables is controlled by a separate parameter,
6220 <xref linkend="guc-enable-partition-pruning"/>.)
6221 </para>
6223 <para>
6224 Refer to <xref linkend="ddl-partitioning-constraint-exclusion"/> for
6225 more information on using constraint exclusion to implement
6226 partitioning.
6227 </para>
6228 </listitem>
6229 </varlistentry>
6231 <varlistentry id="guc-cursor-tuple-fraction" xreflabel="cursor_tuple_fraction">
6232 <term><varname>cursor_tuple_fraction</varname> (<type>floating point</type>)
6233 <indexterm>
6234 <primary><varname>cursor_tuple_fraction</varname> configuration parameter</primary>
6235 </indexterm>
6236 </term>
6237 <listitem>
6238 <para>
6239 Sets the planner's estimate of the fraction of a cursor's rows that
6240 will be retrieved. The default is 0.1. Smaller values of this
6241 setting bias the planner towards using <quote>fast start</quote> plans
6242 for cursors, which will retrieve the first few rows quickly while
6243 perhaps taking a long time to fetch all rows. Larger values
6244 put more emphasis on the total estimated time. At the maximum
6245 setting of 1.0, cursors are planned exactly like regular queries,
6246 considering only the total estimated time and not how soon the
6247 first rows might be delivered.
6248 </para>
6249 </listitem>
6250 </varlistentry>
6252 <varlistentry id="guc-from-collapse-limit" xreflabel="from_collapse_limit">
6253 <term><varname>from_collapse_limit</varname> (<type>integer</type>)
6254 <indexterm>
6255 <primary><varname>from_collapse_limit</varname> configuration parameter</primary>
6256 </indexterm>
6257 </term>
6258 <listitem>
6259 <para>
6260 The planner will merge sub-queries into upper queries if the
6261 resulting <literal>FROM</literal> list would have no more than
6262 this many items. Smaller values reduce planning time but might
6263 yield inferior query plans. The default is eight.
6264 For more information see <xref linkend="explicit-joins"/>.
6265 </para>
6267 <para>
6268 Setting this value to <xref linkend="guc-geqo-threshold"/> or more
6269 may trigger use of the GEQO planner, resulting in non-optimal
6270 plans. See <xref linkend="runtime-config-query-geqo"/>.
6271 </para>
6272 </listitem>
6273 </varlistentry>
6275 <varlistentry id="guc-jit" xreflabel="jit">
6276 <term><varname>jit</varname> (<type>boolean</type>)
6277 <indexterm>
6278 <primary><varname>jit</varname> configuration parameter</primary>
6279 </indexterm>
6280 </term>
6281 <listitem>
6282 <para>
6283 Determines whether <acronym>JIT</acronym> compilation may be used by
6284 <productname>PostgreSQL</productname>, if available (see <xref
6285 linkend="jit"/>).
6286 The default is <literal>on</literal>.
6287 </para>
6288 </listitem>
6289 </varlistentry>
6291 <varlistentry id="guc-join-collapse-limit" xreflabel="join_collapse_limit">
6292 <term><varname>join_collapse_limit</varname> (<type>integer</type>)
6293 <indexterm>
6294 <primary><varname>join_collapse_limit</varname> configuration parameter</primary>
6295 </indexterm>
6296 </term>
6297 <listitem>
6298 <para>
6299 The planner will rewrite explicit <literal>JOIN</literal>
6300 constructs (except <literal>FULL JOIN</literal>s) into lists of
6301 <literal>FROM</literal> items whenever a list of no more than this many items
6302 would result. Smaller values reduce planning time but might
6303 yield inferior query plans.
6304 </para>
6306 <para>
6307 By default, this variable is set the same as
6308 <varname>from_collapse_limit</varname>, which is appropriate
6309 for most uses. Setting it to 1 prevents any reordering of
6310 explicit <literal>JOIN</literal>s. Thus, the explicit join order
6311 specified in the query will be the actual order in which the
6312 relations are joined. Because the query planner does not always choose
6313 the optimal join order, advanced users can elect to
6314 temporarily set this variable to 1, and then specify the join
6315 order they desire explicitly.
6316 For more information see <xref linkend="explicit-joins"/>.
6317 </para>
6319 <para>
6320 Setting this value to <xref linkend="guc-geqo-threshold"/> or more
6321 may trigger use of the GEQO planner, resulting in non-optimal
6322 plans. See <xref linkend="runtime-config-query-geqo"/>.
6323 </para>
6324 </listitem>
6325 </varlistentry>
6327 <varlistentry id="guc-plan-cache-mode" xreflabel="plan_cache_mode">
6328 <term><varname>plan_cache_mode</varname> (<type>enum</type>)
6329 <indexterm>
6330 <primary><varname>plan_cache_mode</varname> configuration parameter</primary>
6331 </indexterm>
6332 </term>
6333 <listitem>
6334 <para>
6335 Prepared statements (either explicitly prepared or implicitly
6336 generated, for example by PL/pgSQL) can be executed using custom or
6337 generic plans. Custom plans are made afresh for each execution
6338 using its specific set of parameter values, while generic plans do
6339 not rely on the parameter values and can be re-used across
6340 executions. Thus, use of a generic plan saves planning time, but if
6341 the ideal plan depends strongly on the parameter values then a
6342 generic plan may be inefficient. The choice between these options
6343 is normally made automatically, but it can be overridden
6344 with <varname>plan_cache_mode</varname>.
6345 The allowed values are <literal>auto</literal> (the default),
6346 <literal>force_custom_plan</literal> and
6347 <literal>force_generic_plan</literal>.
6348 This setting is considered when a cached plan is to be executed,
6349 not when it is prepared.
6350 For more information see <xref linkend="sql-prepare"/>.
6351 </para>
6352 </listitem>
6353 </varlistentry>
6355 <varlistentry id="guc-recursive-worktable-factor" xreflabel="recursive_worktable_factor">
6356 <term><varname>recursive_worktable_factor</varname> (<type>floating point</type>)
6357 <indexterm>
6358 <primary><varname>recursive_worktable_factor</varname> configuration parameter</primary>
6359 </indexterm>
6360 </term>
6361 <listitem>
6362 <para>
6363 Sets the planner's estimate of the average size of the working
6364 table of a <link linkend="queries-with-recursive">recursive
6365 query</link>, as a multiple of the estimated size of the initial
6366 non-recursive term of the query. This helps the planner choose
6367 the most appropriate method for joining the working table to the
6368 query's other tables.
6369 The default value is <literal>10.0</literal>. A smaller value
6370 such as <literal>1.0</literal> can be helpful when the recursion
6371 has low <quote>fan-out</quote> from one step to the next, as for
6372 example in shortest-path queries. Graph analytics queries may
6373 benefit from larger-than-default values.
6374 </para>
6375 </listitem>
6376 </varlistentry>
6378 </variablelist>
6379 </sect2>
6380 </sect1>
6382 <sect1 id="runtime-config-logging">
6383 <title>Error Reporting and Logging</title>
6385 <indexterm zone="runtime-config-logging">
6386 <primary>server log</primary>
6387 </indexterm>
6389 <sect2 id="runtime-config-logging-where">
6390 <title>Where to Log</title>
6392 <indexterm zone="runtime-config-logging-where">
6393 <primary>where to log</primary>
6394 </indexterm>
6396 <indexterm>
6397 <primary>current_logfiles</primary>
6398 <secondary>and the log_destination configuration parameter</secondary>
6399 </indexterm>
6401 <variablelist>
6403 <varlistentry id="guc-log-destination" xreflabel="log_destination">
6404 <term><varname>log_destination</varname> (<type>string</type>)
6405 <indexterm>
6406 <primary><varname>log_destination</varname> configuration parameter</primary>
6407 </indexterm>
6408 </term>
6409 <listitem>
6410 <para>
6411 <productname>PostgreSQL</productname> supports several methods
6412 for logging server messages, including
6413 <systemitem>stderr</systemitem>, <systemitem>csvlog</systemitem>,
6414 <systemitem>jsonlog</systemitem>, and
6415 <systemitem>syslog</systemitem>. On Windows,
6416 <systemitem>eventlog</systemitem> is also supported. Set this
6417 parameter to a list of desired log destinations separated by
6418 commas. The default is to log to <systemitem>stderr</systemitem>
6419 only.
6420 This parameter can only be set in the <filename>postgresql.conf</filename>
6421 file or on the server command line.
6422 </para>
6423 <para>
6424 If <systemitem>csvlog</systemitem> is included in <varname>log_destination</varname>,
6425 log entries are output in <quote>comma separated
6426 value</quote> (<acronym>CSV</acronym>) format, which is convenient for
6427 loading logs into programs.
6428 See <xref linkend="runtime-config-logging-csvlog"/> for details.
6429 <xref linkend="guc-logging-collector"/> must be enabled to generate
6430 CSV-format log output.
6431 </para>
6432 <para>
6433 If <systemitem>jsonlog</systemitem> is included in
6434 <varname>log_destination</varname>, log entries are output in
6435 <acronym>JSON</acronym> format, which is convenient for loading logs
6436 into programs.
6437 See <xref linkend="runtime-config-logging-jsonlog"/> for details.
6438 <xref linkend="guc-logging-collector"/> must be enabled to generate
6439 JSON-format log output.
6440 </para>
6441 <para>
6442 When either <systemitem>stderr</systemitem>,
6443 <systemitem>csvlog</systemitem> or <systemitem>jsonlog</systemitem> are
6444 included, the file <filename>current_logfiles</filename> is created to
6445 record the location of the log file(s) currently in use by the logging
6446 collector and the associated logging destination. This provides a
6447 convenient way to find the logs currently in use by the instance. Here
6448 is an example of this file's content:
6449 <programlisting>
6450 stderr log/postgresql.log
6451 csvlog log/postgresql.csv
6452 jsonlog log/postgresql.json
6453 </programlisting>
6455 <filename>current_logfiles</filename> is recreated when a new log file
6456 is created as an effect of rotation, and
6457 when <varname>log_destination</varname> is reloaded. It is removed when
6458 none of <systemitem>stderr</systemitem>,
6459 <systemitem>csvlog</systemitem> or <systemitem>jsonlog</systemitem> are
6460 included in <varname>log_destination</varname>, and when the logging
6461 collector is disabled.
6462 </para>
6464 <note>
6465 <para>
6466 On most Unix systems, you will need to alter the configuration of
6467 your system's <application>syslog</application> daemon in order
6468 to make use of the <systemitem>syslog</systemitem> option for
6469 <varname>log_destination</varname>. <productname>PostgreSQL</productname>
6470 can log to <application>syslog</application> facilities
6471 <literal>LOCAL0</literal> through <literal>LOCAL7</literal> (see <xref
6472 linkend="guc-syslog-facility"/>), but the default
6473 <application>syslog</application> configuration on most platforms
6474 will discard all such messages. You will need to add something like:
6475 <programlisting>
6476 local0.* /var/log/postgresql
6477 </programlisting>
6478 to the <application>syslog</application> daemon's configuration file
6479 to make it work.
6480 </para>
6481 <para>
6482 On Windows, when you use the <literal>eventlog</literal>
6483 option for <varname>log_destination</varname>, you should
6484 register an event source and its library with the operating
6485 system so that the Windows Event Viewer can display event
6486 log messages cleanly.
6487 See <xref linkend="event-log-registration"/> for details.
6488 </para>
6489 </note>
6490 </listitem>
6491 </varlistentry>
6493 <varlistentry id="guc-logging-collector" xreflabel="logging_collector">
6494 <term><varname>logging_collector</varname> (<type>boolean</type>)
6495 <indexterm>
6496 <primary><varname>logging_collector</varname> configuration parameter</primary>
6497 </indexterm>
6498 </term>
6499 <listitem>
6500 <para>
6501 This parameter enables the <firstterm>logging collector</firstterm>, which
6502 is a background process that captures log messages
6503 sent to <systemitem>stderr</systemitem> and redirects them into log files.
6504 This approach is often more useful than
6505 logging to <application>syslog</application>, since some types of messages
6506 might not appear in <application>syslog</application> output. (One common
6507 example is dynamic-linker failure messages; another is error messages
6508 produced by scripts such as <varname>archive_command</varname>.)
6509 This parameter can only be set at server start.
6510 </para>
6512 <note>
6513 <para>
6514 It is possible to log to <systemitem>stderr</systemitem> without using the
6515 logging collector; the log messages will just go to wherever the
6516 server's <systemitem>stderr</systemitem> is directed. However, that method is
6517 only suitable for low log volumes, since it provides no convenient
6518 way to rotate log files. Also, on some platforms not using the
6519 logging collector can result in lost or garbled log output, because
6520 multiple processes writing concurrently to the same log file can
6521 overwrite each other's output.
6522 </para>
6523 </note>
6525 <note>
6526 <para>
6527 The logging collector is designed to never lose messages. This means
6528 that in case of extremely high load, server processes could be
6529 blocked while trying to send additional log messages when the
6530 collector has fallen behind. In contrast, <application>syslog</application>
6531 prefers to drop messages if it cannot write them, which means it
6532 may fail to log some messages in such cases but it will not block
6533 the rest of the system.
6534 </para>
6535 </note>
6537 </listitem>
6538 </varlistentry>
6540 <varlistentry id="guc-log-directory" xreflabel="log_directory">
6541 <term><varname>log_directory</varname> (<type>string</type>)
6542 <indexterm>
6543 <primary><varname>log_directory</varname> configuration parameter</primary>
6544 </indexterm>
6545 </term>
6546 <listitem>
6547 <para>
6548 When <varname>logging_collector</varname> is enabled,
6549 this parameter determines the directory in which log files will be created.
6550 It can be specified as an absolute path, or relative to the
6551 cluster data directory.
6552 This parameter can only be set in the <filename>postgresql.conf</filename>
6553 file or on the server command line.
6554 The default is <literal>log</literal>.
6555 </para>
6556 </listitem>
6557 </varlistentry>
6559 <varlistentry id="guc-log-filename" xreflabel="log_filename">
6560 <term><varname>log_filename</varname> (<type>string</type>)
6561 <indexterm>
6562 <primary><varname>log_filename</varname> configuration parameter</primary>
6563 </indexterm>
6564 </term>
6565 <listitem>
6566 <para>
6567 When <varname>logging_collector</varname> is enabled,
6568 this parameter sets the file names of the created log files. The value
6569 is treated as a <function>strftime</function> pattern,
6570 so <literal>%</literal>-escapes can be used to specify time-varying
6571 file names. (Note that if there are
6572 any time-zone-dependent <literal>%</literal>-escapes, the computation
6573 is done in the zone specified
6574 by <xref linkend="guc-log-timezone"/>.)
6575 The supported <literal>%</literal>-escapes are similar to those
6576 listed in the Open Group's <ulink
6577 url="https://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime
6578 </ulink> specification.
6579 Note that the system's <function>strftime</function> is not used
6580 directly, so platform-specific (nonstandard) extensions do not work.
6581 The default is <literal>postgresql-%Y-%m-%d_%H%M%S.log</literal>.
6582 </para>
6583 <para>
6584 If you specify a file name without escapes, you should plan to
6585 use a log rotation utility to avoid eventually filling the
6586 entire disk. In releases prior to 8.4, if
6587 no <literal>%</literal> escapes were
6588 present, <productname>PostgreSQL</productname> would append
6589 the epoch of the new log file's creation time, but this is no
6590 longer the case.
6591 </para>
6592 <para>
6593 If CSV-format output is enabled in <varname>log_destination</varname>,
6594 <literal>.csv</literal> will be appended to the timestamped
6595 log file name to create the file name for CSV-format output.
6596 (If <varname>log_filename</varname> ends in <literal>.log</literal>, the suffix is
6597 replaced instead.)
6598 </para>
6599 <para>
6600 If JSON-format output is enabled in <varname>log_destination</varname>,
6601 <literal>.json</literal> will be appended to the timestamped
6602 log file name to create the file name for JSON-format output.
6603 (If <varname>log_filename</varname> ends in <literal>.log</literal>, the suffix is
6604 replaced instead.)
6605 </para>
6606 <para>
6607 This parameter can only be set in the <filename>postgresql.conf</filename>
6608 file or on the server command line.
6609 </para>
6610 </listitem>
6611 </varlistentry>
6613 <varlistentry id="guc-log-file-mode" xreflabel="log_file_mode">
6614 <term><varname>log_file_mode</varname> (<type>integer</type>)
6615 <indexterm>
6616 <primary><varname>log_file_mode</varname> configuration parameter</primary>
6617 </indexterm>
6618 </term>
6619 <listitem>
6620 <para>
6621 On Unix systems this parameter sets the permissions for log files
6622 when <varname>logging_collector</varname> is enabled. (On Microsoft
6623 Windows this parameter is ignored.)
6624 The parameter value is expected to be a numeric mode
6625 specified in the format accepted by the
6626 <function>chmod</function> and <function>umask</function>
6627 system calls. (To use the customary octal format the number
6628 must start with a <literal>0</literal> (zero).)
6629 </para>
6630 <para>
6631 The default permissions are <literal>0600</literal>, meaning only the
6632 server owner can read or write the log files. The other commonly
6633 useful setting is <literal>0640</literal>, allowing members of the owner's
6634 group to read the files. Note however that to make use of such a
6635 setting, you'll need to alter <xref linkend="guc-log-directory"/> to
6636 store the files somewhere outside the cluster data directory. In
6637 any case, it's unwise to make the log files world-readable, since
6638 they might contain sensitive data.
6639 </para>
6640 <para>
6641 This parameter can only be set in the <filename>postgresql.conf</filename>
6642 file or on the server command line.
6643 </para>
6644 </listitem>
6645 </varlistentry>
6647 <varlistentry id="guc-log-rotation-age" xreflabel="log_rotation_age">
6648 <term><varname>log_rotation_age</varname> (<type>integer</type>)
6649 <indexterm>
6650 <primary><varname>log_rotation_age</varname> configuration parameter</primary>
6651 </indexterm>
6652 </term>
6653 <listitem>
6654 <para>
6655 When <varname>logging_collector</varname> is enabled,
6656 this parameter determines the maximum amount of time to use an
6657 individual log file, after which a new log file will be created.
6658 If this value is specified without units, it is taken as minutes.
6659 The default is 24 hours.
6660 Set to zero to disable time-based creation of new log files.
6661 This parameter can only be set in the <filename>postgresql.conf</filename>
6662 file or on the server command line.
6663 </para>
6664 </listitem>
6665 </varlistentry>
6667 <varlistentry id="guc-log-rotation-size" xreflabel="log_rotation_size">
6668 <term><varname>log_rotation_size</varname> (<type>integer</type>)
6669 <indexterm>
6670 <primary><varname>log_rotation_size</varname> configuration parameter</primary>
6671 </indexterm>
6672 </term>
6673 <listitem>
6674 <para>
6675 When <varname>logging_collector</varname> is enabled,
6676 this parameter determines the maximum size of an individual log file.
6677 After this amount of data has been emitted into a log file,
6678 a new log file will be created.
6679 If this value is specified without units, it is taken as kilobytes.
6680 The default is 10 megabytes.
6681 Set to zero to disable size-based creation of new log files.
6682 This parameter can only be set in the <filename>postgresql.conf</filename>
6683 file or on the server command line.
6684 </para>
6685 </listitem>
6686 </varlistentry>
6688 <varlistentry id="guc-log-truncate-on-rotation" xreflabel="log_truncate_on_rotation">
6689 <term><varname>log_truncate_on_rotation</varname> (<type>boolean</type>)
6690 <indexterm>
6691 <primary><varname>log_truncate_on_rotation</varname> configuration parameter</primary>
6692 </indexterm>
6693 </term>
6694 <listitem>
6695 <para>
6696 When <varname>logging_collector</varname> is enabled,
6697 this parameter will cause <productname>PostgreSQL</productname> to truncate (overwrite),
6698 rather than append to, any existing log file of the same name.
6699 However, truncation will occur only when a new file is being opened
6700 due to time-based rotation, not during server startup or size-based
6701 rotation. When off, pre-existing files will be appended to in
6702 all cases. For example, using this setting in combination with
6703 a <varname>log_filename</varname> like <literal>postgresql-%H.log</literal>
6704 would result in generating twenty-four hourly log files and then
6705 cyclically overwriting them.
6706 This parameter can only be set in the <filename>postgresql.conf</filename>
6707 file or on the server command line.
6708 </para>
6709 <para>
6710 Example: To keep 7 days of logs, one log file per day named
6711 <literal>server_log.Mon</literal>, <literal>server_log.Tue</literal>,
6712 etc., and automatically overwrite last week's log with this week's log,
6713 set <varname>log_filename</varname> to <literal>server_log.%a</literal>,
6714 <varname>log_truncate_on_rotation</varname> to <literal>on</literal>, and
6715 <varname>log_rotation_age</varname> to <literal>1440</literal>.
6716 </para>
6717 <para>
6718 Example: To keep 24 hours of logs, one log file per hour, but
6719 also rotate sooner if the log file size exceeds 1GB, set
6720 <varname>log_filename</varname> to <literal>server_log.%H%M</literal>,
6721 <varname>log_truncate_on_rotation</varname> to <literal>on</literal>,
6722 <varname>log_rotation_age</varname> to <literal>60</literal>, and
6723 <varname>log_rotation_size</varname> to <literal>1000000</literal>.
6724 Including <literal>%M</literal> in <varname>log_filename</varname> allows
6725 any size-driven rotations that might occur to select a file name
6726 different from the hour's initial file name.
6727 </para>
6728 </listitem>
6729 </varlistentry>
6731 <varlistentry id="guc-syslog-facility" xreflabel="syslog_facility">
6732 <term><varname>syslog_facility</varname> (<type>enum</type>)
6733 <indexterm>
6734 <primary><varname>syslog_facility</varname> configuration parameter</primary>
6735 </indexterm>
6736 </term>
6737 <listitem>
6738 <para>
6739 When logging to <application>syslog</application> is enabled, this parameter
6740 determines the <application>syslog</application>
6741 <quote>facility</quote> to be used. You can choose
6742 from <literal>LOCAL0</literal>, <literal>LOCAL1</literal>,
6743 <literal>LOCAL2</literal>, <literal>LOCAL3</literal>, <literal>LOCAL4</literal>,
6744 <literal>LOCAL5</literal>, <literal>LOCAL6</literal>, <literal>LOCAL7</literal>;
6745 the default is <literal>LOCAL0</literal>. See also the
6746 documentation of your system's
6747 <application>syslog</application> daemon.
6748 This parameter can only be set in the <filename>postgresql.conf</filename>
6749 file or on the server command line.
6750 </para>
6751 </listitem>
6752 </varlistentry>
6754 <varlistentry id="guc-syslog-ident" xreflabel="syslog_ident">
6755 <term><varname>syslog_ident</varname> (<type>string</type>)
6756 <indexterm>
6757 <primary><varname>syslog_ident</varname> configuration parameter</primary>
6758 </indexterm>
6759 </term>
6760 <listitem>
6761 <para>
6762 When logging to <application>syslog</application> is enabled, this parameter
6763 determines the program name used to identify
6764 <productname>PostgreSQL</productname> messages in
6765 <application>syslog</application> logs. The default is
6766 <literal>postgres</literal>.
6767 This parameter can only be set in the <filename>postgresql.conf</filename>
6768 file or on the server command line.
6769 </para>
6770 </listitem>
6771 </varlistentry>
6773 <varlistentry id="guc-syslog-sequence-numbers" xreflabel="syslog_sequence_numbers">
6774 <term><varname>syslog_sequence_numbers</varname> (<type>boolean</type>)
6775 <indexterm>
6776 <primary><varname>syslog_sequence_numbers</varname> configuration parameter</primary>
6777 </indexterm>
6778 </term>
6780 <listitem>
6781 <para>
6782 When logging to <application>syslog</application> and this is on (the
6783 default), then each message will be prefixed by an increasing
6784 sequence number (such as <literal>[2]</literal>). This circumvents
6785 the <quote>--- last message repeated N times ---</quote> suppression
6786 that many syslog implementations perform by default. In more modern
6787 syslog implementations, repeated message suppression can be configured
6788 (for example, <literal>$RepeatedMsgReduction</literal>
6789 in <productname>rsyslog</productname>), so this might not be
6790 necessary. Also, you could turn this off if you actually want to
6791 suppress repeated messages.
6792 </para>
6794 <para>
6795 This parameter can only be set in the <filename>postgresql.conf</filename>
6796 file or on the server command line.
6797 </para>
6798 </listitem>
6799 </varlistentry>
6801 <varlistentry id="guc-syslog-split-messages" xreflabel="syslog_split_messages">
6802 <term><varname>syslog_split_messages</varname> (<type>boolean</type>)
6803 <indexterm>
6804 <primary><varname>syslog_split_messages</varname> configuration parameter</primary>
6805 </indexterm>
6806 </term>
6807 <listitem>
6808 <para>
6809 When logging to <application>syslog</application> is enabled, this parameter
6810 determines how messages are delivered to syslog. When on (the
6811 default), messages are split by lines, and long lines are split so
6812 that they will fit into 1024 bytes, which is a typical size limit for
6813 traditional syslog implementations. When off, PostgreSQL server log
6814 messages are delivered to the syslog service as is, and it is up to
6815 the syslog service to cope with the potentially bulky messages.
6816 </para>
6818 <para>
6819 If syslog is ultimately logging to a text file, then the effect will
6820 be the same either way, and it is best to leave the setting on, since
6821 most syslog implementations either cannot handle large messages or
6822 would need to be specially configured to handle them. But if syslog
6823 is ultimately writing into some other medium, it might be necessary or
6824 more useful to keep messages logically together.
6825 </para>
6827 <para>
6828 This parameter can only be set in the <filename>postgresql.conf</filename>
6829 file or on the server command line.
6830 </para>
6831 </listitem>
6832 </varlistentry>
6834 <varlistentry id="guc-event-source" xreflabel="event_source">
6835 <term><varname>event_source</varname> (<type>string</type>)
6836 <indexterm>
6837 <primary><varname>event_source</varname> configuration parameter</primary>
6838 </indexterm>
6839 </term>
6840 <listitem>
6841 <para>
6842 When logging to <application>event log</application> is enabled, this parameter
6843 determines the program name used to identify
6844 <productname>PostgreSQL</productname> messages in
6845 the log. The default is <literal>PostgreSQL</literal>.
6846 This parameter can only be set in the <filename>postgresql.conf</filename>
6847 file or on the server command line.
6848 </para>
6849 </listitem>
6850 </varlistentry>
6852 </variablelist>
6853 </sect2>
6854 <sect2 id="runtime-config-logging-when">
6855 <title>When to Log</title>
6857 <variablelist>
6859 <varlistentry id="guc-log-min-messages" xreflabel="log_min_messages">
6860 <term><varname>log_min_messages</varname> (<type>enum</type>)
6861 <indexterm>
6862 <primary><varname>log_min_messages</varname> configuration parameter</primary>
6863 </indexterm>
6864 </term>
6865 <listitem>
6866 <para>
6867 Controls which <link linkend="runtime-config-severity-levels">message
6868 levels</link> are written to the server log.
6869 Valid values are <literal>DEBUG5</literal>, <literal>DEBUG4</literal>,
6870 <literal>DEBUG3</literal>, <literal>DEBUG2</literal>, <literal>DEBUG1</literal>,
6871 <literal>INFO</literal>, <literal>NOTICE</literal>, <literal>WARNING</literal>,
6872 <literal>ERROR</literal>, <literal>LOG</literal>, <literal>FATAL</literal>, and
6873 <literal>PANIC</literal>. Each level includes all the levels that
6874 follow it. The later the level, the fewer messages are sent
6875 to the log. The default is <literal>WARNING</literal>. Note that
6876 <literal>LOG</literal> has a different rank here than in
6877 <xref linkend="guc-client-min-messages"/>.
6878 Only superusers and users with the appropriate <literal>SET</literal>
6879 privilege can change this setting.
6880 </para>
6881 </listitem>
6882 </varlistentry>
6884 <varlistentry id="guc-log-min-error-statement" xreflabel="log_min_error_statement">
6885 <term><varname>log_min_error_statement</varname> (<type>enum</type>)
6886 <indexterm>
6887 <primary><varname>log_min_error_statement</varname> configuration parameter</primary>
6888 </indexterm>
6889 </term>
6890 <listitem>
6891 <para>
6892 Controls which SQL statements that cause an error
6893 condition are recorded in the server log. The current
6894 SQL statement is included in the log entry for any message of
6895 the specified
6896 <link linkend="runtime-config-severity-levels">severity</link>
6897 or higher.
6898 Valid values are <literal>DEBUG5</literal>,
6899 <literal>DEBUG4</literal>, <literal>DEBUG3</literal>,
6900 <literal>DEBUG2</literal>, <literal>DEBUG1</literal>,
6901 <literal>INFO</literal>, <literal>NOTICE</literal>,
6902 <literal>WARNING</literal>, <literal>ERROR</literal>,
6903 <literal>LOG</literal>,
6904 <literal>FATAL</literal>, and <literal>PANIC</literal>.
6905 The default is <literal>ERROR</literal>, which means statements
6906 causing errors, log messages, fatal errors, or panics will be logged.
6907 To effectively turn off logging of failing statements,
6908 set this parameter to <literal>PANIC</literal>.
6909 Only superusers and users with the appropriate <literal>SET</literal>
6910 privilege can change this setting.
6911 </para>
6912 </listitem>
6913 </varlistentry>
6915 <varlistentry id="guc-log-min-duration-statement" xreflabel="log_min_duration_statement">
6916 <term><varname>log_min_duration_statement</varname> (<type>integer</type>)
6917 <indexterm>
6918 <primary><varname>log_min_duration_statement</varname> configuration parameter</primary>
6919 </indexterm>
6920 </term>
6921 <listitem>
6922 <para>
6923 Causes the duration of each completed statement to be logged
6924 if the statement ran for at least the specified amount of time.
6925 For example, if you set it to <literal>250ms</literal>
6926 then all SQL statements that run 250ms or longer will be
6927 logged. Enabling this parameter can be helpful in tracking down
6928 unoptimized queries in your applications.
6929 If this value is specified without units, it is taken as milliseconds.
6930 Setting this to zero prints all statement durations.
6931 <literal>-1</literal> (the default) disables logging statement
6932 durations.
6933 Only superusers and users with the appropriate <literal>SET</literal>
6934 privilege can change this setting.
6935 </para>
6937 <para>
6938 This overrides <xref linkend="guc-log-min-duration-sample"/>,
6939 meaning that queries with duration exceeding this setting are not
6940 subject to sampling and are always logged.
6941 </para>
6943 <para>
6944 For clients using extended query protocol, durations of the Parse,
6945 Bind, and Execute steps are logged independently.
6946 </para>
6948 <note>
6949 <para>
6950 When using this option together with
6951 <xref linkend="guc-log-statement"/>,
6952 the text of statements that are logged because of
6953 <varname>log_statement</varname> will not be repeated in the
6954 duration log message.
6955 If you are not using <application>syslog</application>, it is recommended
6956 that you log the PID or session ID using
6957 <xref linkend="guc-log-line-prefix"/>
6958 so that you can link the statement message to the later
6959 duration message using the process ID or session ID.
6960 </para>
6961 </note>
6962 </listitem>
6963 </varlistentry>
6965 <varlistentry id="guc-log-min-duration-sample" xreflabel="log_min_duration_sample">
6966 <term><varname>log_min_duration_sample</varname> (<type>integer</type>)
6967 <indexterm>
6968 <primary><varname>log_min_duration_sample</varname> configuration parameter</primary>
6969 </indexterm>
6970 </term>
6971 <listitem>
6972 <para>
6973 Allows sampling the duration of completed statements that ran for
6974 at least the specified amount of time. This produces the same
6975 kind of log entries as
6976 <xref linkend="guc-log-min-duration-statement"/>, but only for a
6977 subset of the executed statements, with sample rate controlled by
6978 <xref linkend="guc-log-statement-sample-rate"/>.
6979 For example, if you set it to <literal>100ms</literal> then all
6980 SQL statements that run 100ms or longer will be considered for
6981 sampling. Enabling this parameter can be helpful when the
6982 traffic is too high to log all queries.
6983 If this value is specified without units, it is taken as milliseconds.
6984 Setting this to zero samples all statement durations.
6985 <literal>-1</literal> (the default) disables sampling statement
6986 durations.
6987 Only superusers and users with the appropriate <literal>SET</literal>
6988 privilege can change this setting.
6989 </para>
6991 <para>
6992 This setting has lower priority
6993 than <varname>log_min_duration_statement</varname>, meaning that
6994 statements with durations
6995 exceeding <varname>log_min_duration_statement</varname> are not
6996 subject to sampling and are always logged.
6997 </para>
6999 <para>
7000 Other notes for <varname>log_min_duration_statement</varname>
7001 apply also to this setting.
7002 </para>
7003 </listitem>
7004 </varlistentry>
7006 <varlistentry id="guc-log-statement-sample-rate" xreflabel="log_statement_sample_rate">
7007 <term><varname>log_statement_sample_rate</varname> (<type>floating point</type>)
7008 <indexterm>
7009 <primary><varname>log_statement_sample_rate</varname> configuration parameter</primary>
7010 </indexterm>
7011 </term>
7012 <listitem>
7013 <para>
7014 Determines the fraction of statements with duration exceeding
7015 <xref linkend="guc-log-min-duration-sample"/> that will be logged.
7016 Sampling is stochastic, for example <literal>0.5</literal> means
7017 there is statistically one chance in two that any given statement
7018 will be logged.
7019 The default is <literal>1.0</literal>, meaning to log all sampled
7020 statements.
7021 Setting this to zero disables sampled statement-duration logging,
7022 the same as setting
7023 <varname>log_min_duration_sample</varname> to
7024 <literal>-1</literal>.
7025 Only superusers and users with the appropriate <literal>SET</literal>
7026 privilege can change this setting.
7027 </para>
7028 </listitem>
7029 </varlistentry>
7031 <varlistentry id="guc-log-transaction-sample-rate" xreflabel="log_transaction_sample_rate">
7032 <term><varname>log_transaction_sample_rate</varname> (<type>floating point</type>)
7033 <indexterm>
7034 <primary><varname>log_transaction_sample_rate</varname> configuration parameter</primary>
7035 </indexterm>
7036 </term>
7037 <listitem>
7038 <para>
7039 Sets the fraction of transactions whose statements are all logged,
7040 in addition to statements logged for other reasons. It applies to
7041 each new transaction regardless of its statements' durations.
7042 Sampling is stochastic, for example <literal>0.1</literal> means
7043 there is statistically one chance in ten that any given transaction
7044 will be logged.
7045 <varname>log_transaction_sample_rate</varname> can be helpful to
7046 construct a sample of transactions.
7047 The default is <literal>0</literal>, meaning not to log
7048 statements from any additional transactions. Setting this
7049 to <literal>1</literal> logs all statements of all transactions.
7050 Only superusers and users with the appropriate <literal>SET</literal>
7051 privilege can change this setting.
7052 </para>
7053 <note>
7054 <para>
7055 Like all statement-logging options, this option can add significant
7056 overhead.
7057 </para>
7058 </note>
7059 </listitem>
7060 </varlistentry>
7062 <varlistentry id="guc-log-startup-progress-interval" xreflabel="log_startup_progress_interval">
7063 <term><varname>log_startup_progress_interval</varname> (<type>integer</type>)
7064 <indexterm>
7065 <primary><varname>log_startup_progress_interval</varname> configuration parameter</primary>
7066 </indexterm>
7067 </term>
7068 <listitem>
7069 <para>
7070 Sets the amount of time after which the startup process will log
7071 a message about a long-running operation that is still in progress,
7072 as well as the interval between further progress messages for that
7073 operation. The default is 10 seconds. A setting of <literal>0</literal>
7074 disables the feature. If this value is specified without units,
7075 it is taken as milliseconds. This setting is applied separately to
7076 each operation.
7077 This parameter can only be set in the <filename>postgresql.conf</filename>
7078 file or on the server command line.
7079 </para>
7081 <para>
7082 For example, if syncing the data directory takes 25 seconds and
7083 thereafter resetting unlogged relations takes 8 seconds, and if this
7084 setting has the default value of 10 seconds, then a messages will be
7085 logged for syncing the data directory after it has been in progress
7086 for 10 seconds and again after it has been in progress for 20 seconds,
7087 but nothing will be logged for resetting unlogged relations.
7088 </para>
7089 </listitem>
7090 </varlistentry>
7092 </variablelist>
7094 <para>
7095 <xref linkend="runtime-config-severity-levels"/> explains the message
7096 severity levels used by <productname>PostgreSQL</productname>. If logging output
7097 is sent to <systemitem>syslog</systemitem> or Windows'
7098 <systemitem>eventlog</systemitem>, the severity levels are translated
7099 as shown in the table.
7100 </para>
7102 <table id="runtime-config-severity-levels">
7103 <title>Message Severity Levels</title>
7104 <tgroup cols="4">
7105 <colspec colname="col1" colwidth="1*"/>
7106 <colspec colname="col2" colwidth="2*"/>
7107 <colspec colname="col3" colwidth="1*"/>
7108 <colspec colname="col4" colwidth="1*"/>
7109 <thead>
7110 <row>
7111 <entry>Severity</entry>
7112 <entry>Usage</entry>
7113 <entry><systemitem>syslog</systemitem></entry>
7114 <entry><systemitem>eventlog</systemitem></entry>
7115 </row>
7116 </thead>
7118 <tbody>
7119 <row>
7120 <entry><literal>DEBUG1 .. DEBUG5</literal></entry>
7121 <entry>Provides successively-more-detailed information for use by
7122 developers.</entry>
7123 <entry><literal>DEBUG</literal></entry>
7124 <entry><literal>INFORMATION</literal></entry>
7125 </row>
7127 <row>
7128 <entry><literal>INFO</literal></entry>
7129 <entry>Provides information implicitly requested by the user,
7130 e.g., output from <command>VACUUM VERBOSE</command>.</entry>
7131 <entry><literal>INFO</literal></entry>
7132 <entry><literal>INFORMATION</literal></entry>
7133 </row>
7135 <row>
7136 <entry><literal>NOTICE</literal></entry>
7137 <entry>Provides information that might be helpful to users, e.g.,
7138 notice of truncation of long identifiers.</entry>
7139 <entry><literal>NOTICE</literal></entry>
7140 <entry><literal>INFORMATION</literal></entry>
7141 </row>
7143 <row>
7144 <entry><literal>WARNING</literal></entry>
7145 <entry>Provides warnings of likely problems, e.g., <command>COMMIT</command>
7146 outside a transaction block.</entry>
7147 <entry><literal>NOTICE</literal></entry>
7148 <entry><literal>WARNING</literal></entry>
7149 </row>
7151 <row>
7152 <entry><literal>ERROR</literal></entry>
7153 <entry>Reports an error that caused the current command to
7154 abort.</entry>
7155 <entry><literal>WARNING</literal></entry>
7156 <entry><literal>ERROR</literal></entry>
7157 </row>
7159 <row>
7160 <entry><literal>LOG</literal></entry>
7161 <entry>Reports information of interest to administrators, e.g.,
7162 checkpoint activity.</entry>
7163 <entry><literal>INFO</literal></entry>
7164 <entry><literal>INFORMATION</literal></entry>
7165 </row>
7167 <row>
7168 <entry><literal>FATAL</literal></entry>
7169 <entry>Reports an error that caused the current session to
7170 abort.</entry>
7171 <entry><literal>ERR</literal></entry>
7172 <entry><literal>ERROR</literal></entry>
7173 </row>
7175 <row>
7176 <entry><literal>PANIC</literal></entry>
7177 <entry>Reports an error that caused all database sessions to abort.</entry>
7178 <entry><literal>CRIT</literal></entry>
7179 <entry><literal>ERROR</literal></entry>
7180 </row>
7181 </tbody>
7182 </tgroup>
7183 </table>
7185 </sect2>
7186 <sect2 id="runtime-config-logging-what">
7187 <title>What to Log</title>
7189 <note>
7190 <para>
7191 What you choose to log can have security implications; see
7192 <xref linkend="logfile-maintenance"/>.
7193 </para>
7194 </note>
7196 <variablelist>
7198 <varlistentry id="guc-application-name" xreflabel="application_name">
7199 <term><varname>application_name</varname> (<type>string</type>)
7200 <indexterm>
7201 <primary><varname>application_name</varname> configuration parameter</primary>
7202 </indexterm>
7203 </term>
7204 <listitem>
7205 <para>
7206 The <varname>application_name</varname> can be any string of less than
7207 <symbol>NAMEDATALEN</symbol> characters (64 characters in a standard build).
7208 It is typically set by an application upon connection to the server.
7209 The name will be displayed in the <structname>pg_stat_activity</structname> view
7210 and included in CSV log entries. It can also be included in regular
7211 log entries via the <xref linkend="guc-log-line-prefix"/> parameter.
7212 Only printable ASCII characters may be used in the
7213 <varname>application_name</varname> value.
7214 Other characters are replaced with <link
7215 linkend="sql-syntax-strings-escape">C-style hexadecimal escapes</link>.
7216 </para>
7217 </listitem>
7218 </varlistentry>
7220 <varlistentry id="guc-debug-print-parse">
7221 <term><varname>debug_print_parse</varname> (<type>boolean</type>)
7222 <indexterm>
7223 <primary><varname>debug_print_parse</varname> configuration parameter</primary>
7224 </indexterm>
7225 </term>
7226 <term><varname>debug_print_rewritten</varname> (<type>boolean</type>)
7227 <indexterm>
7228 <primary><varname>debug_print_rewritten</varname> configuration parameter</primary>
7229 </indexterm>
7230 </term>
7231 <term><varname>debug_print_plan</varname> (<type>boolean</type>)
7232 <indexterm>
7233 <primary><varname>debug_print_plan</varname> configuration parameter</primary>
7234 </indexterm>
7235 </term>
7236 <listitem>
7237 <para>
7238 These parameters enable various debugging output to be emitted.
7239 When set, they print the resulting parse tree, the query rewriter
7240 output, or the execution plan for each executed query.
7241 These messages are emitted at <literal>LOG</literal> message level, so by
7242 default they will appear in the server log but will not be sent to the
7243 client. You can change that by adjusting
7244 <xref linkend="guc-client-min-messages"/> and/or
7245 <xref linkend="guc-log-min-messages"/>.
7246 These parameters are off by default.
7247 </para>
7248 </listitem>
7249 </varlistentry>
7251 <varlistentry id="guc-debug-pretty-print">
7252 <term><varname>debug_pretty_print</varname> (<type>boolean</type>)
7253 <indexterm>
7254 <primary><varname>debug_pretty_print</varname> configuration parameter</primary>
7255 </indexterm>
7256 </term>
7257 <listitem>
7258 <para>
7259 When set, <varname>debug_pretty_print</varname> indents the messages
7260 produced by <varname>debug_print_parse</varname>,
7261 <varname>debug_print_rewritten</varname>, or
7262 <varname>debug_print_plan</varname>. This results in more readable
7263 but much longer output than the <quote>compact</quote> format used when
7264 it is off. It is on by default.
7265 </para>
7266 </listitem>
7267 </varlistentry>
7269 <varlistentry id="guc-log-autovacuum-min-duration" xreflabel="log_autovacuum_min_duration">
7270 <term><varname>log_autovacuum_min_duration</varname> (<type>integer</type>)
7271 <indexterm>
7272 <primary><varname>log_autovacuum_min_duration</varname></primary>
7273 <secondary>configuration parameter</secondary>
7274 </indexterm>
7275 </term>
7276 <listitem>
7277 <para>
7278 Causes each action executed by autovacuum to be logged if it ran for at
7279 least the specified amount of time. Setting this to zero logs
7280 all autovacuum actions. <literal>-1</literal> disables logging autovacuum
7281 actions. If this value is specified without units, it is taken as milliseconds.
7282 For example, if you set this to
7283 <literal>250ms</literal> then all automatic vacuums and analyzes that run
7284 250ms or longer will be logged. In addition, when this parameter is
7285 set to any value other than <literal>-1</literal>, a message will be
7286 logged if an autovacuum action is skipped due to a conflicting lock or a
7287 concurrently dropped relation. The default is <literal>10min</literal>.
7288 Enabling this parameter can be helpful in tracking autovacuum activity.
7289 This parameter can only be set in the <filename>postgresql.conf</filename>
7290 file or on the server command line; but the setting can be overridden for
7291 individual tables by changing table storage parameters.
7292 </para>
7293 </listitem>
7294 </varlistentry>
7296 <varlistentry id="guc-log-checkpoints" xreflabel="log_checkpoints">
7297 <term><varname>log_checkpoints</varname> (<type>boolean</type>)
7298 <indexterm>
7299 <primary><varname>log_checkpoints</varname> configuration parameter</primary>
7300 </indexterm>
7301 </term>
7302 <listitem>
7303 <para>
7304 Causes checkpoints and restartpoints to be logged in the server log.
7305 Some statistics are included in the log messages, including the number
7306 of buffers written and the time spent writing them.
7307 This parameter can only be set in the <filename>postgresql.conf</filename>
7308 file or on the server command line. The default is on.
7309 </para>
7310 </listitem>
7311 </varlistentry>
7313 <varlistentry id="guc-log-connections" xreflabel="log_connections">
7314 <term><varname>log_connections</varname> (<type>boolean</type>)
7315 <indexterm>
7316 <primary><varname>log_connections</varname> configuration parameter</primary>
7317 </indexterm>
7318 </term>
7319 <listitem>
7320 <para>
7321 Causes each attempted connection to the server to be logged,
7322 as well as successful completion of both client authentication (if
7323 necessary) and authorization.
7324 Only superusers and users with the appropriate <literal>SET</literal>
7325 privilege can change this parameter at session start,
7326 and it cannot be changed at all within a session.
7327 The default is <literal>off</literal>.
7328 </para>
7330 <note>
7331 <para>
7332 Some client programs, like <application>psql</application>, attempt
7333 to connect twice while determining if a password is required, so
7334 duplicate <quote>connection received</quote> messages do not
7335 necessarily indicate a problem.
7336 </para>
7337 </note>
7338 </listitem>
7339 </varlistentry>
7341 <varlistentry id="guc-log-disconnections" xreflabel="log_disconnections">
7342 <term><varname>log_disconnections</varname> (<type>boolean</type>)
7343 <indexterm>
7344 <primary><varname>log_disconnections</varname> configuration parameter</primary>
7345 </indexterm>
7346 </term>
7347 <listitem>
7348 <para>
7349 Causes session terminations to be logged. The log output
7350 provides information similar to <varname>log_connections</varname>,
7351 plus the duration of the session.
7352 Only superusers and users with the appropriate <literal>SET</literal>
7353 privilege can change this parameter at session start,
7354 and it cannot be changed at all within a session.
7355 The default is <literal>off</literal>.
7356 </para>
7357 </listitem>
7358 </varlistentry>
7361 <varlistentry id="guc-log-duration" xreflabel="log_duration">
7362 <term><varname>log_duration</varname> (<type>boolean</type>)
7363 <indexterm>
7364 <primary><varname>log_duration</varname> configuration parameter</primary>
7365 </indexterm>
7366 </term>
7367 <listitem>
7368 <para>
7369 Causes the duration of every completed statement to be logged.
7370 The default is <literal>off</literal>.
7371 Only superusers and users with the appropriate <literal>SET</literal>
7372 privilege can change this setting.
7373 </para>
7375 <para>
7376 For clients using extended query protocol, durations of the Parse,
7377 Bind, and Execute steps are logged independently.
7378 </para>
7380 <note>
7381 <para>
7382 The difference between enabling <varname>log_duration</varname> and setting
7383 <xref linkend="guc-log-min-duration-statement"/> to zero is that
7384 exceeding <varname>log_min_duration_statement</varname> forces the text of
7385 the query to be logged, but this option doesn't. Thus, if
7386 <varname>log_duration</varname> is <literal>on</literal> and
7387 <varname>log_min_duration_statement</varname> has a positive value, all
7388 durations are logged but the query text is included only for
7389 statements exceeding the threshold. This behavior can be useful for
7390 gathering statistics in high-load installations.
7391 </para>
7392 </note>
7393 </listitem>
7394 </varlistentry>
7396 <varlistentry id="guc-log-error-verbosity" xreflabel="log_error_verbosity">
7397 <term><varname>log_error_verbosity</varname> (<type>enum</type>)
7398 <indexterm>
7399 <primary><varname>log_error_verbosity</varname> configuration parameter</primary>
7400 </indexterm>
7401 </term>
7402 <listitem>
7403 <para>
7404 Controls the amount of detail written in the server log for each
7405 message that is logged. Valid values are <literal>TERSE</literal>,
7406 <literal>DEFAULT</literal>, and <literal>VERBOSE</literal>, each adding more
7407 fields to displayed messages. <literal>TERSE</literal> excludes
7408 the logging of <literal>DETAIL</literal>, <literal>HINT</literal>,
7409 <literal>QUERY</literal>, and <literal>CONTEXT</literal> error information.
7410 <literal>VERBOSE</literal> output includes the <symbol>SQLSTATE</symbol> error
7411 code (see also <xref linkend="errcodes-appendix"/>) and the source code file name, function name,
7412 and line number that generated the error.
7413 Only superusers and users with the appropriate <literal>SET</literal>
7414 privilege can change this setting.
7415 </para>
7416 </listitem>
7417 </varlistentry>
7419 <varlistentry id="guc-log-hostname" xreflabel="log_hostname">
7420 <term><varname>log_hostname</varname> (<type>boolean</type>)
7421 <indexterm>
7422 <primary><varname>log_hostname</varname> configuration parameter</primary>
7423 </indexterm>
7424 </term>
7425 <listitem>
7426 <para>
7427 By default, connection log messages only show the IP address of the
7428 connecting host. Turning this parameter on causes logging of the
7429 host name as well. Note that depending on your host name resolution
7430 setup this might impose a non-negligible performance penalty.
7431 This parameter can only be set in the <filename>postgresql.conf</filename>
7432 file or on the server command line.
7433 </para>
7434 </listitem>
7435 </varlistentry>
7437 <varlistentry id="guc-log-line-prefix" xreflabel="log_line_prefix">
7438 <term><varname>log_line_prefix</varname> (<type>string</type>)
7439 <indexterm>
7440 <primary><varname>log_line_prefix</varname> configuration parameter</primary>
7441 </indexterm>
7442 </term>
7443 <listitem>
7444 <para>
7445 This is a <function>printf</function>-style string that is output at the
7446 beginning of each log line.
7447 <literal>%</literal> characters begin <quote>escape sequences</quote>
7448 that are replaced with status information as outlined below.
7449 Unrecognized escapes are ignored. Other
7450 characters are copied straight to the log line. Some escapes are
7451 only recognized by session processes, and will be treated as empty by
7452 background processes such as the main server process. Status
7453 information may be aligned either left or right by specifying a
7454 numeric literal after the % and before the option. A negative
7455 value will cause the status information to be padded on the
7456 right with spaces to give it a minimum width, whereas a positive
7457 value will pad on the left. Padding can be useful to aid human
7458 readability in log files.
7459 </para>
7461 <para>
7462 This parameter can only be set in the <filename>postgresql.conf</filename>
7463 file or on the server command line. The default is
7464 <literal>'%m [%p] '</literal> which logs a time stamp and the process ID.
7465 </para>
7467 <informaltable>
7468 <tgroup cols="3">
7469 <thead>
7470 <row>
7471 <entry>Escape</entry>
7472 <entry>Effect</entry>
7473 <entry>Session only</entry>
7474 </row>
7475 </thead>
7476 <tbody>
7477 <row>
7478 <entry><literal>%a</literal></entry>
7479 <entry>Application name</entry>
7480 <entry>yes</entry>
7481 </row>
7482 <row>
7483 <entry><literal>%u</literal></entry>
7484 <entry>User name</entry>
7485 <entry>yes</entry>
7486 </row>
7487 <row>
7488 <entry><literal>%d</literal></entry>
7489 <entry>Database name</entry>
7490 <entry>yes</entry>
7491 </row>
7492 <row>
7493 <entry><literal>%r</literal></entry>
7494 <entry>Remote host name or IP address, and remote port</entry>
7495 <entry>yes</entry>
7496 </row>
7497 <row>
7498 <entry><literal>%h</literal></entry>
7499 <entry>Remote host name or IP address</entry>
7500 <entry>yes</entry>
7501 </row>
7502 <row>
7503 <entry><literal>%b</literal></entry>
7504 <entry>Backend type</entry>
7505 <entry>no</entry>
7506 </row>
7507 <row>
7508 <entry><literal>%p</literal></entry>
7509 <entry>Process ID</entry>
7510 <entry>no</entry>
7511 </row>
7512 <row>
7513 <entry><literal>%P</literal></entry>
7514 <entry>Process ID of the parallel group leader, if this process
7515 is a parallel query worker</entry>
7516 <entry>no</entry>
7517 </row>
7518 <row>
7519 <entry><literal>%t</literal></entry>
7520 <entry>Time stamp without milliseconds</entry>
7521 <entry>no</entry>
7522 </row>
7523 <row>
7524 <entry><literal>%m</literal></entry>
7525 <entry>Time stamp with milliseconds</entry>
7526 <entry>no</entry>
7527 </row>
7528 <row>
7529 <entry><literal>%n</literal></entry>
7530 <entry>Time stamp with milliseconds (as a Unix epoch)</entry>
7531 <entry>no</entry>
7532 </row>
7533 <row>
7534 <entry><literal>%i</literal></entry>
7535 <entry>Command tag: type of session's current command</entry>
7536 <entry>yes</entry>
7537 </row>
7538 <row>
7539 <entry><literal>%e</literal></entry>
7540 <entry>SQLSTATE error code</entry>
7541 <entry>no</entry>
7542 </row>
7543 <row>
7544 <entry><literal>%c</literal></entry>
7545 <entry>Session ID: see below</entry>
7546 <entry>no</entry>
7547 </row>
7548 <row>
7549 <entry><literal>%l</literal></entry>
7550 <entry>Number of the log line for each session or process, starting at 1</entry>
7551 <entry>no</entry>
7552 </row>
7553 <row>
7554 <entry><literal>%s</literal></entry>
7555 <entry>Process start time stamp</entry>
7556 <entry>no</entry>
7557 </row>
7558 <row>
7559 <entry><literal>%v</literal></entry>
7560 <entry>Virtual transaction ID (procNumber/localXID); see
7561 <xref linkend="transaction-id"/></entry>
7562 <entry>no</entry>
7563 </row>
7564 <row>
7565 <entry><literal>%x</literal></entry>
7566 <entry>Transaction ID (0 if none is assigned); see
7567 <xref linkend="transaction-id"/></entry>
7568 <entry>no</entry>
7569 </row>
7570 <row>
7571 <entry><literal>%q</literal></entry>
7572 <entry>Produces no output, but tells non-session
7573 processes to stop at this point in the string; ignored by
7574 session processes</entry>
7575 <entry>no</entry>
7576 </row>
7577 <row>
7578 <entry><literal>%Q</literal></entry>
7579 <entry>Query identifier of the current query. Query
7580 identifiers are not computed by default, so this field
7581 will be zero unless <xref linkend="guc-compute-query-id"/>
7582 parameter is enabled or a third-party module that computes
7583 query identifiers is configured.</entry>
7584 <entry>yes</entry>
7585 </row>
7586 <row>
7587 <entry><literal>%%</literal></entry>
7588 <entry>Literal <literal>%</literal></entry>
7589 <entry>no</entry>
7590 </row>
7591 </tbody>
7592 </tgroup>
7593 </informaltable>
7595 <para>
7596 The backend type corresponds to the column
7597 <structfield>backend_type</structfield> in the view
7598 <link linkend="monitoring-pg-stat-activity-view">
7599 <structname>pg_stat_activity</structname></link>,
7600 but additional types can appear
7601 in the log that don't show in that view.
7602 </para>
7604 <para>
7605 The <literal>%c</literal> escape prints a quasi-unique session identifier,
7606 consisting of two 4-byte hexadecimal numbers (without leading zeros)
7607 separated by a dot. The numbers are the process start time and the
7608 process ID, so <literal>%c</literal> can also be used as a space saving way
7609 of printing those items. For example, to generate the session
7610 identifier from <literal>pg_stat_activity</literal>, use this query:
7611 <programlisting>
7612 SELECT to_hex(trunc(EXTRACT(EPOCH FROM backend_start))::integer) || '.' ||
7613 to_hex(pid)
7614 FROM pg_stat_activity;
7615 </programlisting>
7617 </para>
7619 <tip>
7620 <para>
7621 If you set a nonempty value for <varname>log_line_prefix</varname>,
7622 you should usually make its last character be a space, to provide
7623 visual separation from the rest of the log line. A punctuation
7624 character can be used too.
7625 </para>
7626 </tip>
7628 <tip>
7629 <para>
7630 <application>Syslog</application> produces its own
7631 time stamp and process ID information, so you probably do not want to
7632 include those escapes if you are logging to <application>syslog</application>.
7633 </para>
7634 </tip>
7636 <tip>
7637 <para>
7638 The <literal>%q</literal> escape is useful when including information that is
7639 only available in session (backend) context like user or database
7640 name. For example:
7641 <programlisting>
7642 log_line_prefix = '%m [%p] %q%u@%d/%a '
7643 </programlisting>
7644 </para>
7645 </tip>
7647 <note>
7648 <para>
7649 The <literal>%Q</literal> escape always reports a zero identifier
7650 for lines output by <xref linkend="guc-log-statement"/> because
7651 <varname>log_statement</varname> generates output before an
7652 identifier can be calculated, including invalid statements for
7653 which an identifier cannot be calculated.
7654 </para>
7655 </note>
7656 </listitem>
7657 </varlistentry>
7659 <varlistentry id="guc-log-lock-waits" xreflabel="log_lock_waits">
7660 <term><varname>log_lock_waits</varname> (<type>boolean</type>)
7661 <indexterm>
7662 <primary><varname>log_lock_waits</varname> configuration parameter</primary>
7663 </indexterm>
7664 </term>
7665 <listitem>
7666 <para>
7667 Controls whether a log message is produced when a session waits
7668 longer than <xref linkend="guc-deadlock-timeout"/> to acquire a
7669 lock. This is useful in determining if lock waits are causing
7670 poor performance. The default is <literal>off</literal>.
7671 Only superusers and users with the appropriate <literal>SET</literal>
7672 privilege can change this setting.
7673 </para>
7674 </listitem>
7675 </varlistentry>
7677 <varlistentry id="guc-log-recovery-conflict-waits" xreflabel="log_recovery_conflict_waits">
7678 <term><varname>log_recovery_conflict_waits</varname> (<type>boolean</type>)
7679 <indexterm>
7680 <primary><varname>log_recovery_conflict_waits</varname> configuration parameter</primary>
7681 </indexterm>
7682 </term>
7683 <listitem>
7684 <para>
7685 Controls whether a log message is produced when the startup process
7686 waits longer than <varname>deadlock_timeout</varname>
7687 for recovery conflicts. This is useful in determining if recovery
7688 conflicts prevent the recovery from applying WAL.
7689 </para>
7691 <para>
7692 The default is <literal>off</literal>. This parameter can only be set
7693 in the <filename>postgresql.conf</filename> file or on the server
7694 command line.
7695 </para>
7696 </listitem>
7697 </varlistentry>
7699 <varlistentry id="guc-log-parameter-max-length" xreflabel="log_parameter_max_length">
7700 <term><varname>log_parameter_max_length</varname> (<type>integer</type>)
7701 <indexterm>
7702 <primary><varname>log_parameter_max_length</varname> configuration parameter</primary>
7703 </indexterm>
7704 </term>
7705 <listitem>
7706 <para>
7707 If greater than zero, each bind parameter value logged with a
7708 non-error statement-logging message is trimmed to this many bytes.
7709 Zero disables logging of bind parameters for non-error statement logs.
7710 <literal>-1</literal> (the default) allows bind parameters to be
7711 logged in full.
7712 If this value is specified without units, it is taken as bytes.
7713 Only superusers and users with the appropriate <literal>SET</literal>
7714 privilege can change this setting.
7715 </para>
7717 <para>
7718 This setting only affects log messages printed as a result of
7719 <xref linkend="guc-log-statement"/>,
7720 <xref linkend="guc-log-duration"/>, and related settings. Non-zero
7721 values of this setting add some overhead, particularly if parameters
7722 are sent in binary form, since then conversion to text is required.
7723 </para>
7724 </listitem>
7725 </varlistentry>
7727 <varlistentry id="guc-log-parameter-max-length-on-error" xreflabel="log_parameter_max_length_on_error">
7728 <term><varname>log_parameter_max_length_on_error</varname> (<type>integer</type>)
7729 <indexterm>
7730 <primary><varname>log_parameter_max_length_on_error</varname> configuration parameter</primary>
7731 </indexterm>
7732 </term>
7733 <listitem>
7734 <para>
7735 If greater than zero, each bind parameter value reported in error
7736 messages is trimmed to this many bytes.
7737 Zero (the default) disables including bind parameters in error
7738 messages.
7739 <literal>-1</literal> allows bind parameters to be printed in full.
7740 If this value is specified without units, it is taken as bytes.
7741 </para>
7743 <para>
7744 Non-zero values of this setting add overhead, as
7745 <productname>PostgreSQL</productname> will need to store textual
7746 representations of parameter values in memory at the start of each
7747 statement, whether or not an error eventually occurs. The overhead
7748 is greater when bind parameters are sent in binary form than when
7749 they are sent as text, since the former case requires data
7750 conversion while the latter only requires copying the string.
7751 </para>
7752 </listitem>
7753 </varlistentry>
7755 <varlistentry id="guc-log-statement" xreflabel="log_statement">
7756 <term><varname>log_statement</varname> (<type>enum</type>)
7757 <indexterm>
7758 <primary><varname>log_statement</varname> configuration parameter</primary>
7759 </indexterm>
7760 </term>
7761 <listitem>
7762 <para>
7763 Controls which SQL statements are logged. Valid values are
7764 <literal>none</literal> (off), <literal>ddl</literal>, <literal>mod</literal>, and
7765 <literal>all</literal> (all statements). <literal>ddl</literal> logs all data definition
7766 statements, such as <command>CREATE</command>, <command>ALTER</command>, and
7767 <command>DROP</command> statements. <literal>mod</literal> logs all
7768 <literal>ddl</literal> statements, plus data-modifying statements
7769 such as <command>INSERT</command>,
7770 <command>UPDATE</command>, <command>DELETE</command>, <command>TRUNCATE</command>,
7771 and <command>COPY FROM</command>.
7772 <command>PREPARE</command>, <command>EXECUTE</command>, and
7773 <command>EXPLAIN ANALYZE</command> statements are also logged if their
7774 contained command is of an appropriate type. For clients using
7775 extended query protocol, logging occurs when an Execute message
7776 is received, and values of the Bind parameters are included
7777 (with any embedded single-quote marks doubled).
7778 </para>
7780 <para>
7781 The default is <literal>none</literal>.
7782 Only superusers and users with the appropriate <literal>SET</literal>
7783 privilege can change this setting.
7784 </para>
7786 <note>
7787 <para>
7788 Statements that contain simple syntax errors are not logged
7789 even by the <varname>log_statement</varname> = <literal>all</literal> setting,
7790 because the log message is emitted only after basic parsing has
7791 been done to determine the statement type. In the case of extended
7792 query protocol, this setting likewise does not log statements that
7793 fail before the Execute phase (i.e., during parse analysis or
7794 planning). Set <varname>log_min_error_statement</varname> to
7795 <literal>ERROR</literal> (or lower) to log such statements.
7796 </para>
7797 <para>
7798 Logged statements might reveal sensitive data and even contain
7799 plaintext passwords.
7800 </para>
7801 </note>
7802 </listitem>
7803 </varlistentry>
7805 <varlistentry id="guc-log-replication-commands" xreflabel="log_replication_commands">
7806 <term><varname>log_replication_commands</varname> (<type>boolean</type>)
7807 <indexterm>
7808 <primary><varname>log_replication_commands</varname> configuration parameter</primary>
7809 </indexterm>
7810 </term>
7811 <listitem>
7812 <para>
7813 Causes each replication command and <literal>walsender</literal>
7814 process's replication slot acquisition/release to be logged in the
7815 server log. See <xref linkend="protocol-replication"/> for more
7816 information about replication command. The default value is
7817 <literal>off</literal>. Only superusers and users with the appropriate
7818 <literal>SET</literal> privilege can change this setting.
7819 </para>
7820 </listitem>
7821 </varlistentry>
7823 <varlistentry id="guc-log-temp-files" xreflabel="log_temp_files">
7824 <term><varname>log_temp_files</varname> (<type>integer</type>)
7825 <indexterm>
7826 <primary><varname>log_temp_files</varname> configuration parameter</primary>
7827 </indexterm>
7828 </term>
7829 <listitem>
7830 <para>
7831 Controls logging of temporary file names and sizes.
7832 Temporary files can be
7833 created for sorts, hashes, and temporary query results.
7834 If enabled by this setting, a log entry is emitted for each
7835 temporary file, with the file size specified in bytes, when it is deleted.
7836 A value of zero logs all temporary file information, while positive
7837 values log only files whose size is greater than or equal to
7838 the specified amount of data.
7839 If this value is specified without units, it is taken as kilobytes.
7840 The default setting is -1, which disables such logging.
7841 Only superusers and users with the appropriate <literal>SET</literal>
7842 privilege can change this setting.
7843 </para>
7844 </listitem>
7845 </varlistentry>
7847 <varlistentry id="guc-log-timezone" xreflabel="log_timezone">
7848 <term><varname>log_timezone</varname> (<type>string</type>)
7849 <indexterm>
7850 <primary><varname>log_timezone</varname> configuration parameter</primary>
7851 </indexterm>
7852 </term>
7853 <listitem>
7854 <para>
7855 Sets the time zone used for timestamps written in the server log.
7856 Unlike <xref linkend="guc-timezone"/>, this value is cluster-wide,
7857 so that all sessions will report timestamps consistently.
7858 The built-in default is <literal>GMT</literal>, but that is typically
7859 overridden in <filename>postgresql.conf</filename>; <application>initdb</application>
7860 will install a setting there corresponding to its system environment.
7861 See <xref linkend="datatype-timezones"/> for more information.
7862 This parameter can only be set in the <filename>postgresql.conf</filename>
7863 file or on the server command line.
7864 </para>
7865 </listitem>
7866 </varlistentry>
7868 </variablelist>
7869 </sect2>
7870 <sect2 id="runtime-config-logging-csvlog">
7871 <title>Using CSV-Format Log Output</title>
7873 <para>
7874 Including <literal>csvlog</literal> in the <varname>log_destination</varname> list
7875 provides a convenient way to import log files into a database table.
7876 This option emits log lines in comma-separated-values
7877 (<acronym>CSV</acronym>) format,
7878 with these columns:
7879 time stamp with milliseconds,
7880 user name,
7881 database name,
7882 process ID,
7883 client host:port number,
7884 session ID,
7885 per-session line number,
7886 command tag,
7887 session start time,
7888 virtual transaction ID,
7889 regular transaction ID,
7890 error severity,
7891 SQLSTATE code,
7892 error message,
7893 error message detail,
7894 hint,
7895 internal query that led to the error (if any),
7896 character count of the error position therein,
7897 error context,
7898 user query that led to the error (if any and enabled by
7899 <varname>log_min_error_statement</varname>),
7900 character count of the error position therein,
7901 location of the error in the PostgreSQL source code
7902 (if <varname>log_error_verbosity</varname> is set to <literal>verbose</literal>),
7903 application name, backend type, process ID of parallel group leader,
7904 and query id.
7905 Here is a sample table definition for storing CSV-format log output:
7907 <programlisting>
7908 CREATE TABLE postgres_log
7910 log_time timestamp(3) with time zone,
7911 user_name text,
7912 database_name text,
7913 process_id integer,
7914 connection_from text,
7915 session_id text,
7916 session_line_num bigint,
7917 command_tag text,
7918 session_start_time timestamp with time zone,
7919 virtual_transaction_id text,
7920 transaction_id bigint,
7921 error_severity text,
7922 sql_state_code text,
7923 message text,
7924 detail text,
7925 hint text,
7926 internal_query text,
7927 internal_query_pos integer,
7928 context text,
7929 query text,
7930 query_pos integer,
7931 location text,
7932 application_name text,
7933 backend_type text,
7934 leader_pid integer,
7935 query_id bigint,
7936 PRIMARY KEY (session_id, session_line_num)
7938 </programlisting>
7939 </para>
7941 <para>
7942 To import a log file into this table, use the <command>COPY FROM</command>
7943 command:
7945 <programlisting>
7946 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
7947 </programlisting>
7948 It is also possible to access the file as a foreign table, using
7949 the supplied <xref linkend="file-fdw"/> module.
7950 </para>
7952 <para>
7953 There are a few things you need to do to simplify importing CSV log
7954 files:
7956 <orderedlist>
7957 <listitem>
7958 <para>
7959 Set <varname>log_filename</varname> and
7960 <varname>log_rotation_age</varname> to provide a consistent,
7961 predictable naming scheme for your log files. This lets you
7962 predict what the file name will be and know when an individual log
7963 file is complete and therefore ready to be imported.
7964 </para>
7965 </listitem>
7967 <listitem>
7968 <para>
7969 Set <varname>log_rotation_size</varname> to 0 to disable
7970 size-based log rotation, as it makes the log file name difficult
7971 to predict.
7972 </para>
7973 </listitem>
7975 <listitem>
7976 <para>
7977 Set <varname>log_truncate_on_rotation</varname> to <literal>on</literal> so
7978 that old log data isn't mixed with the new in the same file.
7979 </para>
7980 </listitem>
7982 <listitem>
7983 <para>
7984 The table definition above includes a primary key specification.
7985 This is useful to protect against accidentally importing the same
7986 information twice. The <command>COPY</command> command commits all of the
7987 data it imports at one time, so any error will cause the entire
7988 import to fail. If you import a partial log file and later import
7989 the file again when it is complete, the primary key violation will
7990 cause the import to fail. Wait until the log is complete and
7991 closed before importing. This procedure will also protect against
7992 accidentally importing a partial line that hasn't been completely
7993 written, which would also cause <command>COPY</command> to fail.
7994 </para>
7995 </listitem>
7996 </orderedlist>
7997 </para>
7998 </sect2>
7999 <sect2 id="runtime-config-logging-jsonlog">
8000 <title>Using JSON-Format Log Output</title>
8002 <para>
8003 Including <literal>jsonlog</literal> in the
8004 <varname>log_destination</varname> list provides a convenient way to
8005 import log files into many different programs. This option emits log
8006 lines in <acronym>JSON</acronym> format.
8007 </para>
8009 <para>
8010 String fields with null values are excluded from output.
8011 Additional fields may be added in the future. User applications that
8012 process <literal>jsonlog</literal> output should ignore unknown fields.
8013 </para>
8015 <para>
8016 Each log line is serialized as a JSON object with the set of keys and
8017 their associated values shown in <xref
8018 linkend="runtime-config-logging-jsonlog-keys-values"/>.
8019 </para>
8021 <table id="runtime-config-logging-jsonlog-keys-values">
8022 <title>Keys and Values of JSON Log Entries</title>
8023 <tgroup cols="3">
8024 <thead>
8025 <row>
8026 <entry>Key name</entry>
8027 <entry>Type</entry>
8028 <entry>Description</entry>
8029 </row>
8030 </thead>
8031 <tbody>
8032 <row>
8033 <entry><literal>timestamp</literal></entry>
8034 <entry>string</entry>
8035 <entry>Time stamp with milliseconds</entry>
8036 </row>
8037 <row>
8038 <entry><literal>user</literal></entry>
8039 <entry>string</entry>
8040 <entry>User name</entry>
8041 </row>
8042 <row>
8043 <entry><literal>dbname</literal></entry>
8044 <entry>string</entry>
8045 <entry>Database name</entry>
8046 </row>
8047 <row>
8048 <entry><literal>pid</literal></entry>
8049 <entry>number</entry>
8050 <entry>Process ID</entry>
8051 </row>
8052 <row>
8053 <entry><literal>remote_host</literal></entry>
8054 <entry>string</entry>
8055 <entry>Client host</entry>
8056 </row>
8057 <row>
8058 <entry><literal>remote_port</literal></entry>
8059 <entry>number</entry>
8060 <entry>Client port</entry>
8061 </row>
8062 <row>
8063 <entry><literal>session_id</literal></entry>
8064 <entry>string</entry>
8065 <entry>Session ID</entry>
8066 </row>
8067 <row>
8068 <entry><literal>line_num</literal></entry>
8069 <entry>number</entry>
8070 <entry>Per-session line number</entry>
8071 </row>
8072 <row>
8073 <entry><literal>ps</literal></entry>
8074 <entry>string</entry>
8075 <entry>Current ps display</entry>
8076 </row>
8077 <row>
8078 <entry><literal>session_start</literal></entry>
8079 <entry>string</entry>
8080 <entry>Session start time</entry>
8081 </row>
8082 <row>
8083 <entry><literal>vxid</literal></entry>
8084 <entry>string</entry>
8085 <entry>Virtual transaction ID</entry>
8086 </row>
8087 <row>
8088 <entry><literal>txid</literal></entry>
8089 <entry>string</entry>
8090 <entry>Regular transaction ID</entry>
8091 </row>
8092 <row>
8093 <entry><literal>error_severity</literal></entry>
8094 <entry>string</entry>
8095 <entry>Error severity</entry>
8096 </row>
8097 <row>
8098 <entry><literal>state_code</literal></entry>
8099 <entry>string</entry>
8100 <entry>SQLSTATE code</entry>
8101 </row>
8102 <row>
8103 <entry><literal>message</literal></entry>
8104 <entry>string</entry>
8105 <entry>Error message</entry>
8106 </row>
8107 <row>
8108 <entry><literal>detail</literal></entry>
8109 <entry>string</entry>
8110 <entry>Error message detail</entry>
8111 </row>
8112 <row>
8113 <entry><literal>hint</literal></entry>
8114 <entry>string</entry>
8115 <entry>Error message hint</entry>
8116 </row>
8117 <row>
8118 <entry><literal>internal_query</literal></entry>
8119 <entry>string</entry>
8120 <entry>Internal query that led to the error</entry>
8121 </row>
8122 <row>
8123 <entry><literal>internal_position</literal></entry>
8124 <entry>number</entry>
8125 <entry>Cursor index into internal query</entry>
8126 </row>
8127 <row>
8128 <entry><literal>context</literal></entry>
8129 <entry>string</entry>
8130 <entry>Error context</entry>
8131 </row>
8132 <row>
8133 <entry><literal>statement</literal></entry>
8134 <entry>string</entry>
8135 <entry>Client-supplied query string</entry>
8136 </row>
8137 <row>
8138 <entry><literal>cursor_position</literal></entry>
8139 <entry>number</entry>
8140 <entry>Cursor index into query string</entry>
8141 </row>
8142 <row>
8143 <entry><literal>func_name</literal></entry>
8144 <entry>string</entry>
8145 <entry>Error location function name</entry>
8146 </row>
8147 <row>
8148 <entry><literal>file_name</literal></entry>
8149 <entry>string</entry>
8150 <entry>File name of error location</entry>
8151 </row>
8152 <row>
8153 <entry><literal>file_line_num</literal></entry>
8154 <entry>number</entry>
8155 <entry>File line number of the error location</entry>
8156 </row>
8157 <row>
8158 <entry><literal>application_name</literal></entry>
8159 <entry>string</entry>
8160 <entry>Client application name</entry>
8161 </row>
8162 <row>
8163 <entry><literal>backend_type</literal></entry>
8164 <entry>string</entry>
8165 <entry>Type of backend</entry>
8166 </row>
8167 <row>
8168 <entry><literal>leader_pid</literal></entry>
8169 <entry>number</entry>
8170 <entry>Process ID of leader for active parallel workers</entry>
8171 </row>
8172 <row>
8173 <entry><literal>query_id</literal></entry>
8174 <entry>number</entry>
8175 <entry>Query ID</entry>
8176 </row>
8177 </tbody>
8178 </tgroup>
8179 </table>
8180 </sect2>
8182 <sect2 id="runtime-config-logging-proc-title">
8183 <title>Process Title</title>
8185 <para>
8186 These settings control how process titles of server processes are
8187 modified. Process titles are typically viewed using programs like
8188 <application>ps</application> or, on Windows, <application>Process Explorer</application>.
8189 See <xref linkend="monitoring-ps"/> for details.
8190 </para>
8192 <variablelist>
8193 <varlistentry id="guc-cluster-name" xreflabel="cluster_name">
8194 <term><varname>cluster_name</varname> (<type>string</type>)
8195 <indexterm>
8196 <primary><varname>cluster_name</varname> configuration parameter</primary>
8197 </indexterm>
8198 </term>
8199 <listitem>
8200 <para>
8201 Sets a name that identifies this database cluster (instance) for
8202 various purposes. The cluster name appears in the process title for
8203 all server processes in this cluster. Moreover, it is the default
8204 application name for a standby connection (see <xref
8205 linkend="guc-synchronous-standby-names"/>.)
8206 </para>
8208 <para>
8209 The name can be any string of less
8210 than <symbol>NAMEDATALEN</symbol> characters (64 characters in a standard
8211 build). Only printable ASCII characters may be used in the
8212 <varname>cluster_name</varname> value.
8213 Other characters are replaced with <link
8214 linkend="sql-syntax-strings-escape">C-style hexadecimal escapes</link>.
8215 No name is shown if this parameter is set to the empty string
8216 <literal>''</literal> (which is the default).
8217 This parameter can only be set at server start.
8218 </para>
8219 </listitem>
8220 </varlistentry>
8222 <varlistentry id="guc-update-process-title" xreflabel="update_process_title">
8223 <term><varname>update_process_title</varname> (<type>boolean</type>)
8224 <indexterm>
8225 <primary><varname>update_process_title</varname> configuration parameter</primary>
8226 </indexterm>
8227 </term>
8228 <listitem>
8229 <para>
8230 Enables updating of the process title every time a new SQL command
8231 is received by the server.
8232 This setting defaults to <literal>on</literal> on most platforms, but it
8233 defaults to <literal>off</literal> on Windows due to that platform's larger
8234 overhead for updating the process title.
8235 Only superusers and users with the appropriate <literal>SET</literal>
8236 privilege can change this setting.
8237 </para>
8238 </listitem>
8239 </varlistentry>
8240 </variablelist>
8241 </sect2>
8242 </sect1>
8244 <sect1 id="runtime-config-statistics">
8245 <title>Run-time Statistics</title>
8247 <sect2 id="runtime-config-cumulative-statistics">
8248 <title>Cumulative Query and Index Statistics</title>
8250 <para>
8251 These parameters control the server-wide cumulative statistics system.
8252 When enabled, the data that is collected can be accessed via the
8253 <structname>pg_stat</structname> and <structname>pg_statio</structname>
8254 family of system views. Refer to <xref linkend="monitoring"/> for more
8255 information.
8256 </para>
8258 <variablelist>
8260 <varlistentry id="guc-track-activities" xreflabel="track_activities">
8261 <term><varname>track_activities</varname> (<type>boolean</type>)
8262 <indexterm>
8263 <primary><varname>track_activities</varname> configuration parameter</primary>
8264 </indexterm>
8265 </term>
8266 <listitem>
8267 <para>
8268 Enables the collection of information on the currently
8269 executing command of each session, along with its identifier and the
8270 time when that command began execution. This parameter is on by
8271 default. Note that even when enabled, this information is only
8272 visible to superusers, roles with privileges of the
8273 <literal>pg_read_all_stats</literal> role and the user owning the
8274 sessions being reported on (including sessions belonging to a role they
8275 have the privileges of), so it should not represent a security risk.
8276 Only superusers and users with the appropriate <literal>SET</literal>
8277 privilege can change this setting.
8278 </para>
8279 </listitem>
8280 </varlistentry>
8282 <varlistentry id="guc-track-activity-query-size" xreflabel="track_activity_query_size">
8283 <term><varname>track_activity_query_size</varname> (<type>integer</type>)
8284 <indexterm>
8285 <primary><varname>track_activity_query_size</varname> configuration parameter</primary>
8286 </indexterm>
8287 </term>
8288 <listitem>
8289 <para>
8290 Specifies the amount of memory reserved to store the text of the
8291 currently executing command for each active session, for the
8292 <structname>pg_stat_activity</structname>.<structfield>query</structfield> field.
8293 If this value is specified without units, it is taken as bytes.
8294 The default value is 1024 bytes.
8295 This parameter can only be set at server start.
8296 </para>
8297 </listitem>
8298 </varlistentry>
8300 <varlistentry id="guc-track-counts" xreflabel="track_counts">
8301 <term><varname>track_counts</varname> (<type>boolean</type>)
8302 <indexterm>
8303 <primary><varname>track_counts</varname> configuration parameter</primary>
8304 </indexterm>
8305 </term>
8306 <listitem>
8307 <para>
8308 Enables collection of statistics on database activity.
8309 This parameter is on by default, because the autovacuum
8310 daemon needs the collected information.
8311 Only superusers and users with the appropriate <literal>SET</literal>
8312 privilege can change this setting.
8313 </para>
8314 </listitem>
8315 </varlistentry>
8317 <varlistentry id="guc-track-io-timing" xreflabel="track_io_timing">
8318 <term><varname>track_io_timing</varname> (<type>boolean</type>)
8319 <indexterm>
8320 <primary><varname>track_io_timing</varname> configuration parameter</primary>
8321 </indexterm>
8322 </term>
8323 <listitem>
8324 <para>
8325 Enables timing of database I/O calls. This parameter is off by
8326 default, as it will repeatedly query the operating system for
8327 the current time, which may cause significant overhead on some
8328 platforms. You can use the <xref linkend="pgtesttiming"/> tool to
8329 measure the overhead of timing on your system.
8330 I/O timing information is
8331 displayed in <link linkend="monitoring-pg-stat-database-view">
8332 <structname>pg_stat_database</structname></link>,
8333 <link linkend="monitoring-pg-stat-io-view">
8334 <structname>pg_stat_io</structname></link>, in the output of
8335 <xref linkend="sql-explain"/> when the <literal>BUFFERS</literal> option
8336 is used, in the output of <xref linkend="sql-vacuum"/> when
8337 the <literal>VERBOSE</literal> option is used, by autovacuum
8338 for auto-vacuums and auto-analyzes, when <xref
8339 linkend="guc-log-autovacuum-min-duration"/> is set and by
8340 <xref linkend="pgstatstatements"/>.
8341 Only superusers and users with the appropriate <literal>SET</literal>
8342 privilege can change this setting.
8343 </para>
8344 </listitem>
8345 </varlistentry>
8347 <varlistentry id="guc-track-wal-io-timing" xreflabel="track_wal_io_timing">
8348 <term><varname>track_wal_io_timing</varname> (<type>boolean</type>)
8349 <indexterm>
8350 <primary><varname>track_wal_io_timing</varname> configuration parameter</primary>
8351 </indexterm>
8352 </term>
8353 <listitem>
8354 <para>
8355 Enables timing of WAL I/O calls. This parameter is off by default,
8356 as it will repeatedly query the operating system for the current time,
8357 which may cause significant overhead on some platforms.
8358 You can use the <application>pg_test_timing</application> tool to
8359 measure the overhead of timing on your system.
8360 I/O timing information is
8361 displayed in <link linkend="monitoring-pg-stat-wal-view">
8362 <structname>pg_stat_wal</structname></link>.
8363 Only superusers and users with the appropriate <literal>SET</literal>
8364 privilege can change this setting.
8365 </para>
8366 </listitem>
8367 </varlistentry>
8369 <varlistentry id="guc-track-functions" xreflabel="track_functions">
8370 <term><varname>track_functions</varname> (<type>enum</type>)
8371 <indexterm>
8372 <primary><varname>track_functions</varname> configuration parameter</primary>
8373 </indexterm>
8374 </term>
8375 <listitem>
8376 <para>
8377 Enables tracking of function call counts and time used. Specify
8378 <literal>pl</literal> to track only procedural-language functions,
8379 <literal>all</literal> to also track SQL and C language functions.
8380 The default is <literal>none</literal>, which disables function
8381 statistics tracking.
8382 Only superusers and users with the appropriate <literal>SET</literal>
8383 privilege can change this setting.
8384 </para>
8386 <note>
8387 <para>
8388 SQL-language functions that are simple enough to be <quote>inlined</quote>
8389 into the calling query will not be tracked, regardless of this
8390 setting.
8391 </para>
8392 </note>
8393 </listitem>
8394 </varlistentry>
8396 <varlistentry id="guc-stats-fetch-consistency" xreflabel="stats_fetch_consistency">
8397 <term><varname>stats_fetch_consistency</varname> (<type>enum</type>)
8398 <indexterm>
8399 <primary><varname>stats_fetch_consistency</varname> configuration parameter</primary>
8400 </indexterm>
8401 </term>
8402 <listitem>
8403 <para>
8404 Determines the behavior when cumulative statistics are accessed
8405 multiple times within a transaction. When set to
8406 <literal>none</literal>, each access re-fetches counters from shared
8407 memory. When set to <literal>cache</literal>, the first access to
8408 statistics for an object caches those statistics until the end of the
8409 transaction unless <function>pg_stat_clear_snapshot()</function> is
8410 called. When set to <literal>snapshot</literal>, the first statistics
8411 access caches all statistics accessible in the current database, until
8412 the end of the transaction unless
8413 <function>pg_stat_clear_snapshot()</function> is called. Changing this
8414 parameter in a transaction discards the statistics snapshot.
8415 The default is <literal>cache</literal>.
8416 </para>
8417 <note>
8418 <para>
8419 <literal>none</literal> is most suitable for monitoring systems. If
8420 values are only accessed once, it is the most
8421 efficient. <literal>cache</literal> ensures repeat accesses yield the
8422 same values, which is important for queries involving
8423 e.g. self-joins. <literal>snapshot</literal> can be useful when
8424 interactively inspecting statistics, but has higher overhead,
8425 particularly if many database objects exist.
8426 </para>
8427 </note>
8428 </listitem>
8429 </varlistentry>
8431 </variablelist>
8432 </sect2>
8434 <sect2 id="runtime-config-statistics-monitor">
8435 <title>Statistics Monitoring</title>
8436 <variablelist>
8438 <varlistentry id="guc-compute-query-id" xreflabel="compute_query_id">
8439 <term><varname>compute_query_id</varname> (<type>enum</type>)
8440 <indexterm>
8441 <primary><varname>compute_query_id</varname> configuration parameter</primary>
8442 </indexterm>
8443 </term>
8444 <listitem>
8445 <para>
8446 Enables in-core computation of a query identifier.
8447 Query identifiers can be displayed in the <link
8448 linkend="monitoring-pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8449 view, using <command>EXPLAIN</command>, or emitted in the log if
8450 configured via the <xref linkend="guc-log-line-prefix"/> parameter.
8451 The <xref linkend="pgstatstatements"/> extension also requires a query
8452 identifier to be computed. Note that an external module can
8453 alternatively be used if the in-core query identifier computation
8454 method is not acceptable. In this case, in-core computation
8455 must be always disabled.
8456 Valid values are <literal>off</literal> (always disabled),
8457 <literal>on</literal> (always enabled), <literal>auto</literal>,
8458 which lets modules such as <xref linkend="pgstatstatements"/>
8459 automatically enable it, and <literal>regress</literal> which
8460 has the same effect as <literal>auto</literal>, except that the
8461 query identifier is not shown in the <literal>EXPLAIN</literal> output
8462 in order to facilitate automated regression testing.
8463 The default is <literal>auto</literal>.
8464 </para>
8465 <note>
8466 <para>
8467 To ensure that only one query identifier is calculated and
8468 displayed, extensions that calculate query identifiers should
8469 throw an error if a query identifier has already been computed.
8470 </para>
8471 </note>
8472 </listitem>
8473 </varlistentry>
8475 <varlistentry id="guc-log-statement-stats">
8476 <term><varname>log_statement_stats</varname> (<type>boolean</type>)
8477 <indexterm>
8478 <primary><varname>log_statement_stats</varname> configuration parameter</primary>
8479 </indexterm>
8480 </term>
8481 <term><varname>log_parser_stats</varname> (<type>boolean</type>)
8482 <indexterm>
8483 <primary><varname>log_parser_stats</varname> configuration parameter</primary>
8484 </indexterm>
8485 </term>
8486 <term><varname>log_planner_stats</varname> (<type>boolean</type>)
8487 <indexterm>
8488 <primary><varname>log_planner_stats</varname> configuration parameter</primary>
8489 </indexterm>
8490 </term>
8491 <term><varname>log_executor_stats</varname> (<type>boolean</type>)
8492 <indexterm>
8493 <primary><varname>log_executor_stats</varname> configuration parameter</primary>
8494 </indexterm>
8495 </term>
8496 <listitem>
8497 <para>
8498 For each query, output performance statistics of the respective
8499 module to the server log. This is a crude profiling
8500 instrument, similar to the Unix <function>getrusage()</function> operating
8501 system facility. <varname>log_statement_stats</varname> reports total
8502 statement statistics, while the others report per-module statistics.
8503 <varname>log_statement_stats</varname> cannot be enabled together with
8504 any of the per-module options. All of these options are disabled by
8505 default.
8506 Only superusers and users with the appropriate <literal>SET</literal>
8507 privilege can change these settings.
8508 </para>
8509 </listitem>
8510 </varlistentry>
8512 </variablelist>
8514 </sect2>
8515 </sect1>
8517 <sect1 id="runtime-config-autovacuum">
8518 <title>Automatic Vacuuming</title>
8520 <indexterm>
8521 <primary>autovacuum</primary>
8522 <secondary>configuration parameters</secondary>
8523 </indexterm>
8525 <para>
8526 These settings control the behavior of the <firstterm>autovacuum</firstterm>
8527 feature. Refer to <xref linkend="autovacuum"/> for more information.
8528 Note that many of these settings can be overridden on a per-table
8529 basis; see <xref linkend="sql-createtable-storage-parameters"/>.
8530 </para>
8532 <variablelist>
8534 <varlistentry id="guc-autovacuum" xreflabel="autovacuum">
8535 <term><varname>autovacuum</varname> (<type>boolean</type>)
8536 <indexterm>
8537 <primary><varname>autovacuum</varname> configuration parameter</primary>
8538 </indexterm>
8539 </term>
8540 <listitem>
8541 <para>
8542 Controls whether the server should run the
8543 autovacuum launcher daemon. This is on by default; however,
8544 <xref linkend="guc-track-counts"/> must also be enabled for
8545 autovacuum to work.
8546 This parameter can only be set in the <filename>postgresql.conf</filename>
8547 file or on the server command line; however, autovacuuming can be
8548 disabled for individual tables by changing table storage parameters.
8549 </para>
8550 <para>
8551 Note that even when this parameter is disabled, the system
8552 will launch autovacuum processes if necessary to
8553 prevent transaction ID wraparound. See <xref
8554 linkend="vacuum-for-wraparound"/> for more information.
8555 </para>
8556 </listitem>
8557 </varlistentry>
8559 <varlistentry id="guc-autovacuum-max-workers" xreflabel="autovacuum_max_workers">
8560 <term><varname>autovacuum_max_workers</varname> (<type>integer</type>)
8561 <indexterm>
8562 <primary><varname>autovacuum_max_workers</varname> configuration parameter</primary>
8563 </indexterm>
8564 </term>
8565 <listitem>
8566 <para>
8567 Specifies the maximum number of autovacuum processes (other than the
8568 autovacuum launcher) that may be running at any one time. The default
8569 is three. This parameter can only be set at server start.
8570 </para>
8571 </listitem>
8572 </varlistentry>
8574 <varlistentry id="guc-autovacuum-naptime" xreflabel="autovacuum_naptime">
8575 <term><varname>autovacuum_naptime</varname> (<type>integer</type>)
8576 <indexterm>
8577 <primary><varname>autovacuum_naptime</varname> configuration parameter</primary>
8578 </indexterm>
8579 </term>
8580 <listitem>
8581 <para>
8582 Specifies the minimum delay between autovacuum runs on any given
8583 database. In each round the daemon examines the
8584 database and issues <command>VACUUM</command> and <command>ANALYZE</command> commands
8585 as needed for tables in that database.
8586 If this value is specified without units, it is taken as seconds.
8587 The default is one minute (<literal>1min</literal>).
8588 This parameter can only be set in the <filename>postgresql.conf</filename>
8589 file or on the server command line.
8590 </para>
8591 </listitem>
8592 </varlistentry>
8594 <varlistentry id="guc-autovacuum-vacuum-threshold" xreflabel="autovacuum_vacuum_threshold">
8595 <term><varname>autovacuum_vacuum_threshold</varname> (<type>integer</type>)
8596 <indexterm>
8597 <primary><varname>autovacuum_vacuum_threshold</varname></primary>
8598 <secondary>configuration parameter</secondary>
8599 </indexterm>
8600 </term>
8601 <listitem>
8602 <para>
8603 Specifies the minimum number of updated or deleted tuples needed
8604 to trigger a <command>VACUUM</command> in any one table.
8605 The default is 50 tuples.
8606 This parameter can only be set in the <filename>postgresql.conf</filename>
8607 file or on the server command line;
8608 but the setting can be overridden for individual tables by
8609 changing table storage parameters.
8610 </para>
8611 </listitem>
8612 </varlistentry>
8614 <varlistentry id="guc-autovacuum-vacuum-insert-threshold" xreflabel="autovacuum_vacuum_insert_threshold">
8615 <term><varname>autovacuum_vacuum_insert_threshold</varname> (<type>integer</type>)
8616 <indexterm>
8617 <primary><varname>autovacuum_vacuum_insert_threshold</varname></primary>
8618 <secondary>configuration parameter</secondary>
8619 </indexterm>
8620 </term>
8621 <listitem>
8622 <para>
8623 Specifies the number of inserted tuples needed to trigger a
8624 <command>VACUUM</command> in any one table.
8625 The default is 1000 tuples. If -1 is specified, autovacuum will not
8626 trigger a <command>VACUUM</command> operation on any tables based on
8627 the number of inserts.
8628 This parameter can only be set in the <filename>postgresql.conf</filename>
8629 file or on the server command line;
8630 but the setting can be overridden for individual tables by
8631 changing table storage parameters.
8632 </para>
8633 </listitem>
8634 </varlistentry>
8636 <varlistentry id="guc-autovacuum-analyze-threshold" xreflabel="autovacuum_analyze_threshold">
8637 <term><varname>autovacuum_analyze_threshold</varname> (<type>integer</type>)
8638 <indexterm>
8639 <primary><varname>autovacuum_analyze_threshold</varname></primary>
8640 <secondary>configuration parameter</secondary>
8641 </indexterm>
8642 </term>
8643 <listitem>
8644 <para>
8645 Specifies the minimum number of inserted, updated or deleted tuples
8646 needed to trigger an <command>ANALYZE</command> in any one table.
8647 The default is 50 tuples.
8648 This parameter can only be set in the <filename>postgresql.conf</filename>
8649 file or on the server command line;
8650 but the setting can be overridden for individual tables by
8651 changing table storage parameters.
8652 </para>
8653 </listitem>
8654 </varlistentry>
8656 <varlistentry id="guc-autovacuum-vacuum-scale-factor" xreflabel="autovacuum_vacuum_scale_factor">
8657 <term><varname>autovacuum_vacuum_scale_factor</varname> (<type>floating point</type>)
8658 <indexterm>
8659 <primary><varname>autovacuum_vacuum_scale_factor</varname></primary>
8660 <secondary>configuration parameter</secondary>
8661 </indexterm>
8662 </term>
8663 <listitem>
8664 <para>
8665 Specifies a fraction of the table size to add to
8666 <varname>autovacuum_vacuum_threshold</varname>
8667 when deciding whether to trigger a <command>VACUUM</command>.
8668 The default is 0.2 (20% of table size).
8669 This parameter can only be set in the <filename>postgresql.conf</filename>
8670 file or on the server command line;
8671 but the setting can be overridden for individual tables by
8672 changing table storage parameters.
8673 </para>
8674 </listitem>
8675 </varlistentry>
8677 <varlistentry id="guc-autovacuum-vacuum-insert-scale-factor" xreflabel="autovacuum_vacuum_insert_scale_factor">
8678 <term><varname>autovacuum_vacuum_insert_scale_factor</varname> (<type>floating point</type>)
8679 <indexterm>
8680 <primary><varname>autovacuum_vacuum_insert_scale_factor</varname></primary>
8681 <secondary>configuration parameter</secondary>
8682 </indexterm>
8683 </term>
8684 <listitem>
8685 <para>
8686 Specifies a fraction of the table size to add to
8687 <varname>autovacuum_vacuum_insert_threshold</varname>
8688 when deciding whether to trigger a <command>VACUUM</command>.
8689 The default is 0.2 (20% of table size).
8690 This parameter can only be set in the <filename>postgresql.conf</filename>
8691 file or on the server command line;
8692 but the setting can be overridden for individual tables by
8693 changing table storage parameters.
8694 </para>
8695 </listitem>
8696 </varlistentry>
8698 <varlistentry id="guc-autovacuum-analyze-scale-factor" xreflabel="autovacuum_analyze_scale_factor">
8699 <term><varname>autovacuum_analyze_scale_factor</varname> (<type>floating point</type>)
8700 <indexterm>
8701 <primary><varname>autovacuum_analyze_scale_factor</varname></primary>
8702 <secondary>configuration parameter</secondary>
8703 </indexterm>
8704 </term>
8705 <listitem>
8706 <para>
8707 Specifies a fraction of the table size to add to
8708 <varname>autovacuum_analyze_threshold</varname>
8709 when deciding whether to trigger an <command>ANALYZE</command>.
8710 The default is 0.1 (10% of table size).
8711 This parameter can only be set in the <filename>postgresql.conf</filename>
8712 file or on the server command line;
8713 but the setting can be overridden for individual tables by
8714 changing table storage parameters.
8715 </para>
8716 </listitem>
8717 </varlistentry>
8719 <varlistentry id="guc-autovacuum-freeze-max-age" xreflabel="autovacuum_freeze_max_age">
8720 <term><varname>autovacuum_freeze_max_age</varname> (<type>integer</type>)
8721 <indexterm>
8722 <primary><varname>autovacuum_freeze_max_age</varname></primary>
8723 <secondary>configuration parameter</secondary>
8724 </indexterm>
8725 </term>
8726 <listitem>
8727 <para>
8728 Specifies the maximum age (in transactions) that a table's
8729 <structname>pg_class</structname>.<structfield>relfrozenxid</structfield> field can
8730 attain before a <command>VACUUM</command> operation is forced
8731 to prevent transaction ID wraparound within the table.
8732 Note that the system will launch autovacuum processes to
8733 prevent wraparound even when autovacuum is otherwise disabled.
8734 </para>
8736 <para>
8737 Vacuum also allows removal of old files from the
8738 <filename>pg_xact</filename> subdirectory, which is why the default
8739 is a relatively low 200 million transactions.
8740 This parameter can only be set at server start, but the setting
8741 can be reduced for individual tables by
8742 changing table storage parameters.
8743 For more information see <xref linkend="vacuum-for-wraparound"/>.
8744 </para>
8745 </listitem>
8746 </varlistentry>
8748 <varlistentry id="guc-autovacuum-multixact-freeze-max-age" xreflabel="autovacuum_multixact_freeze_max_age">
8749 <term><varname>autovacuum_multixact_freeze_max_age</varname> (<type>integer</type>)
8750 <indexterm>
8751 <primary><varname>autovacuum_multixact_freeze_max_age</varname></primary>
8752 <secondary>configuration parameter</secondary>
8753 </indexterm>
8754 </term>
8755 <listitem>
8756 <para>
8757 Specifies the maximum age (in multixacts) that a table's
8758 <structname>pg_class</structname>.<structfield>relminmxid</structfield> field can
8759 attain before a <command>VACUUM</command> operation is forced to
8760 prevent multixact ID wraparound within the table.
8761 Note that the system will launch autovacuum processes to
8762 prevent wraparound even when autovacuum is otherwise disabled.
8763 </para>
8765 <para>
8766 Vacuuming multixacts also allows removal of old files from the
8767 <filename>pg_multixact/members</filename> and <filename>pg_multixact/offsets</filename>
8768 subdirectories, which is why the default is a relatively low
8769 400 million multixacts.
8770 This parameter can only be set at server start, but the setting can
8771 be reduced for individual tables by changing table storage parameters.
8772 For more information see <xref linkend="vacuum-for-multixact-wraparound"/>.
8773 </para>
8774 </listitem>
8775 </varlistentry>
8777 <varlistentry id="guc-autovacuum-vacuum-cost-delay" xreflabel="autovacuum_vacuum_cost_delay">
8778 <term><varname>autovacuum_vacuum_cost_delay</varname> (<type>floating point</type>)
8779 <indexterm>
8780 <primary><varname>autovacuum_vacuum_cost_delay</varname></primary>
8781 <secondary>configuration parameter</secondary>
8782 </indexterm>
8783 </term>
8784 <listitem>
8785 <para>
8786 Specifies the cost delay value that will be used in automatic
8787 <command>VACUUM</command> operations. If -1 is specified, the regular
8788 <xref linkend="guc-vacuum-cost-delay"/> value will be used.
8789 If this value is specified without units, it is taken as milliseconds.
8790 The default value is 2 milliseconds.
8791 This parameter can only be set in the <filename>postgresql.conf</filename>
8792 file or on the server command line;
8793 but the setting can be overridden for individual tables by
8794 changing table storage parameters.
8795 </para>
8796 </listitem>
8797 </varlistentry>
8799 <varlistentry id="guc-autovacuum-vacuum-cost-limit" xreflabel="autovacuum_vacuum_cost_limit">
8800 <term><varname>autovacuum_vacuum_cost_limit</varname> (<type>integer</type>)
8801 <indexterm>
8802 <primary><varname>autovacuum_vacuum_cost_limit</varname></primary>
8803 <secondary>configuration parameter</secondary>
8804 </indexterm>
8805 </term>
8806 <listitem>
8807 <para>
8808 Specifies the cost limit value that will be used in automatic
8809 <command>VACUUM</command> operations. If -1 is specified (which is the
8810 default), the regular
8811 <xref linkend="guc-vacuum-cost-limit"/> value will be used. Note that
8812 the value is distributed proportionally among the running autovacuum
8813 workers, if there is more than one, so that the sum of the limits for
8814 each worker does not exceed the value of this variable.
8815 This parameter can only be set in the <filename>postgresql.conf</filename>
8816 file or on the server command line;
8817 but the setting can be overridden for individual tables by
8818 changing table storage parameters.
8819 </para>
8820 </listitem>
8821 </varlistentry>
8823 </variablelist>
8824 </sect1>
8826 <sect1 id="runtime-config-client">
8827 <title>Client Connection Defaults</title>
8829 <sect2 id="runtime-config-client-statement">
8830 <title>Statement Behavior</title>
8831 <variablelist>
8833 <varlistentry id="guc-client-min-messages" xreflabel="client_min_messages">
8834 <term><varname>client_min_messages</varname> (<type>enum</type>)
8835 <indexterm>
8836 <primary><varname>client_min_messages</varname> configuration parameter</primary>
8837 </indexterm>
8838 </term>
8839 <listitem>
8840 <para>
8841 Controls which
8842 <link linkend="runtime-config-severity-levels">message levels</link>
8843 are sent to the client.
8844 Valid values are <literal>DEBUG5</literal>,
8845 <literal>DEBUG4</literal>, <literal>DEBUG3</literal>, <literal>DEBUG2</literal>,
8846 <literal>DEBUG1</literal>, <literal>LOG</literal>, <literal>NOTICE</literal>,
8847 <literal>WARNING</literal>, and <literal>ERROR</literal>.
8848 Each level includes all the levels that follow it. The later the level,
8849 the fewer messages are sent. The default is
8850 <literal>NOTICE</literal>. Note that <literal>LOG</literal> has a different
8851 rank here than in <xref linkend="guc-log-min-messages"/>.
8852 </para>
8853 <para>
8854 <literal>INFO</literal> level messages are always sent to the client.
8855 </para>
8856 </listitem>
8857 </varlistentry>
8859 <varlistentry id="guc-search-path" xreflabel="search_path">
8860 <term><varname>search_path</varname> (<type>string</type>)
8861 <indexterm>
8862 <primary><varname>search_path</varname> configuration parameter</primary>
8863 </indexterm>
8864 <indexterm><primary>path</primary><secondary>for schemas</secondary></indexterm>
8865 </term>
8866 <listitem>
8867 <para>
8868 This variable specifies the order in which schemas are searched
8869 when an object (table, data type, function, etc.) is referenced by a
8870 simple name with no schema specified. When there are objects of
8871 identical names in different schemas, the one found first
8872 in the search path is used. An object that is not in any of the
8873 schemas in the search path can only be referenced by specifying
8874 its containing schema with a qualified (dotted) name.
8875 </para>
8877 <para>
8878 The value for <varname>search_path</varname> must be a comma-separated
8879 list of schema names. Any name that is not an existing schema, or is
8880 a schema for which the user does not have <literal>USAGE</literal>
8881 permission, is silently ignored.
8882 </para>
8884 <para>
8885 If one of the list items is the special name
8886 <literal>$user</literal>, then the schema having the name returned by
8887 <function>CURRENT_USER</function> is substituted, if there is such a schema
8888 and the user has <literal>USAGE</literal> permission for it.
8889 (If not, <literal>$user</literal> is ignored.)
8890 </para>
8892 <para>
8893 The system catalog schema, <literal>pg_catalog</literal>, is always
8894 searched, whether it is mentioned in the path or not. If it is
8895 mentioned in the path then it will be searched in the specified
8896 order. If <literal>pg_catalog</literal> is not in the path then it will
8897 be searched <emphasis>before</emphasis> searching any of the path items.
8898 </para>
8900 <!-- To further split hairs, funcname('foo') does not use the temporary
8901 schema, even when it considers typname='funcname'. This paragraph
8902 refers to function names in a loose sense, "pg_proc.proname or
8903 func_name grammar production". -->
8904 <para>
8905 Likewise, the current session's temporary-table schema,
8906 <literal>pg_temp_<replaceable>nnn</replaceable></literal>, is always searched if it
8907 exists. It can be explicitly listed in the path by using the
8908 alias <literal>pg_temp</literal><indexterm><primary>pg_temp</primary></indexterm>. If it is not listed in the path then
8909 it is searched first (even before <literal>pg_catalog</literal>). However,
8910 the temporary schema is only searched for relation (table, view,
8911 sequence, etc.) and data type names. It is never searched for
8912 function or operator names.
8913 </para>
8915 <para>
8916 When objects are created without specifying a particular target
8917 schema, they will be placed in the first valid schema named in
8918 <varname>search_path</varname>. An error is reported if the search
8919 path is empty.
8920 </para>
8922 <para>
8923 The default value for this parameter is
8924 <literal>"$user", public</literal>.
8925 This setting supports shared use of a database (where no users
8926 have private schemas, and all share use of <literal>public</literal>),
8927 private per-user schemas, and combinations of these. Other
8928 effects can be obtained by altering the default search path
8929 setting, either globally or per-user.
8930 </para>
8932 <para>
8933 For more information on schema handling, see
8934 <xref linkend="ddl-schemas"/>. In particular, the default
8935 configuration is suitable only when the database has a single user or
8936 a few mutually-trusting users.
8937 </para>
8939 <para>
8940 The current effective value of the search path can be examined
8941 via the <acronym>SQL</acronym> function
8942 <function>current_schemas</function>
8943 (see <xref linkend="functions-info"/>).
8944 This is not quite the same as
8945 examining the value of <varname>search_path</varname>, since
8946 <function>current_schemas</function> shows how the items
8947 appearing in <varname>search_path</varname> were resolved.
8948 </para>
8950 </listitem>
8951 </varlistentry>
8953 <varlistentry id="guc-row-security" xreflabel="row_security">
8954 <term><varname>row_security</varname> (<type>boolean</type>)
8955 <indexterm>
8956 <primary><varname>row_security</varname> configuration parameter</primary>
8957 </indexterm>
8958 </term>
8959 <listitem>
8960 <para>
8961 This variable controls whether to raise an error in lieu of applying a
8962 row security policy. When set to <literal>on</literal>, policies apply
8963 normally. When set to <literal>off</literal>, queries fail which would
8964 otherwise apply at least one policy. The default is <literal>on</literal>.
8965 Change to <literal>off</literal> where limited row visibility could cause
8966 incorrect results; for example, <application>pg_dump</application> makes that
8967 change by default. This variable has no effect on roles which bypass
8968 every row security policy, to wit, superusers and roles with
8969 the <literal>BYPASSRLS</literal> attribute.
8970 </para>
8972 <para>
8973 For more information on row security policies,
8974 see <xref linkend="sql-createpolicy"/>.
8975 </para>
8976 </listitem>
8977 </varlistentry>
8979 <varlistentry id="guc-default-table-access-method" xreflabel="default_table_access_method">
8980 <term><varname>default_table_access_method</varname> (<type>string</type>)
8981 <indexterm>
8982 <primary><varname>default_table_access_method</varname> configuration parameter</primary>
8983 </indexterm>
8984 </term>
8985 <listitem>
8986 <para>
8987 This parameter specifies the default table access method to use when
8988 creating tables or materialized views if the <command>CREATE</command>
8989 command does not explicitly specify an access method, or when
8990 <command>SELECT ... INTO</command> is used, which does not allow
8991 specifying a table access method. The default is <literal>heap</literal>.
8992 </para>
8993 </listitem>
8994 </varlistentry>
8996 <varlistentry id="guc-default-tablespace" xreflabel="default_tablespace">
8997 <term><varname>default_tablespace</varname> (<type>string</type>)
8998 <indexterm>
8999 <primary><varname>default_tablespace</varname> configuration parameter</primary>
9000 </indexterm>
9001 <indexterm><primary>tablespace</primary><secondary>default</secondary></indexterm>
9002 </term>
9003 <listitem>
9004 <para>
9005 This variable specifies the default tablespace in which to create
9006 objects (tables and indexes) when a <command>CREATE</command> command does
9007 not explicitly specify a tablespace.
9008 </para>
9010 <para>
9011 The value is either the name of a tablespace, or an empty string
9012 to specify using the default tablespace of the current database.
9013 If the value does not match the name of any existing tablespace,
9014 <productname>PostgreSQL</productname> will automatically use the default
9015 tablespace of the current database. If a nondefault tablespace
9016 is specified, the user must have <literal>CREATE</literal> privilege
9017 for it, or creation attempts will fail.
9018 </para>
9020 <para>
9021 This variable is not used for temporary tables; for them,
9022 <xref linkend="guc-temp-tablespaces"/> is consulted instead.
9023 </para>
9025 <para>
9026 This variable is also not used when creating databases.
9027 By default, a new database inherits its tablespace setting from
9028 the template database it is copied from.
9029 </para>
9031 <para>
9032 If this parameter is set to a value other than the empty string
9033 when a partitioned table is created, the partitioned table's
9034 tablespace will be set to that value, which will be used as
9035 the default tablespace for partitions created in the future,
9036 even if <varname>default_tablespace</varname> has changed since then.
9037 </para>
9039 <para>
9040 For more information on tablespaces,
9041 see <xref linkend="manage-ag-tablespaces"/>.
9042 </para>
9043 </listitem>
9044 </varlistentry>
9046 <varlistentry id="guc-default-toast-compression" xreflabel="default_toast_compression">
9047 <term><varname>default_toast_compression</varname> (<type>enum</type>)
9048 <indexterm>
9049 <primary><varname>default_toast_compression</varname> configuration parameter</primary>
9050 </indexterm>
9051 </term>
9052 <listitem>
9053 <para>
9054 This variable sets the default
9055 <link linkend="storage-toast">TOAST</link>
9056 compression method for values of compressible columns.
9057 (This can be overridden for individual columns by setting
9058 the <literal>COMPRESSION</literal> column option in
9059 <command>CREATE TABLE</command> or
9060 <command>ALTER TABLE</command>.)
9061 The supported compression methods are <literal>pglz</literal> and
9062 (if <productname>PostgreSQL</productname> was compiled with
9063 <option>--with-lz4</option>) <literal>lz4</literal>.
9064 The default is <literal>pglz</literal>.
9065 </para>
9066 </listitem>
9067 </varlistentry>
9069 <varlistentry id="guc-temp-tablespaces" xreflabel="temp_tablespaces">
9070 <term><varname>temp_tablespaces</varname> (<type>string</type>)
9071 <indexterm>
9072 <primary><varname>temp_tablespaces</varname> configuration parameter</primary>
9073 </indexterm>
9074 <indexterm><primary>tablespace</primary><secondary>temporary</secondary></indexterm>
9075 </term>
9076 <listitem>
9077 <para>
9078 This variable specifies tablespaces in which to create temporary
9079 objects (temp tables and indexes on temp tables) when a
9080 <command>CREATE</command> command does not explicitly specify a tablespace.
9081 Temporary files for purposes such as sorting large data sets
9082 are also created in these tablespaces.
9083 </para>
9085 <para>
9086 The value is a list of names of tablespaces. When there is more than
9087 one name in the list, <productname>PostgreSQL</productname> chooses a random
9088 member of the list each time a temporary object is to be created;
9089 except that within a transaction, successively created temporary
9090 objects are placed in successive tablespaces from the list.
9091 If the selected element of the list is an empty string,
9092 <productname>PostgreSQL</productname> will automatically use the default
9093 tablespace of the current database instead.
9094 </para>
9096 <para>
9097 When <varname>temp_tablespaces</varname> is set interactively, specifying a
9098 nonexistent tablespace is an error, as is specifying a tablespace for
9099 which the user does not have <literal>CREATE</literal> privilege. However,
9100 when using a previously set value, nonexistent tablespaces are
9101 ignored, as are tablespaces for which the user lacks
9102 <literal>CREATE</literal> privilege. In particular, this rule applies when
9103 using a value set in <filename>postgresql.conf</filename>.
9104 </para>
9106 <para>
9107 The default value is an empty string, which results in all temporary
9108 objects being created in the default tablespace of the current
9109 database.
9110 </para>
9112 <para>
9113 See also <xref linkend="guc-default-tablespace"/>.
9114 </para>
9115 </listitem>
9116 </varlistentry>
9118 <varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
9119 <term><varname>check_function_bodies</varname> (<type>boolean</type>)
9120 <indexterm>
9121 <primary><varname>check_function_bodies</varname> configuration parameter</primary>
9122 </indexterm>
9123 </term>
9124 <listitem>
9125 <para>
9126 This parameter is normally on. When set to <literal>off</literal>, it
9127 disables validation of the routine body string during <xref
9128 linkend="sql-createfunction"/> and <xref
9129 linkend="sql-createprocedure"/>. Disabling validation avoids side
9130 effects of the validation process, in particular preventing false
9131 positives due to problems such as forward references.
9132 Set this parameter
9133 to <literal>off</literal> before loading functions on behalf of other
9134 users; <application>pg_dump</application> does so automatically.
9135 </para>
9136 </listitem>
9137 </varlistentry>
9139 <varlistentry id="guc-default-transaction-isolation" xreflabel="default_transaction_isolation">
9140 <term><varname>default_transaction_isolation</varname> (<type>enum</type>)
9141 <indexterm>
9142 <primary>transaction isolation level</primary>
9143 <secondary>setting default</secondary>
9144 </indexterm>
9145 <indexterm>
9146 <primary><varname>default_transaction_isolation</varname> configuration parameter</primary>
9147 </indexterm>
9148 </term>
9149 <listitem>
9150 <para>
9151 Each SQL transaction has an isolation level, which can be
9152 either <quote>read uncommitted</quote>, <quote>read
9153 committed</quote>, <quote>repeatable read</quote>, or
9154 <quote>serializable</quote>. This parameter controls the
9155 default isolation level of each new transaction. The default
9156 is <quote>read committed</quote>.
9157 </para>
9159 <para>
9160 Consult <xref linkend="mvcc"/> and <xref
9161 linkend="sql-set-transaction"/> for more information.
9162 </para>
9163 </listitem>
9164 </varlistentry>
9166 <varlistentry id="guc-default-transaction-read-only" xreflabel="default_transaction_read_only">
9167 <term><varname>default_transaction_read_only</varname> (<type>boolean</type>)
9168 <indexterm>
9169 <primary>read-only transaction</primary>
9170 <secondary>setting default</secondary>
9171 </indexterm>
9172 <indexterm>
9173 <primary><varname>default_transaction_read_only</varname> configuration parameter</primary>
9174 </indexterm>
9175 </term>
9176 <listitem>
9177 <para>
9178 A read-only SQL transaction cannot alter non-temporary tables.
9179 This parameter controls the default read-only status of each new
9180 transaction. The default is <literal>off</literal> (read/write).
9181 </para>
9183 <para>
9184 Consult <xref linkend="sql-set-transaction"/> for more information.
9185 </para>
9186 </listitem>
9187 </varlistentry>
9189 <varlistentry id="guc-default-transaction-deferrable" xreflabel="default_transaction_deferrable">
9190 <term><varname>default_transaction_deferrable</varname> (<type>boolean</type>)
9191 <indexterm>
9192 <primary>deferrable transaction</primary>
9193 <secondary>setting default</secondary>
9194 </indexterm>
9195 <indexterm>
9196 <primary><varname>default_transaction_deferrable</varname> configuration parameter</primary>
9197 </indexterm>
9198 </term>
9199 <listitem>
9200 <para>
9201 When running at the <literal>serializable</literal> isolation level,
9202 a deferrable read-only SQL transaction may be delayed before
9203 it is allowed to proceed. However, once it begins executing
9204 it does not incur any of the overhead required to ensure
9205 serializability; so serialization code will have no reason to
9206 force it to abort because of concurrent updates, making this
9207 option suitable for long-running read-only transactions.
9208 </para>
9210 <para>
9211 This parameter controls the default deferrable status of each
9212 new transaction. It currently has no effect on read-write
9213 transactions or those operating at isolation levels lower
9214 than <literal>serializable</literal>. The default is <literal>off</literal>.
9215 </para>
9217 <para>
9218 Consult <xref linkend="sql-set-transaction"/> for more information.
9219 </para>
9220 </listitem>
9221 </varlistentry>
9223 <varlistentry id="guc-transaction-isolation" xreflabel="transaction_isolation">
9224 <term><varname>transaction_isolation</varname> (<type>enum</type>)
9225 <indexterm>
9226 <primary>transaction isolation level</primary>
9227 </indexterm>
9228 <indexterm>
9229 <primary><varname>transaction_isolation</varname> configuration parameter</primary>
9230 </indexterm>
9231 </term>
9232 <listitem>
9233 <para>
9234 This parameter reflects the current transaction's isolation level.
9235 At the beginning of each transaction, it is set to the current value
9236 of <xref linkend="guc-default-transaction-isolation"/>.
9237 Any subsequent attempt to change it is equivalent to a <xref
9238 linkend="sql-set-transaction"/> command.
9239 </para>
9240 </listitem>
9241 </varlistentry>
9243 <varlistentry id="guc-transaction-read-only" xreflabel="transaction_read_only">
9244 <term><varname>transaction_read_only</varname> (<type>boolean</type>)
9245 <indexterm>
9246 <primary>read-only transaction</primary>
9247 </indexterm>
9248 <indexterm>
9249 <primary><varname>transaction_read_only</varname> configuration parameter</primary>
9250 </indexterm>
9251 </term>
9252 <listitem>
9253 <para>
9254 This parameter reflects the current transaction's read-only status.
9255 At the beginning of each transaction, it is set to the current value
9256 of <xref linkend="guc-default-transaction-read-only"/>.
9257 Any subsequent attempt to change it is equivalent to a <xref
9258 linkend="sql-set-transaction"/> command.
9259 </para>
9260 </listitem>
9261 </varlistentry>
9263 <varlistentry id="guc-transaction-deferrable" xreflabel="transaction_deferrable">
9264 <term><varname>transaction_deferrable</varname> (<type>boolean</type>)
9265 <indexterm>
9266 <primary>deferrable transaction</primary>
9267 </indexterm>
9268 <indexterm>
9269 <primary><varname>transaction_deferrable</varname> configuration parameter</primary>
9270 </indexterm>
9271 </term>
9272 <listitem>
9273 <para>
9274 This parameter reflects the current transaction's deferrability status.
9275 At the beginning of each transaction, it is set to the current value
9276 of <xref linkend="guc-default-transaction-deferrable"/>.
9277 Any subsequent attempt to change it is equivalent to a <xref
9278 linkend="sql-set-transaction"/> command.
9279 </para>
9280 </listitem>
9281 </varlistentry>
9284 <varlistentry id="guc-session-replication-role" xreflabel="session_replication_role">
9285 <term><varname>session_replication_role</varname> (<type>enum</type>)
9286 <indexterm>
9287 <primary><varname>session_replication_role</varname> configuration parameter</primary>
9288 </indexterm>
9289 </term>
9290 <listitem>
9291 <para>
9292 Controls firing of replication-related triggers and rules for the
9293 current session.
9294 Possible values are <literal>origin</literal> (the default),
9295 <literal>replica</literal> and <literal>local</literal>.
9296 Setting this parameter results in discarding any previously cached
9297 query plans.
9298 Only superusers and users with the appropriate <literal>SET</literal>
9299 privilege can change this setting.
9300 </para>
9302 <para>
9303 The intended use of this setting is that logical replication systems
9304 set it to <literal>replica</literal> when they are applying replicated
9305 changes. The effect of that will be that triggers and rules (that
9306 have not been altered from their default configuration) will not fire
9307 on the replica. See the <link linkend="sql-altertable"><command>ALTER TABLE</command></link> clauses
9308 <literal>ENABLE TRIGGER</literal> and <literal>ENABLE RULE</literal>
9309 for more information.
9310 </para>
9312 <para>
9313 PostgreSQL treats the settings <literal>origin</literal> and
9314 <literal>local</literal> the same internally. Third-party replication
9315 systems may use these two values for their internal purposes, for
9316 example using <literal>local</literal> to designate a session whose
9317 changes should not be replicated.
9318 </para>
9320 <para>
9321 Since foreign keys are implemented as triggers, setting this parameter
9322 to <literal>replica</literal> also disables all foreign key checks,
9323 which can leave data in an inconsistent state if improperly used.
9324 </para>
9325 </listitem>
9326 </varlistentry>
9328 <varlistentry id="guc-statement-timeout" xreflabel="statement_timeout">
9329 <term><varname>statement_timeout</varname> (<type>integer</type>)
9330 <indexterm>
9331 <primary><varname>statement_timeout</varname> configuration parameter</primary>
9332 </indexterm>
9333 </term>
9334 <listitem>
9335 <para>
9336 Abort any statement that takes more than the specified amount of time.
9337 If <varname>log_min_error_statement</varname> is set
9338 to <literal>ERROR</literal> or lower, the statement that timed out
9339 will also be logged.
9340 If this value is specified without units, it is taken as milliseconds.
9341 A value of zero (the default) disables the timeout.
9342 </para>
9344 <para>
9345 The timeout is measured from the time a command arrives at the
9346 server until it is completed by the server. If multiple SQL
9347 statements appear in a single simple-query message, the timeout
9348 is applied to each statement separately.
9349 (<productname>PostgreSQL</productname> versions before 13 usually
9350 treated the timeout as applying to the whole query string.)
9351 In extended query protocol, the timeout starts running when any
9352 query-related message (Parse, Bind, Execute, Describe) arrives, and
9353 it is canceled by completion of an Execute or Sync message.
9354 </para>
9356 <para>
9357 Setting <varname>statement_timeout</varname> in
9358 <filename>postgresql.conf</filename> is not recommended because it would
9359 affect all sessions.
9360 </para>
9361 </listitem>
9362 </varlistentry>
9364 <varlistentry id="guc-transaction-timeout" xreflabel="transaction_timeout">
9365 <term><varname>transaction_timeout</varname> (<type>integer</type>)
9366 <indexterm>
9367 <primary><varname>transaction_timeout</varname> configuration parameter</primary>
9368 </indexterm>
9369 </term>
9370 <listitem>
9371 <para>
9372 Terminate any session that spans longer than the specified amount of
9373 time in a transaction. The limit applies both to explicit transactions
9374 (started with <command>BEGIN</command>) and to an implicitly started
9375 transaction corresponding to a single statement.
9376 If this value is specified without units, it is taken as milliseconds.
9377 A value of zero (the default) disables the timeout.
9378 </para>
9380 <para>
9381 If <varname>transaction_timeout</varname> is shorter or equal to
9382 <varname>idle_in_transaction_session_timeout</varname> or <varname>statement_timeout</varname>
9383 then the longer timeout is ignored.
9384 </para>
9386 <para>
9387 Setting <varname>transaction_timeout</varname> in
9388 <filename>postgresql.conf</filename> is not recommended because it would
9389 affect all sessions.
9390 </para>
9392 <note>
9393 <para>
9394 Prepared transactions are not subject to this timeout.
9395 </para>
9396 </note>
9397 </listitem>
9398 </varlistentry>
9400 <varlistentry id="guc-lock-timeout" xreflabel="lock_timeout">
9401 <term><varname>lock_timeout</varname> (<type>integer</type>)
9402 <indexterm>
9403 <primary><varname>lock_timeout</varname> configuration parameter</primary>
9404 </indexterm>
9405 </term>
9406 <listitem>
9407 <para>
9408 Abort any statement that waits longer than the specified amount of
9409 time while attempting to acquire a lock on a table, index,
9410 row, or other database object. The time limit applies separately to
9411 each lock acquisition attempt. The limit applies both to explicit
9412 locking requests (such as <command>LOCK TABLE</command>, or <command>SELECT
9413 FOR UPDATE</command> without <literal>NOWAIT</literal>) and to implicitly-acquired
9414 locks.
9415 If this value is specified without units, it is taken as milliseconds.
9416 A value of zero (the default) disables the timeout.
9417 </para>
9419 <para>
9420 Unlike <varname>statement_timeout</varname>, this timeout can only occur
9421 while waiting for locks. Note that if <varname>statement_timeout</varname>
9422 is nonzero, it is rather pointless to set <varname>lock_timeout</varname> to
9423 the same or larger value, since the statement timeout would always
9424 trigger first. If <varname>log_min_error_statement</varname> is set to
9425 <literal>ERROR</literal> or lower, the statement that timed out will be
9426 logged.
9427 </para>
9429 <para>
9430 Setting <varname>lock_timeout</varname> in
9431 <filename>postgresql.conf</filename> is not recommended because it would
9432 affect all sessions.
9433 </para>
9434 </listitem>
9435 </varlistentry>
9437 <varlistentry id="guc-idle-in-transaction-session-timeout" xreflabel="idle_in_transaction_session_timeout">
9438 <term><varname>idle_in_transaction_session_timeout</varname> (<type>integer</type>)
9439 <indexterm>
9440 <primary><varname>idle_in_transaction_session_timeout</varname> configuration parameter</primary>
9441 </indexterm>
9442 </term>
9443 <listitem>
9444 <para>
9445 Terminate any session that has been idle (that is, waiting for a
9446 client query) within an open transaction for longer than the
9447 specified amount of time.
9448 If this value is specified without units, it is taken as milliseconds.
9449 A value of zero (the default) disables the timeout.
9450 </para>
9452 <para>
9453 This option can be used to ensure that idle sessions do not hold
9454 locks for an unreasonable amount of time. Even when no significant
9455 locks are held, an open transaction prevents vacuuming away
9456 recently-dead tuples that may be visible only to this transaction;
9457 so remaining idle for a long time can contribute to table bloat.
9458 See <xref linkend="routine-vacuuming"/> for more details.
9459 </para>
9460 </listitem>
9461 </varlistentry>
9463 <varlistentry id="guc-idle-session-timeout" xreflabel="idle_session_timeout">
9464 <term><varname>idle_session_timeout</varname> (<type>integer</type>)
9465 <indexterm>
9466 <primary><varname>idle_session_timeout</varname> configuration parameter</primary>
9467 </indexterm>
9468 </term>
9469 <listitem>
9470 <para>
9471 Terminate any session that has been idle (that is, waiting for a
9472 client query), but not within an open transaction, for longer than
9473 the specified amount of time.
9474 If this value is specified without units, it is taken as milliseconds.
9475 A value of zero (the default) disables the timeout.
9476 </para>
9478 <para>
9479 Unlike the case with an open transaction, an idle session without a
9480 transaction imposes no large costs on the server, so there is less
9481 need to enable this timeout
9482 than <varname>idle_in_transaction_session_timeout</varname>.
9483 </para>
9485 <para>
9486 Be wary of enforcing this timeout on connections made through
9487 connection-pooling software or other middleware, as such a layer
9488 may not react well to unexpected connection closure. It may be
9489 helpful to enable this timeout only for interactive sessions,
9490 perhaps by applying it only to particular users.
9491 </para>
9492 </listitem>
9493 </varlistentry>
9495 <varlistentry id="guc-vacuum-freeze-table-age" xreflabel="vacuum_freeze_table_age">
9496 <term><varname>vacuum_freeze_table_age</varname> (<type>integer</type>)
9497 <indexterm>
9498 <primary><varname>vacuum_freeze_table_age</varname> configuration parameter</primary>
9499 </indexterm>
9500 </term>
9501 <listitem>
9502 <para>
9503 <command>VACUUM</command> performs an aggressive scan if the table's
9504 <structname>pg_class</structname>.<structfield>relfrozenxid</structfield> field has reached
9505 the age specified by this setting. An aggressive scan differs from
9506 a regular <command>VACUUM</command> in that it visits every page that might
9507 contain unfrozen XIDs or MXIDs, not just those that might contain dead
9508 tuples. The default is 150 million transactions. Although users can
9509 set this value anywhere from zero to two billion, <command>VACUUM</command>
9510 will silently limit the effective value to 95% of
9511 <xref linkend="guc-autovacuum-freeze-max-age"/>, so that a
9512 periodic manual <command>VACUUM</command> has a chance to run before an
9513 anti-wraparound autovacuum is launched for the table. For more
9514 information see
9515 <xref linkend="vacuum-for-wraparound"/>.
9516 </para>
9517 </listitem>
9518 </varlistentry>
9520 <varlistentry id="guc-vacuum-freeze-min-age" xreflabel="vacuum_freeze_min_age">
9521 <term><varname>vacuum_freeze_min_age</varname> (<type>integer</type>)
9522 <indexterm>
9523 <primary><varname>vacuum_freeze_min_age</varname> configuration parameter</primary>
9524 </indexterm>
9525 </term>
9526 <listitem>
9527 <para>
9528 Specifies the cutoff age (in transactions) that
9529 <command>VACUUM</command> should use to decide whether to
9530 trigger freezing of pages that have an older XID.
9531 The default is 50 million transactions. Although
9532 users can set this value anywhere from zero to one billion,
9533 <command>VACUUM</command> will silently limit the effective value to half
9534 the value of <xref linkend="guc-autovacuum-freeze-max-age"/>, so
9535 that there is not an unreasonably short time between forced
9536 autovacuums. For more information see <xref
9537 linkend="vacuum-for-wraparound"/>.
9538 </para>
9539 </listitem>
9540 </varlistentry>
9542 <varlistentry id="guc-vacuum-failsafe-age" xreflabel="vacuum_failsafe_age">
9543 <term><varname>vacuum_failsafe_age</varname> (<type>integer</type>)
9544 <indexterm>
9545 <primary><varname>vacuum_failsafe_age</varname> configuration parameter</primary>
9546 </indexterm>
9547 </term>
9548 <listitem>
9549 <para>
9550 Specifies the maximum age (in transactions) that a table's
9551 <structname>pg_class</structname>.<structfield>relfrozenxid</structfield>
9552 field can attain before <command>VACUUM</command> takes
9553 extraordinary measures to avoid system-wide transaction ID
9554 wraparound failure. This is <command>VACUUM</command>'s
9555 strategy of last resort. The failsafe typically triggers
9556 when an autovacuum to prevent transaction ID wraparound has
9557 already been running for some time, though it's possible for
9558 the failsafe to trigger during any <command>VACUUM</command>.
9559 </para>
9560 <para>
9561 When the failsafe is triggered, any cost-based delay that is
9562 in effect will no longer be applied, further non-essential
9563 maintenance tasks (such as index vacuuming) are bypassed, and any
9564 <glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm>
9565 in use will be disabled resulting in <command>VACUUM</command> being
9566 free to make use of all of
9567 <glossterm linkend="glossary-shared-memory">shared buffers</glossterm>.
9568 </para>
9569 <para>
9570 The default is 1.6 billion transactions. Although users can
9571 set this value anywhere from zero to 2.1 billion,
9572 <command>VACUUM</command> will silently adjust the effective
9573 value to no less than 105% of <xref
9574 linkend="guc-autovacuum-freeze-max-age"/>.
9575 </para>
9576 </listitem>
9577 </varlistentry>
9579 <varlistentry id="guc-vacuum-multixact-freeze-table-age" xreflabel="vacuum_multixact_freeze_table_age">
9580 <term><varname>vacuum_multixact_freeze_table_age</varname> (<type>integer</type>)
9581 <indexterm>
9582 <primary><varname>vacuum_multixact_freeze_table_age</varname> configuration parameter</primary>
9583 </indexterm>
9584 </term>
9585 <listitem>
9586 <para>
9587 <command>VACUUM</command> performs an aggressive scan if the table's
9588 <structname>pg_class</structname>.<structfield>relminmxid</structfield> field has reached
9589 the age specified by this setting. An aggressive scan differs from
9590 a regular <command>VACUUM</command> in that it visits every page that might
9591 contain unfrozen XIDs or MXIDs, not just those that might contain dead
9592 tuples. The default is 150 million multixacts.
9593 Although users can set this value anywhere from zero to two billion,
9594 <command>VACUUM</command> will silently limit the effective value to 95% of
9595 <xref linkend="guc-autovacuum-multixact-freeze-max-age"/>, so that a
9596 periodic manual <command>VACUUM</command> has a chance to run before an
9597 anti-wraparound is launched for the table.
9598 For more information see <xref linkend="vacuum-for-multixact-wraparound"/>.
9599 </para>
9600 </listitem>
9601 </varlistentry>
9603 <varlistentry id="guc-vacuum-multixact-freeze-min-age" xreflabel="vacuum_multixact_freeze_min_age">
9604 <term><varname>vacuum_multixact_freeze_min_age</varname> (<type>integer</type>)
9605 <indexterm>
9606 <primary><varname>vacuum_multixact_freeze_min_age</varname> configuration parameter</primary>
9607 </indexterm>
9608 </term>
9609 <listitem>
9610 <para>
9611 Specifies the cutoff age (in multixacts) that <command>VACUUM</command>
9612 should use to decide whether to trigger freezing of pages with
9613 an older multixact ID. The default is 5 million multixacts.
9614 Although users can set this value anywhere from zero to one billion,
9615 <command>VACUUM</command> will silently limit the effective value to half
9616 the value of <xref linkend="guc-autovacuum-multixact-freeze-max-age"/>,
9617 so that there is not an unreasonably short time between forced
9618 autovacuums.
9619 For more information see <xref linkend="vacuum-for-multixact-wraparound"/>.
9620 </para>
9621 </listitem>
9622 </varlistentry>
9624 <varlistentry id="guc-vacuum-multixact-failsafe-age" xreflabel="vacuum_multixact_failsafe_age">
9625 <term><varname>vacuum_multixact_failsafe_age</varname> (<type>integer</type>)
9626 <indexterm>
9627 <primary><varname>vacuum_multixact_failsafe_age</varname> configuration parameter</primary>
9628 </indexterm>
9629 </term>
9630 <listitem>
9631 <para>
9632 Specifies the maximum age (in multixacts) that a table's
9633 <structname>pg_class</structname>.<structfield>relminmxid</structfield>
9634 field can attain before <command>VACUUM</command> takes
9635 extraordinary measures to avoid system-wide multixact ID
9636 wraparound failure. This is <command>VACUUM</command>'s
9637 strategy of last resort. The failsafe typically triggers when
9638 an autovacuum to prevent transaction ID wraparound has already
9639 been running for some time, though it's possible for the
9640 failsafe to trigger during any <command>VACUUM</command>.
9641 </para>
9642 <para>
9643 When the failsafe is triggered, any cost-based delay that is
9644 in effect will no longer be applied, and further non-essential
9645 maintenance tasks (such as index vacuuming) are bypassed.
9646 </para>
9647 <para>
9648 The default is 1.6 billion multixacts. Although users can set
9649 this value anywhere from zero to 2.1 billion,
9650 <command>VACUUM</command> will silently adjust the effective
9651 value to no less than 105% of <xref
9652 linkend="guc-autovacuum-multixact-freeze-max-age"/>.
9653 </para>
9654 </listitem>
9655 </varlistentry>
9657 <varlistentry id="guc-bytea-output" xreflabel="bytea_output">
9658 <term><varname>bytea_output</varname> (<type>enum</type>)
9659 <indexterm>
9660 <primary><varname>bytea_output</varname> configuration parameter</primary>
9661 </indexterm>
9662 </term>
9663 <listitem>
9664 <para>
9665 Sets the output format for values of type <type>bytea</type>.
9666 Valid values are <literal>hex</literal> (the default)
9667 and <literal>escape</literal> (the traditional PostgreSQL
9668 format). See <xref linkend="datatype-binary"/> for more
9669 information. The <type>bytea</type> type always
9670 accepts both formats on input, regardless of this setting.
9671 </para>
9672 </listitem>
9673 </varlistentry>
9675 <varlistentry id="guc-xmlbinary" xreflabel="xmlbinary">
9676 <term><varname>xmlbinary</varname> (<type>enum</type>)
9677 <indexterm>
9678 <primary><varname>xmlbinary</varname> configuration parameter</primary>
9679 </indexterm>
9680 </term>
9681 <listitem>
9682 <para>
9683 Sets how binary values are to be encoded in XML. This applies
9684 for example when <type>bytea</type> values are converted to
9685 XML by the functions <function>xmlelement</function> or
9686 <function>xmlforest</function>. Possible values are
9687 <literal>base64</literal> and <literal>hex</literal>, which
9688 are both defined in the XML Schema standard. The default is
9689 <literal>base64</literal>. For further information about
9690 XML-related functions, see <xref linkend="functions-xml"/>.
9691 </para>
9693 <para>
9694 The actual choice here is mostly a matter of taste,
9695 constrained only by possible restrictions in client
9696 applications. Both methods support all possible values,
9697 although the hex encoding will be somewhat larger than the
9698 base64 encoding.
9699 </para>
9700 </listitem>
9701 </varlistentry>
9703 <varlistentry id="guc-xmloption" xreflabel="xmloption">
9704 <term><varname>xmloption</varname> (<type>enum</type>)
9705 <indexterm>
9706 <primary><varname>xmloption</varname> configuration parameter</primary>
9707 </indexterm>
9708 <indexterm>
9709 <primary><varname>SET XML OPTION</varname></primary>
9710 </indexterm>
9711 <indexterm>
9712 <primary>XML option</primary>
9713 </indexterm>
9714 </term>
9715 <listitem>
9716 <para>
9717 Sets whether <literal>DOCUMENT</literal> or
9718 <literal>CONTENT</literal> is implicit when converting between
9719 XML and character string values. See <xref
9720 linkend="datatype-xml"/> for a description of this. Valid
9721 values are <literal>DOCUMENT</literal> and
9722 <literal>CONTENT</literal>. The default is
9723 <literal>CONTENT</literal>.
9724 </para>
9726 <para>
9727 According to the SQL standard, the command to set this option is
9728 <synopsis>
9729 SET XML OPTION { DOCUMENT | CONTENT };
9730 </synopsis>
9731 This syntax is also available in PostgreSQL.
9732 </para>
9733 </listitem>
9734 </varlistentry>
9736 <varlistentry id="guc-gin-pending-list-limit" xreflabel="gin_pending_list_limit">
9737 <term><varname>gin_pending_list_limit</varname> (<type>integer</type>)
9738 <indexterm>
9739 <primary><varname>gin_pending_list_limit</varname></primary>
9740 <secondary>configuration parameter</secondary>
9741 </indexterm>
9742 </term>
9743 <listitem>
9744 <para>
9745 Sets the maximum size of a GIN index's pending list, which is used
9746 when <literal>fastupdate</literal> is enabled. If the list grows
9747 larger than this maximum size, it is cleaned up by moving
9748 the entries in it to the index's main GIN data structure in bulk.
9749 If this value is specified without units, it is taken as kilobytes.
9750 The default is four megabytes (<literal>4MB</literal>). This setting
9751 can be overridden for individual GIN indexes by changing
9752 index storage parameters.
9753 See <xref linkend="gin-fast-update"/> and <xref linkend="gin-tips"/>
9754 for more information.
9755 </para>
9756 </listitem>
9757 </varlistentry>
9759 <varlistentry id="guc-createrole-self-grant" xreflabel="createrole_self_grant">
9760 <term><varname>createrole_self_grant</varname> (<type>string</type>)
9761 <indexterm>
9762 <primary><varname>createrole_self_grant</varname></primary>
9763 <secondary>configuration parameter</secondary>
9764 </indexterm>
9765 </term>
9766 <listitem>
9767 <para>
9768 If a user who has <literal>CREATEROLE</literal> but not
9769 <literal>SUPERUSER</literal> creates a role, and if this
9770 is set to a non-empty value, the newly-created role will be granted
9771 to the creating user with the options specified. The value must be
9772 <literal>set</literal>, <literal>inherit</literal>, or a
9773 comma-separated list of these. The default value is an empty string,
9774 which disables the feature.
9775 </para>
9776 <para>
9777 The purpose of this option is to allow a <literal>CREATEROLE</literal>
9778 user who is not a superuser to automatically inherit, or automatically
9779 gain the ability to <literal>SET ROLE</literal> to, any created users.
9780 Since a <literal>CREATEROLE</literal> user is always implicitly granted
9781 <literal>ADMIN OPTION</literal> on created roles, that user could
9782 always execute a <literal>GRANT</literal> statement that would achieve
9783 the same effect as this setting. However, it can be convenient for
9784 usability reasons if the grant happens automatically. A superuser
9785 automatically inherits the privileges of every role and can always
9786 <literal>SET ROLE</literal> to any role, and this setting can be used
9787 to produce a similar behavior for <literal>CREATEROLE</literal> users
9788 for users which they create.
9789 </para>
9790 </listitem>
9791 </varlistentry>
9793 <varlistentry id="guc-event-triggers" xreflabel="event_triggers">
9794 <term><varname>event_triggers</varname> (<type>boolean</type>)
9795 <indexterm>
9796 <primary><varname>event_triggers</varname></primary>
9797 <secondary>configuration parameter</secondary>
9798 </indexterm>
9799 </term>
9800 <listitem>
9801 <para>
9802 Allow temporarily disabling execution of event triggers in order to
9803 troubleshoot and repair faulty event triggers. All event triggers will
9804 be disabled by setting it to <literal>false</literal>. Setting the value
9805 to <literal>true</literal> allows all event triggers to fire, this
9806 is the default value. Only superusers and users with the appropriate
9807 <literal>SET</literal> privilege can change this setting.
9808 </para>
9809 </listitem>
9810 </varlistentry>
9812 <varlistentry id="guc-restrict-nonsystem-relation-kind" xreflabel="restrict_nonsystem_relation_kind">
9813 <term><varname>restrict_nonsystem_relation_kind</varname> (<type>string</type>)
9814 <indexterm>
9815 <primary><varname>restrict_nonsystem_relation_kind</varname></primary>
9816 <secondary>configuration parameter</secondary>
9817 </indexterm>
9818 </term>
9819 <listitem>
9820 <para>
9821 Set relation kinds for which access to non-system relations is prohibited.
9822 The value takes the form of a comma-separated list of relation kinds.
9823 Currently, the supported relation kinds are <literal>view</literal> and
9824 <literal>foreign-table</literal>.
9825 </para>
9826 </listitem>
9827 </varlistentry>
9829 </variablelist>
9830 </sect2>
9831 <sect2 id="runtime-config-client-format">
9832 <title>Locale and Formatting</title>
9834 <variablelist>
9836 <varlistentry id="guc-datestyle" xreflabel="DateStyle">
9837 <term><varname>DateStyle</varname> (<type>string</type>)
9838 <indexterm>
9839 <primary><varname>DateStyle</varname> configuration parameter</primary>
9840 </indexterm>
9841 </term>
9842 <listitem>
9843 <para>
9844 Sets the display format for date and time values, as well as the
9845 rules for interpreting ambiguous date input values. For
9846 historical reasons, this variable contains two independent
9847 components: the output format specification (<literal>ISO</literal>,
9848 <literal>Postgres</literal>, <literal>SQL</literal>, or <literal>German</literal>)
9849 and the input/output specification for year/month/day ordering
9850 (<literal>DMY</literal>, <literal>MDY</literal>, or <literal>YMD</literal>). These
9851 can be set separately or together. The keywords <literal>Euro</literal>
9852 and <literal>European</literal> are synonyms for <literal>DMY</literal>; the
9853 keywords <literal>US</literal>, <literal>NonEuro</literal>, and
9854 <literal>NonEuropean</literal> are synonyms for <literal>MDY</literal>. See
9855 <xref linkend="datatype-datetime"/> for more information. The
9856 built-in default is <literal>ISO, MDY</literal>, but
9857 <application>initdb</application> will initialize the
9858 configuration file with a setting that corresponds to the
9859 behavior of the chosen <varname>lc_time</varname> locale.
9860 </para>
9861 </listitem>
9862 </varlistentry>
9864 <varlistentry id="guc-intervalstyle" xreflabel="IntervalStyle">
9865 <term><varname>IntervalStyle</varname> (<type>enum</type>)
9866 <indexterm>
9867 <primary><varname>IntervalStyle</varname> configuration parameter</primary>
9868 </indexterm>
9869 </term>
9870 <listitem>
9871 <para>
9872 Sets the display format for interval values.
9873 The value <literal>sql_standard</literal> will produce
9874 output matching <acronym>SQL</acronym> standard interval literals.
9875 The value <literal>postgres</literal> (which is the default) will produce
9876 output matching <productname>PostgreSQL</productname> releases prior to 8.4
9877 when the <xref linkend="guc-datestyle"/>
9878 parameter was set to <literal>ISO</literal>.
9879 The value <literal>postgres_verbose</literal> will produce output
9880 matching <productname>PostgreSQL</productname> releases prior to 8.4
9881 when the <varname>DateStyle</varname>
9882 parameter was set to non-<literal>ISO</literal> output.
9883 The value <literal>iso_8601</literal> will produce output matching the time
9884 interval <quote>format with designators</quote> defined in section
9885 4.4.3.2 of ISO 8601.
9886 </para>
9887 <para>
9888 The <varname>IntervalStyle</varname> parameter also affects the
9889 interpretation of ambiguous interval input. See
9890 <xref linkend="datatype-interval-input"/> for more information.
9891 </para>
9892 </listitem>
9893 </varlistentry>
9895 <varlistentry id="guc-timezone" xreflabel="TimeZone">
9896 <term><varname>TimeZone</varname> (<type>string</type>)
9897 <indexterm>
9898 <primary><varname>TimeZone</varname> configuration parameter</primary>
9899 </indexterm>
9900 <indexterm><primary>time zone</primary></indexterm>
9901 </term>
9902 <listitem>
9903 <para>
9904 Sets the time zone for displaying and interpreting time stamps.
9905 The built-in default is <literal>GMT</literal>, but that is typically
9906 overridden in <filename>postgresql.conf</filename>; <application>initdb</application>
9907 will install a setting there corresponding to its system environment.
9908 See <xref linkend="datatype-timezones"/> for more information.
9909 </para>
9910 </listitem>
9911 </varlistentry>
9913 <varlistentry id="guc-timezone-abbreviations" xreflabel="timezone_abbreviations">
9914 <term><varname>timezone_abbreviations</varname> (<type>string</type>)
9915 <indexterm>
9916 <primary><varname>timezone_abbreviations</varname> configuration parameter</primary>
9917 </indexterm>
9918 <indexterm><primary>time zone names</primary></indexterm>
9919 </term>
9920 <listitem>
9921 <para>
9922 Sets the collection of time zone abbreviations that will be accepted
9923 by the server for datetime input. The default is <literal>'Default'</literal>,
9924 which is a collection that works in most of the world; there are
9925 also <literal>'Australia'</literal> and <literal>'India'</literal>,
9926 and other collections can be defined for a particular installation.
9927 See <xref linkend="datetime-config-files"/> for more information.
9928 </para>
9929 </listitem>
9930 </varlistentry>
9932 <varlistentry id="guc-extra-float-digits" xreflabel="extra_float_digits">
9933 <term><varname>extra_float_digits</varname> (<type>integer</type>)
9934 <indexterm>
9935 <primary>significant digits</primary>
9936 </indexterm>
9937 <indexterm>
9938 <primary>floating-point</primary>
9939 <secondary>display</secondary>
9940 </indexterm>
9941 <indexterm>
9942 <primary><varname>extra_float_digits</varname> configuration parameter</primary>
9943 </indexterm>
9944 </term>
9945 <listitem>
9946 <para>
9947 This parameter adjusts the number of digits used for textual output of
9948 floating-point values, including <type>float4</type>, <type>float8</type>,
9949 and geometric data types.
9950 </para>
9951 <para>
9952 If the value is 1 (the default) or above, float values are output in
9953 shortest-precise format; see <xref linkend="datatype-float"/>. The
9954 actual number of digits generated depends only on the value being
9955 output, not on the value of this parameter. At most 17 digits are
9956 required for <type>float8</type> values, and 9 for <type>float4</type>
9957 values. This format is both fast and precise, preserving the original
9958 binary float value exactly when correctly read. For historical
9959 compatibility, values up to 3 are permitted.
9960 </para>
9961 <para>
9962 If the value is zero or negative, then the output is rounded to a
9963 given decimal precision. The precision used is the standard number of
9964 digits for the type (<literal>FLT_DIG</literal>
9965 or <literal>DBL_DIG</literal> as appropriate) reduced according to the
9966 value of this parameter. (For example, specifying -1 will cause
9967 <type>float4</type> values to be output rounded to 5 significant
9968 digits, and <type>float8</type> values
9969 rounded to 14 digits.) This format is slower and does not preserve all
9970 the bits of the binary float value, but may be more human-readable.
9971 </para>
9972 <note>
9973 <para>
9974 The meaning of this parameter, and its default value, changed
9975 in <productname>PostgreSQL</productname> 12;
9976 see <xref linkend="datatype-float"/> for further discussion.
9977 </para>
9978 </note>
9979 </listitem>
9980 </varlistentry>
9982 <varlistentry id="guc-client-encoding" xreflabel="client_encoding">
9983 <term><varname>client_encoding</varname> (<type>string</type>)
9984 <indexterm>
9985 <primary><varname>client_encoding</varname> configuration parameter</primary>
9986 </indexterm>
9987 <indexterm><primary>character set</primary></indexterm>
9988 </term>
9989 <listitem>
9990 <para>
9991 Sets the client-side encoding (character set).
9992 The default is to use the database encoding.
9993 The character sets supported by the <productname>PostgreSQL</productname>
9994 server are described in <xref linkend="multibyte-charset-supported"/>.
9995 </para>
9996 </listitem>
9997 </varlistentry>
9999 <varlistentry id="guc-lc-messages" xreflabel="lc_messages">
10000 <term><varname>lc_messages</varname> (<type>string</type>)
10001 <indexterm>
10002 <primary><varname>lc_messages</varname> configuration parameter</primary>
10003 </indexterm>
10004 </term>
10005 <listitem>
10006 <para>
10007 Sets the language in which messages are displayed. Acceptable
10008 values are system-dependent; see <xref linkend="locale"/> for
10009 more information. If this variable is set to the empty string
10010 (which is the default) then the value is inherited from the
10011 execution environment of the server in a system-dependent way.
10012 </para>
10014 <para>
10015 On some systems, this locale category does not exist. Setting
10016 this variable will still work, but there will be no effect.
10017 Also, there is a chance that no translated messages for the
10018 desired language exist. In that case you will continue to see
10019 the English messages.
10020 </para>
10022 <para>
10023 Only superusers and users with the appropriate <literal>SET</literal>
10024 privilege can change this setting.
10025 </para>
10026 </listitem>
10027 </varlistentry>
10029 <varlistentry id="guc-lc-monetary" xreflabel="lc_monetary">
10030 <term><varname>lc_monetary</varname> (<type>string</type>)
10031 <indexterm>
10032 <primary><varname>lc_monetary</varname> configuration parameter</primary>
10033 </indexterm>
10034 </term>
10035 <listitem>
10036 <para>
10037 Sets the locale to use for formatting monetary amounts, for
10038 example with the <function>to_char</function> family of
10039 functions. Acceptable values are system-dependent; see <xref
10040 linkend="locale"/> for more information. If this variable is
10041 set to the empty string (which is the default) then the value
10042 is inherited from the execution environment of the server in a
10043 system-dependent way.
10044 </para>
10045 </listitem>
10046 </varlistentry>
10048 <varlistentry id="guc-lc-numeric" xreflabel="lc_numeric">
10049 <term><varname>lc_numeric</varname> (<type>string</type>)
10050 <indexterm>
10051 <primary><varname>lc_numeric</varname> configuration parameter</primary>
10052 </indexterm>
10053 </term>
10054 <listitem>
10055 <para>
10056 Sets the locale to use for formatting numbers, for example
10057 with the <function>to_char</function> family of
10058 functions. Acceptable values are system-dependent; see <xref
10059 linkend="locale"/> for more information. If this variable is
10060 set to the empty string (which is the default) then the value
10061 is inherited from the execution environment of the server in a
10062 system-dependent way.
10063 </para>
10064 </listitem>
10065 </varlistentry>
10067 <varlistentry id="guc-lc-time" xreflabel="lc_time">
10068 <term><varname>lc_time</varname> (<type>string</type>)
10069 <indexterm>
10070 <primary><varname>lc_time</varname> configuration parameter</primary>
10071 </indexterm>
10072 </term>
10073 <listitem>
10074 <para>
10075 Sets the locale to use for formatting dates and times, for example
10076 with the <function>to_char</function> family of
10077 functions. Acceptable values are system-dependent; see <xref
10078 linkend="locale"/> for more information. If this variable is
10079 set to the empty string (which is the default) then the value
10080 is inherited from the execution environment of the server in a
10081 system-dependent way.
10082 </para>
10083 </listitem>
10084 </varlistentry>
10086 <varlistentry id="guc-icu-validation-level" xreflabel="icu_validation_level">
10087 <term><varname>icu_validation_level</varname> (<type>enum</type>)
10088 <indexterm>
10089 <primary><varname>icu_validation_level</varname> configuration parameter</primary>
10090 </indexterm>
10091 </term>
10092 <listitem>
10093 <para>
10094 When ICU locale validation problems are encountered, controls which
10095 <link linkend="runtime-config-severity-levels">message level</link> is
10096 used to report the problem. Valid values are
10097 <literal>DISABLED</literal>, <literal>DEBUG5</literal>,
10098 <literal>DEBUG4</literal>, <literal>DEBUG3</literal>,
10099 <literal>DEBUG2</literal>, <literal>DEBUG1</literal>,
10100 <literal>INFO</literal>, <literal>NOTICE</literal>,
10101 <literal>WARNING</literal>, <literal>ERROR</literal>, and
10102 <literal>LOG</literal>.
10103 </para>
10104 <para>
10105 If set to <literal>DISABLED</literal>, does not report validation
10106 problems at all. Otherwise reports problems at the given message
10107 level. The default is <literal>WARNING</literal>.
10108 </para>
10109 </listitem>
10110 </varlistentry>
10112 <varlistentry id="guc-default-text-search-config" xreflabel="default_text_search_config">
10113 <term><varname>default_text_search_config</varname> (<type>string</type>)
10114 <indexterm>
10115 <primary><varname>default_text_search_config</varname> configuration parameter</primary>
10116 </indexterm>
10117 </term>
10118 <listitem>
10119 <para>
10120 Selects the text search configuration that is used by those variants
10121 of the text search functions that do not have an explicit argument
10122 specifying the configuration.
10123 See <xref linkend="textsearch"/> for further information.
10124 The built-in default is <literal>pg_catalog.simple</literal>, but
10125 <application>initdb</application> will initialize the
10126 configuration file with a setting that corresponds to the
10127 chosen <varname>lc_ctype</varname> locale, if a configuration
10128 matching that locale can be identified.
10129 </para>
10130 </listitem>
10131 </varlistentry>
10133 </variablelist>
10135 </sect2>
10137 <sect2 id="runtime-config-client-preload">
10138 <title>Shared Library Preloading</title>
10140 <para>
10141 Several settings are available for preloading shared libraries into the
10142 server, in order to load additional functionality or achieve performance
10143 benefits. For example, a setting of
10144 <literal>'$libdir/mylib'</literal> would cause
10145 <literal>mylib.so</literal> (or on some platforms,
10146 <literal>mylib.sl</literal>) to be preloaded from the installation's standard
10147 library directory. The differences between the settings are when they
10148 take effect and what privileges are required to change them.
10149 </para>
10151 <para>
10152 <productname>PostgreSQL</productname> procedural language libraries can
10153 be preloaded in this way, typically by using the
10154 syntax <literal>'$libdir/plXXX'</literal> where
10155 <literal>XXX</literal> is <literal>pgsql</literal>, <literal>perl</literal>,
10156 <literal>tcl</literal>, or <literal>python</literal>.
10157 </para>
10159 <para>
10160 Only shared libraries specifically intended to be used with PostgreSQL
10161 can be loaded this way. Every PostgreSQL-supported library has
10162 a <quote>magic block</quote> that is checked to guarantee compatibility. For
10163 this reason, non-PostgreSQL libraries cannot be loaded in this way. You
10164 might be able to use operating-system facilities such
10165 as <envar>LD_PRELOAD</envar> for that.
10166 </para>
10168 <para>
10169 In general, refer to the documentation of a specific module for the
10170 recommended way to load that module.
10171 </para>
10173 <variablelist>
10174 <varlistentry id="guc-local-preload-libraries" xreflabel="local_preload_libraries">
10175 <term><varname>local_preload_libraries</varname> (<type>string</type>)
10176 <indexterm>
10177 <primary><varname>local_preload_libraries</varname> configuration parameter</primary>
10178 </indexterm>
10179 <indexterm>
10180 <primary><filename>$libdir/plugins</filename></primary>
10181 </indexterm>
10182 </term>
10183 <listitem>
10184 <para>
10185 This variable specifies one or more shared libraries that are to be
10186 preloaded at connection start.
10187 It contains a comma-separated list of library names, where each name
10188 is interpreted as for the <link linkend="sql-load"><command>LOAD</command></link> command.
10189 Whitespace between entries is ignored; surround a library name with
10190 double quotes if you need to include whitespace or commas in the name.
10191 The parameter value only takes effect at the start of the connection.
10192 Subsequent changes have no effect. If a specified library is not
10193 found, the connection attempt will fail.
10194 </para>
10196 <para>
10197 This option can be set by any user. Because of that, the libraries
10198 that can be loaded are restricted to those appearing in the
10199 <filename>plugins</filename> subdirectory of the installation's
10200 standard library directory. (It is the database administrator's
10201 responsibility to ensure that only <quote>safe</quote> libraries
10202 are installed there.) Entries in <varname>local_preload_libraries</varname>
10203 can specify this directory explicitly, for example
10204 <literal>$libdir/plugins/mylib</literal>, or just specify
10205 the library name &mdash; <literal>mylib</literal> would have
10206 the same effect as <literal>$libdir/plugins/mylib</literal>.
10207 </para>
10209 <para>
10210 The intent of this feature is to allow unprivileged users to load
10211 debugging or performance-measurement libraries into specific sessions
10212 without requiring an explicit <command>LOAD</command> command. To that end,
10213 it would be typical to set this parameter using
10214 the <envar>PGOPTIONS</envar> environment variable on the client or by
10215 using
10216 <command>ALTER ROLE SET</command>.
10217 </para>
10219 <para>
10220 However, unless a module is specifically designed to be used in this way by
10221 non-superusers, this is usually not the right setting to use. Look
10222 at <xref linkend="guc-session-preload-libraries"/> instead.
10223 </para>
10224 </listitem>
10225 </varlistentry>
10228 <varlistentry id="guc-session-preload-libraries" xreflabel="session_preload_libraries">
10229 <term><varname>session_preload_libraries</varname> (<type>string</type>)
10230 <indexterm>
10231 <primary><varname>session_preload_libraries</varname> configuration parameter</primary>
10232 </indexterm>
10233 </term>
10234 <listitem>
10235 <para>
10236 This variable specifies one or more shared libraries that are to be
10237 preloaded at connection start.
10238 It contains a comma-separated list of library names, where each name
10239 is interpreted as for the <link linkend="sql-load"><command>LOAD</command></link> command.
10240 Whitespace between entries is ignored; surround a library name with
10241 double quotes if you need to include whitespace or commas in the name.
10242 The parameter value only takes effect at the start of the connection.
10243 Subsequent changes have no effect. If a specified library is not
10244 found, the connection attempt will fail.
10245 Only superusers and users with the appropriate <literal>SET</literal>
10246 privilege can change this setting.
10247 </para>
10249 <para>
10250 The intent of this feature is to allow debugging or
10251 performance-measurement libraries to be loaded into specific sessions
10252 without an explicit
10253 <command>LOAD</command> command being given. For
10254 example, <xref linkend="auto-explain"/> could be enabled for all
10255 sessions under a given user name by setting this parameter
10256 with <command>ALTER ROLE SET</command>. Also, this parameter can be changed
10257 without restarting the server (but changes only take effect when a new
10258 session is started), so it is easier to add new modules this way, even
10259 if they should apply to all sessions.
10260 </para>
10262 <para>
10263 Unlike <xref linkend="guc-shared-preload-libraries"/>, there is no large
10264 performance advantage to loading a library at session start rather than
10265 when it is first used. There is some advantage, however, when
10266 connection pooling is used.
10267 </para>
10268 </listitem>
10269 </varlistentry>
10271 <varlistentry id="guc-shared-preload-libraries" xreflabel="shared_preload_libraries">
10272 <term><varname>shared_preload_libraries</varname> (<type>string</type>)
10273 <indexterm>
10274 <primary><varname>shared_preload_libraries</varname> configuration parameter</primary>
10275 </indexterm>
10276 </term>
10277 <listitem>
10278 <para>
10279 This variable specifies one or more shared libraries to be preloaded at
10280 server start.
10281 It contains a comma-separated list of library names, where each name
10282 is interpreted as for the <link linkend="sql-load"><command>LOAD</command></link> command.
10283 Whitespace between entries is ignored; surround a library name with
10284 double quotes if you need to include whitespace or commas in the name.
10285 This parameter can only be set at server start. If a specified
10286 library is not found, the server will fail to start.
10287 </para>
10289 <para>
10290 Some libraries need to perform certain operations that can only take
10291 place at postmaster start, such as allocating shared memory, reserving
10292 light-weight locks, or starting background workers. Those libraries
10293 must be loaded at server start through this parameter. See the
10294 documentation of each library for details.
10295 </para>
10297 <para>
10298 Other libraries can also be preloaded. By preloading a shared library,
10299 the library startup time is avoided when the library is first used.
10300 However, the time to start each new server process might increase
10301 slightly, even if that process never uses the library. So this
10302 parameter is recommended only for libraries that will be used in most
10303 sessions. Also, changing this parameter requires a server restart, so
10304 this is not the right setting to use for short-term debugging tasks,
10305 say. Use <xref linkend="guc-session-preload-libraries"/> for that
10306 instead.
10307 </para>
10309 <note>
10310 <para>
10311 On Windows hosts, preloading a library at server start will not reduce
10312 the time required to start each new server process; each server process
10313 will re-load all preload libraries. However, <varname>shared_preload_libraries
10314 </varname> is still useful on Windows hosts for libraries that need to
10315 perform operations at postmaster start time.
10316 </para>
10317 </note>
10318 </listitem>
10319 </varlistentry>
10321 <varlistentry id="guc-jit-provider" xreflabel="jit_provider">
10322 <term><varname>jit_provider</varname> (<type>string</type>)
10323 <indexterm>
10324 <primary><varname>jit_provider</varname> configuration parameter</primary>
10325 </indexterm>
10326 </term>
10327 <listitem>
10328 <para>
10329 This variable is the name of the JIT provider library to be used
10330 (see <xref linkend="jit-pluggable"/>).
10331 The default is <literal>llvmjit</literal>.
10332 This parameter can only be set at server start.
10333 </para>
10335 <para>
10336 If set to a non-existent library, <acronym>JIT</acronym> will not be
10337 available, but no error will be raised. This allows JIT support to be
10338 installed separately from the main
10339 <productname>PostgreSQL</productname> package.
10340 </para>
10341 </listitem>
10342 </varlistentry>
10344 </variablelist>
10345 </sect2>
10347 <sect2 id="runtime-config-client-other">
10348 <title>Other Defaults</title>
10350 <variablelist>
10352 <varlistentry id="guc-dynamic-library-path" xreflabel="dynamic_library_path">
10353 <term><varname>dynamic_library_path</varname> (<type>string</type>)
10354 <indexterm>
10355 <primary><varname>dynamic_library_path</varname> configuration parameter</primary>
10356 </indexterm>
10357 <indexterm><primary>dynamic loading</primary></indexterm>
10358 </term>
10359 <listitem>
10360 <para>
10361 If a dynamically loadable module needs to be opened and the
10362 file name specified in the <command>CREATE FUNCTION</command> or
10363 <command>LOAD</command> command
10364 does not have a directory component (i.e., the
10365 name does not contain a slash), the system will search this
10366 path for the required file.
10367 </para>
10369 <para>
10370 The value for <varname>dynamic_library_path</varname> must be a
10371 list of absolute directory paths separated by colons (or semi-colons
10372 on Windows). If a list element starts
10373 with the special string <literal>$libdir</literal>, the
10374 compiled-in <productname>PostgreSQL</productname> package
10375 library directory is substituted for <literal>$libdir</literal>; this
10376 is where the modules provided by the standard
10377 <productname>PostgreSQL</productname> distribution are installed.
10378 (Use <literal>pg_config --pkglibdir</literal> to find out the name of
10379 this directory.) For example:
10380 <programlisting>
10381 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
10382 </programlisting>
10383 or, in a Windows environment:
10384 <programlisting>
10385 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
10386 </programlisting>
10387 </para>
10389 <para>
10390 The default value for this parameter is
10391 <literal>'$libdir'</literal>. If the value is set to an empty
10392 string, the automatic path search is turned off.
10393 </para>
10395 <para>
10396 This parameter can be changed at run time by superusers and users
10397 with the appropriate <literal>SET</literal> privilege, but a
10398 setting done that way will only persist until the end of the
10399 client connection, so this method should be reserved for
10400 development purposes. The recommended way to set this parameter
10401 is in the <filename>postgresql.conf</filename> configuration
10402 file.
10403 </para>
10404 </listitem>
10405 </varlistentry>
10407 <varlistentry id="guc-gin-fuzzy-search-limit" xreflabel="gin_fuzzy_search_limit">
10408 <term><varname>gin_fuzzy_search_limit</varname> (<type>integer</type>)
10409 <indexterm>
10410 <primary><varname>gin_fuzzy_search_limit</varname> configuration parameter</primary>
10411 </indexterm>
10412 </term>
10413 <listitem>
10414 <para>
10415 Soft upper limit of the size of the set returned by GIN index scans. For more
10416 information see <xref linkend="gin-tips"/>.
10417 </para>
10418 </listitem>
10419 </varlistentry>
10421 </variablelist>
10422 </sect2>
10423 </sect1>
10425 <sect1 id="runtime-config-locks">
10426 <title>Lock Management</title>
10428 <variablelist>
10430 <varlistentry id="guc-deadlock-timeout" xreflabel="deadlock_timeout">
10431 <term><varname>deadlock_timeout</varname> (<type>integer</type>)
10432 <indexterm>
10433 <primary>deadlock</primary>
10434 <secondary>timeout during</secondary>
10435 </indexterm>
10436 <indexterm>
10437 <primary>timeout</primary>
10438 <secondary>deadlock</secondary>
10439 </indexterm>
10440 <indexterm>
10441 <primary><varname>deadlock_timeout</varname> configuration parameter</primary>
10442 </indexterm>
10443 </term>
10444 <listitem>
10445 <para>
10446 This is the amount of time to wait on a lock
10447 before checking to see if there is a deadlock condition. The
10448 check for deadlock is relatively expensive, so the server doesn't run
10449 it every time it waits for a lock. We optimistically assume
10450 that deadlocks are not common in production applications and
10451 just wait on the lock for a while before checking for a
10452 deadlock. Increasing this value reduces the amount of time
10453 wasted in needless deadlock checks, but slows down reporting of
10454 real deadlock errors.
10455 If this value is specified without units, it is taken as milliseconds.
10456 The default is one second (<literal>1s</literal>),
10457 which is probably about the smallest value you would want in
10458 practice. On a heavily loaded server you might want to raise it.
10459 Ideally the setting should exceed your typical transaction time,
10460 so as to improve the odds that a lock will be released before
10461 the waiter decides to check for deadlock.
10462 Only superusers and users with the appropriate <literal>SET</literal>
10463 privilege can change this setting.
10464 </para>
10466 <para>
10467 When <xref linkend="guc-log-lock-waits"/> is set,
10468 this parameter also determines the amount of time to wait before
10469 a log message is issued about the lock wait. If you are trying
10470 to investigate locking delays you might want to set a shorter than
10471 normal <varname>deadlock_timeout</varname>.
10472 </para>
10473 </listitem>
10474 </varlistentry>
10476 <varlistentry id="guc-max-locks-per-transaction" xreflabel="max_locks_per_transaction">
10477 <term><varname>max_locks_per_transaction</varname> (<type>integer</type>)
10478 <indexterm>
10479 <primary><varname>max_locks_per_transaction</varname> configuration parameter</primary>
10480 </indexterm>
10481 </term>
10482 <listitem>
10483 <para>
10484 The shared lock table has space for
10485 <varname>max_locks_per_transaction</varname> objects
10486 (e.g., tables) per server process or prepared transaction;
10487 hence, no more than this many distinct objects can be locked at
10488 any one time. This parameter limits the average number of object
10489 locks used by each transaction; individual transactions
10490 can lock more objects as long as the locks of all transactions
10491 fit in the lock table. This is <emphasis>not</emphasis> the number of
10492 rows that can be locked; that value is unlimited. The default,
10493 64, has historically proven sufficient, but you might need to
10494 raise this value if you have queries that touch many different
10495 tables in a single transaction, e.g., query of a parent table with
10496 many children. This parameter can only be set at server start.
10497 </para>
10499 <para>
10500 When running a standby server, you must set this parameter to have the
10501 same or higher value as on the primary server. Otherwise, queries
10502 will not be allowed in the standby server.
10503 </para>
10504 </listitem>
10505 </varlistentry>
10507 <varlistentry id="guc-max-pred-locks-per-transaction" xreflabel="max_pred_locks_per_transaction">
10508 <term><varname>max_pred_locks_per_transaction</varname> (<type>integer</type>)
10509 <indexterm>
10510 <primary><varname>max_pred_locks_per_transaction</varname> configuration parameter</primary>
10511 </indexterm>
10512 </term>
10513 <listitem>
10514 <para>
10515 The shared predicate lock table has space for
10516 <varname>max_pred_locks_per_transaction</varname> objects
10517 (e.g., tables) per server process or prepared transaction;
10518 hence, no more than this many distinct objects can be locked at
10519 any one time. This parameter limits the average number of object
10520 locks used by each transaction; individual transactions
10521 can lock more objects as long as the locks of all transactions
10522 fit in the lock table. This is <emphasis>not</emphasis> the number of
10523 rows that can be locked; that value is unlimited. The default,
10524 64, has historically proven sufficient, but you might need to
10525 raise this value if you have clients that touch many different
10526 tables in a single serializable transaction. This parameter can
10527 only be set at server start.
10528 </para>
10529 </listitem>
10530 </varlistentry>
10532 <varlistentry id="guc-max-pred-locks-per-relation" xreflabel="max_pred_locks_per_relation">
10533 <term><varname>max_pred_locks_per_relation</varname> (<type>integer</type>)
10534 <indexterm>
10535 <primary><varname>max_pred_locks_per_relation</varname> configuration parameter</primary>
10536 </indexterm>
10537 </term>
10538 <listitem>
10539 <para>
10540 This controls how many pages or tuples of a single relation can be
10541 predicate-locked before the lock is promoted to covering the whole
10542 relation. Values greater than or equal to zero mean an absolute
10543 limit, while negative values
10544 mean <xref linkend="guc-max-pred-locks-per-transaction"/> divided by
10545 the absolute value of this setting. The default is -2, which keeps
10546 the behavior from previous versions of <productname>PostgreSQL</productname>.
10547 This parameter can only be set in the <filename>postgresql.conf</filename>
10548 file or on the server command line.
10549 </para>
10550 </listitem>
10551 </varlistentry>
10553 <varlistentry id="guc-max-pred-locks-per-page" xreflabel="max_pred_locks_per_page">
10554 <term><varname>max_pred_locks_per_page</varname> (<type>integer</type>)
10555 <indexterm>
10556 <primary><varname>max_pred_locks_per_page</varname> configuration parameter</primary>
10557 </indexterm>
10558 </term>
10559 <listitem>
10560 <para>
10561 This controls how many rows on a single page can be predicate-locked
10562 before the lock is promoted to covering the whole page. The default
10563 is 2. This parameter can only be set in
10564 the <filename>postgresql.conf</filename> file or on the server command line.
10565 </para>
10566 </listitem>
10567 </varlistentry>
10569 </variablelist>
10570 </sect1>
10572 <sect1 id="runtime-config-compatible">
10573 <title>Version and Platform Compatibility</title>
10575 <sect2 id="runtime-config-compatible-version">
10576 <title>Previous PostgreSQL Versions</title>
10578 <variablelist>
10580 <varlistentry id="guc-array-nulls" xreflabel="array_nulls">
10581 <term><varname>array_nulls</varname> (<type>boolean</type>)
10582 <indexterm>
10583 <primary><varname>array_nulls</varname> configuration parameter</primary>
10584 </indexterm>
10585 </term>
10586 <listitem>
10587 <para>
10588 This controls whether the array input parser recognizes
10589 unquoted <literal>NULL</literal> as specifying a null array element.
10590 By default, this is <literal>on</literal>, allowing array values containing
10591 null values to be entered. However, <productname>PostgreSQL</productname> versions
10592 before 8.2 did not support null values in arrays, and therefore would
10593 treat <literal>NULL</literal> as specifying a normal array element with
10594 the string value <quote>NULL</quote>. For backward compatibility with
10595 applications that require the old behavior, this variable can be
10596 turned <literal>off</literal>.
10597 </para>
10599 <para>
10600 Note that it is possible to create array values containing null values
10601 even when this variable is <literal>off</literal>.
10602 </para>
10603 </listitem>
10604 </varlistentry>
10606 <varlistentry id="guc-backslash-quote" xreflabel="backslash_quote">
10607 <term><varname>backslash_quote</varname> (<type>enum</type>)
10608 <indexterm><primary>strings</primary><secondary>backslash quotes</secondary></indexterm>
10609 <indexterm>
10610 <primary><varname>backslash_quote</varname> configuration parameter</primary>
10611 </indexterm>
10612 </term>
10613 <listitem>
10614 <para>
10615 This controls whether a quote mark can be represented by
10616 <literal>\'</literal> in a string literal. The preferred, SQL-standard way
10617 to represent a quote mark is by doubling it (<literal>''</literal>) but
10618 <productname>PostgreSQL</productname> has historically also accepted
10619 <literal>\'</literal>. However, use of <literal>\'</literal> creates security risks
10620 because in some client character set encodings, there are multibyte
10621 characters in which the last byte is numerically equivalent to ASCII
10622 <literal>\</literal>. If client-side code does escaping incorrectly then an
10623 SQL-injection attack is possible. This risk can be prevented by
10624 making the server reject queries in which a quote mark appears to be
10625 escaped by a backslash.
10626 The allowed values of <varname>backslash_quote</varname> are
10627 <literal>on</literal> (allow <literal>\'</literal> always),
10628 <literal>off</literal> (reject always), and
10629 <literal>safe_encoding</literal> (allow only if client encoding does not
10630 allow ASCII <literal>\</literal> within a multibyte character).
10631 <literal>safe_encoding</literal> is the default setting.
10632 </para>
10634 <para>
10635 Note that in a standard-conforming string literal, <literal>\</literal> just
10636 means <literal>\</literal> anyway. This parameter only affects the handling of
10637 non-standard-conforming literals, including
10638 escape string syntax (<literal>E'...'</literal>).
10639 </para>
10640 </listitem>
10641 </varlistentry>
10643 <varlistentry id="guc-escape-string-warning" xreflabel="escape_string_warning">
10644 <term><varname>escape_string_warning</varname> (<type>boolean</type>)
10645 <indexterm><primary>strings</primary><secondary>escape warning</secondary></indexterm>
10646 <indexterm>
10647 <primary><varname>escape_string_warning</varname> configuration parameter</primary>
10648 </indexterm>
10649 </term>
10650 <listitem>
10651 <para>
10652 When on, a warning is issued if a backslash (<literal>\</literal>)
10653 appears in an ordinary string literal (<literal>'...'</literal>
10654 syntax) and <varname>standard_conforming_strings</varname> is off.
10655 The default is <literal>on</literal>.
10656 </para>
10657 <para>
10658 Applications that wish to use backslash as escape should be
10659 modified to use escape string syntax (<literal>E'...'</literal>),
10660 because the default behavior of ordinary strings is now to treat
10661 backslash as an ordinary character, per SQL standard. This variable
10662 can be enabled to help locate code that needs to be changed.
10663 </para>
10664 </listitem>
10665 </varlistentry>
10667 <varlistentry id="guc-lo-compat-privileges" xreflabel="lo_compat_privileges">
10668 <term><varname>lo_compat_privileges</varname> (<type>boolean</type>)
10669 <indexterm>
10670 <primary><varname>lo_compat_privileges</varname> configuration parameter</primary>
10671 </indexterm>
10672 </term>
10673 <listitem>
10674 <para>
10675 In <productname>PostgreSQL</productname> releases prior to 9.0, large objects
10676 did not have access privileges and were, therefore, always readable
10677 and writable by all users. Setting this variable to <literal>on</literal>
10678 disables the new privilege checks, for compatibility with prior
10679 releases. The default is <literal>off</literal>.
10680 Only superusers and users with the appropriate <literal>SET</literal>
10681 privilege can change this setting.
10682 </para>
10683 <para>
10684 Setting this variable does not disable all security checks related to
10685 large objects &mdash; only those for which the default behavior has
10686 changed in <productname>PostgreSQL</productname> 9.0.
10687 </para>
10688 </listitem>
10689 </varlistentry>
10691 <varlistentry id="guc-quote-all-identifiers" xreflabel="quote-all-identifiers">
10692 <term><varname>quote_all_identifiers</varname> (<type>boolean</type>)
10693 <indexterm>
10694 <primary><varname>quote_all_identifiers</varname> configuration parameter</primary>
10695 </indexterm>
10696 </term>
10697 <listitem>
10698 <para>
10699 When the database generates SQL, force all identifiers to be quoted,
10700 even if they are not (currently) keywords. This will affect the
10701 output of <command>EXPLAIN</command> as well as the results of functions
10702 like <function>pg_get_viewdef</function>. See also the
10703 <option>--quote-all-identifiers</option> option of
10704 <xref linkend="app-pgdump"/> and <xref linkend="app-pg-dumpall"/>.
10705 </para>
10706 </listitem>
10707 </varlistentry>
10709 <varlistentry id="guc-standard-conforming-strings" xreflabel="standard_conforming_strings">
10710 <term><varname>standard_conforming_strings</varname> (<type>boolean</type>)
10711 <indexterm><primary>strings</primary><secondary>standard conforming</secondary></indexterm>
10712 <indexterm>
10713 <primary><varname>standard_conforming_strings</varname> configuration parameter</primary>
10714 </indexterm>
10715 </term>
10716 <listitem>
10717 <para>
10718 This controls whether ordinary string literals
10719 (<literal>'...'</literal>) treat backslashes literally, as specified in
10720 the SQL standard.
10721 Beginning in <productname>PostgreSQL</productname> 9.1, the default is
10722 <literal>on</literal> (prior releases defaulted to <literal>off</literal>).
10723 Applications can check this
10724 parameter to determine how string literals will be processed.
10725 The presence of this parameter can also be taken as an indication
10726 that the escape string syntax (<literal>E'...'</literal>) is supported.
10727 Escape string syntax (<xref linkend="sql-syntax-strings-escape"/>)
10728 should be used if an application desires
10729 backslashes to be treated as escape characters.
10730 </para>
10731 </listitem>
10732 </varlistentry>
10734 <varlistentry id="guc-synchronize-seqscans" xreflabel="synchronize_seqscans">
10735 <term><varname>synchronize_seqscans</varname> (<type>boolean</type>)
10736 <indexterm>
10737 <primary><varname>synchronize_seqscans</varname> configuration parameter</primary>
10738 </indexterm>
10739 </term>
10740 <listitem>
10741 <para>
10742 This allows sequential scans of large tables to synchronize with each
10743 other, so that concurrent scans read the same block at about the
10744 same time and hence share the I/O workload. When this is enabled,
10745 a scan might start in the middle of the table and then <quote>wrap
10746 around</quote> the end to cover all rows, so as to synchronize with the
10747 activity of scans already in progress. This can result in
10748 unpredictable changes in the row ordering returned by queries that
10749 have no <literal>ORDER BY</literal> clause. Setting this parameter to
10750 <literal>off</literal> ensures the pre-8.3 behavior in which a sequential
10751 scan always starts from the beginning of the table. The default
10752 is <literal>on</literal>.
10753 </para>
10754 </listitem>
10755 </varlistentry>
10757 </variablelist>
10758 </sect2>
10760 <sect2 id="runtime-config-compatible-clients">
10761 <title>Platform and Client Compatibility</title>
10762 <variablelist>
10764 <varlistentry id="guc-transform-null-equals" xreflabel="transform_null_equals">
10765 <term><varname>transform_null_equals</varname> (<type>boolean</type>)
10766 <indexterm><primary>IS NULL</primary></indexterm>
10767 <indexterm>
10768 <primary><varname>transform_null_equals</varname> configuration parameter</primary>
10769 </indexterm>
10770 </term>
10771 <listitem>
10772 <para>
10773 When on, expressions of the form <literal><replaceable>expr</replaceable> =
10774 NULL</literal> (or <literal>NULL =
10775 <replaceable>expr</replaceable></literal>) are treated as
10776 <literal><replaceable>expr</replaceable> IS NULL</literal>, that is, they
10777 return true if <replaceable>expr</replaceable> evaluates to the null value,
10778 and false otherwise. The correct SQL-spec-compliant behavior of
10779 <literal><replaceable>expr</replaceable> = NULL</literal> is to always
10780 return null (unknown). Therefore this parameter defaults to
10781 <literal>off</literal>.
10782 </para>
10784 <para>
10785 However, filtered forms in <productname>Microsoft
10786 Access</productname> generate queries that appear to use
10787 <literal><replaceable>expr</replaceable> = NULL</literal> to test for
10788 null values, so if you use that interface to access the database you
10789 might want to turn this option on. Since expressions of the
10790 form <literal><replaceable>expr</replaceable> = NULL</literal> always
10791 return the null value (using the SQL standard interpretation), they are not
10792 very useful and do not appear often in normal applications so
10793 this option does little harm in practice. But new users are
10794 frequently confused about the semantics of expressions
10795 involving null values, so this option is off by default.
10796 </para>
10798 <para>
10799 Note that this option only affects the exact form <literal>= NULL</literal>,
10800 not other comparison operators or other expressions
10801 that are computationally equivalent to some expression
10802 involving the equals operator (such as <literal>IN</literal>).
10803 Thus, this option is not a general fix for bad programming.
10804 </para>
10806 <para>
10807 Refer to <xref linkend="functions-comparison"/> for related information.
10808 </para>
10809 </listitem>
10810 </varlistentry>
10812 <varlistentry id="guc-allow-alter-system" xreflabel="allow_alter_system">
10813 <term><varname>allow_alter_system</varname> (<type>boolean</type>)
10814 <indexterm>
10815 <primary><varname>allow_alter_system</varname> configuration parameter</primary>
10816 </indexterm>
10817 </term>
10818 <listitem>
10819 <para>
10820 When <literal>allow_alter_system</literal> is set to
10821 <literal>off</literal>, an error is returned if the <command>ALTER
10822 SYSTEM</command> command is executed. This parameter can only be set in
10823 the <filename>postgresql.conf</filename> file or on the server command
10824 line. The default value is <literal>on</literal>.
10825 </para>
10827 <para>
10828 Note that this setting must not be regarded as a security feature. It
10829 only disables the <literal>ALTER SYSTEM</literal> command. It does not
10830 prevent a superuser from changing the configuration using other SQL
10831 commands. A superuser has many ways of executing shell commands at
10832 the operating system level, and can therefore modify
10833 <literal>postgresql.auto.conf</literal> regardless of the value of
10834 this setting.
10835 </para>
10837 <para>
10838 Turning this setting off is intended for environments where the
10839 configuration of <productname>PostgreSQL</productname> is managed by
10840 some external tool.
10841 In such environments, a well intentioned superuser might
10842 <emphasis>mistakenly</emphasis> use <command>ALTER SYSTEM</command>
10843 to change the configuration instead of using the external tool.
10844 This might result in unintended behavior, such as the external tool
10845 overwriting the change at some later point in time when it updates the
10846 configuration.
10847 Setting this parameter to <literal>off</literal> can
10848 help avoid such mistakes.
10849 </para>
10851 <para>
10852 This parameter only controls the use of <command>ALTER SYSTEM</command>.
10853 The settings stored in <filename>postgresql.auto.conf</filename>
10854 take effect even if <literal>allow_alter_system</literal> is set to
10855 <literal>off</literal>.
10856 </para>
10857 </listitem>
10858 </varlistentry>
10860 </variablelist>
10861 </sect2>
10862 </sect1>
10864 <sect1 id="runtime-config-error-handling">
10865 <title>Error Handling</title>
10867 <variablelist>
10869 <varlistentry id="guc-exit-on-error" xreflabel="exit_on_error">
10870 <term><varname>exit_on_error</varname> (<type>boolean</type>)
10871 <indexterm>
10872 <primary><varname>exit_on_error</varname> configuration parameter</primary>
10873 </indexterm>
10874 </term>
10875 <listitem>
10876 <para>
10877 If on, any error will terminate the current session. By default,
10878 this is set to off, so that only FATAL errors will terminate the
10879 session.
10880 </para>
10881 </listitem>
10882 </varlistentry>
10884 <varlistentry id="guc-restart-after-crash" xreflabel="restart_after_crash">
10885 <term><varname>restart_after_crash</varname> (<type>boolean</type>)
10886 <indexterm>
10887 <primary><varname>restart_after_crash</varname> configuration parameter</primary>
10888 </indexterm>
10889 </term>
10890 <listitem>
10891 <para>
10892 When set to on, which is the default, <productname>PostgreSQL</productname>
10893 will automatically reinitialize after a backend crash. Leaving this
10894 value set to on is normally the best way to maximize the availability
10895 of the database. However, in some circumstances, such as when
10896 <productname>PostgreSQL</productname> is being invoked by clusterware, it may be
10897 useful to disable the restart so that the clusterware can gain
10898 control and take any actions it deems appropriate.
10899 </para>
10901 <para>
10902 This parameter can only be set in the <filename>postgresql.conf</filename>
10903 file or on the server command line.
10904 </para>
10905 </listitem>
10906 </varlistentry>
10908 <varlistentry id="guc-data-sync-retry" xreflabel="data_sync_retry">
10909 <term><varname>data_sync_retry</varname> (<type>boolean</type>)
10910 <indexterm>
10911 <primary><varname>data_sync_retry</varname> configuration parameter</primary>
10912 </indexterm>
10913 </term>
10914 <listitem>
10915 <para>
10916 When set to off, which is the default, <productname>PostgreSQL</productname>
10917 will raise a PANIC-level error on failure to flush modified data files
10918 to the file system. This causes the database server to crash. This
10919 parameter can only be set at server start.
10920 </para>
10921 <para>
10922 On some operating systems, the status of data in the kernel's page
10923 cache is unknown after a write-back failure. In some cases it might
10924 have been entirely forgotten, making it unsafe to retry; the second
10925 attempt may be reported as successful, when in fact the data has been
10926 lost. In these circumstances, the only way to avoid data loss is to
10927 recover from the WAL after any failure is reported, preferably
10928 after investigating the root cause of the failure and replacing any
10929 faulty hardware.
10930 </para>
10931 <para>
10932 If set to on, <productname>PostgreSQL</productname> will instead
10933 report an error but continue to run so that the data flushing
10934 operation can be retried in a later checkpoint. Only set it to on
10935 after investigating the operating system's treatment of buffered data
10936 in case of write-back failure.
10937 </para>
10938 </listitem>
10939 </varlistentry>
10941 <varlistentry id="guc-recovery-init-sync-method" xreflabel="recovery_init_sync_method">
10942 <term><varname>recovery_init_sync_method</varname> (<type>enum</type>)
10943 <indexterm>
10944 <primary><varname>recovery_init_sync_method</varname> configuration parameter</primary>
10945 </indexterm>
10946 </term>
10947 <listitem>
10948 <para>
10949 When set to <literal>fsync</literal>, which is the default,
10950 <productname>PostgreSQL</productname> will recursively open and
10951 synchronize all files in the data directory before crash recovery
10952 begins. The search for files will follow symbolic links for the WAL
10953 directory and each configured tablespace (but not any other symbolic
10954 links). This is intended to make sure that all WAL and data files are
10955 durably stored on disk before replaying changes. This applies whenever
10956 starting a database cluster that did not shut down cleanly, including
10957 copies created with <application>pg_basebackup</application>.
10958 </para>
10959 <para>
10960 On Linux, <literal>syncfs</literal> may be used instead, to ask the
10961 operating system to synchronize the file systems that contain the
10962 data directory, the WAL files and each tablespace (but not any other
10963 file systems that may be reachable through symbolic links). This may
10964 be a lot faster than the <literal>fsync</literal> setting, because it
10965 doesn't need to open each file one by one. On the other hand, it may
10966 be slower if a file system is shared by other applications that
10967 modify a lot of files, since those files will also be written to disk.
10968 Furthermore, on versions of Linux before 5.8, I/O errors encountered
10969 while writing data to disk may not be reported to
10970 <productname>PostgreSQL</productname>, and relevant error messages may
10971 appear only in kernel logs.
10972 </para>
10973 <para>
10974 This parameter can only be set in the
10975 <filename>postgresql.conf</filename> file or on the server command line.
10976 </para>
10977 </listitem>
10978 </varlistentry>
10980 </variablelist>
10982 </sect1>
10984 <sect1 id="runtime-config-preset">
10985 <title>Preset Options</title>
10987 <para>
10988 The following <quote>parameters</quote> are read-only.
10989 As such, they have been excluded from the sample
10990 <filename>postgresql.conf</filename> file. These options report
10991 various aspects of <productname>PostgreSQL</productname> behavior
10992 that might be of interest to certain applications, particularly
10993 administrative front-ends.
10994 Most of them are determined when <productname>PostgreSQL</productname>
10995 is compiled or when it is installed.
10996 </para>
10998 <variablelist>
11000 <varlistentry id="guc-block-size" xreflabel="block_size">
11001 <term><varname>block_size</varname> (<type>integer</type>)
11002 <indexterm>
11003 <primary><varname>block_size</varname> configuration parameter</primary>
11004 </indexterm>
11005 </term>
11006 <listitem>
11007 <para>
11008 Reports the size of a disk block. It is determined by the value
11009 of <literal>BLCKSZ</literal> when building the server. The default
11010 value is 8192 bytes. The meaning of some configuration
11011 variables (such as <xref linkend="guc-shared-buffers"/>) is
11012 influenced by <varname>block_size</varname>. See <xref
11013 linkend="runtime-config-resource"/> for information.
11014 </para>
11015 </listitem>
11016 </varlistentry>
11018 <varlistentry id="guc-data-checksums" xreflabel="data_checksums">
11019 <term><varname>data_checksums</varname> (<type>boolean</type>)
11020 <indexterm>
11021 <primary><varname>data_checksums</varname> configuration parameter</primary>
11022 </indexterm>
11023 </term>
11024 <listitem>
11025 <para>
11026 Reports whether data checksums are enabled for this cluster.
11027 See <xref linkend="app-initdb-data-checksums"/> for more information.
11028 </para>
11029 </listitem>
11030 </varlistentry>
11032 <varlistentry id="guc-data-directory-mode" xreflabel="data_directory_mode">
11033 <term><varname>data_directory_mode</varname> (<type>integer</type>)
11034 <indexterm>
11035 <primary><varname>data_directory_mode</varname> configuration parameter</primary>
11036 </indexterm>
11037 </term>
11038 <listitem>
11039 <para>
11040 On Unix systems this parameter reports the permissions the data
11041 directory (defined by <xref linkend="guc-data-directory"/>)
11042 had at server startup.
11043 (On Microsoft Windows this parameter will always display
11044 <literal>0700</literal>.) See
11045 <xref linkend="app-initdb-allow-group-access"/> for more information.
11046 </para>
11047 </listitem>
11048 </varlistentry>
11050 <varlistentry id="guc-debug-assertions" xreflabel="debug_assertions">
11051 <term><varname>debug_assertions</varname> (<type>boolean</type>)
11052 <indexterm>
11053 <primary><varname>debug_assertions</varname> configuration parameter</primary>
11054 </indexterm>
11055 </term>
11056 <listitem>
11057 <para>
11058 Reports whether <productname>PostgreSQL</productname> has been built
11059 with assertions enabled. That is the case if the
11060 macro <symbol>USE_ASSERT_CHECKING</symbol> is defined
11061 when <productname>PostgreSQL</productname> is built (accomplished
11062 e.g., by the <command>configure</command> option
11063 <option>--enable-cassert</option>). By
11064 default <productname>PostgreSQL</productname> is built without
11065 assertions.
11066 </para>
11067 </listitem>
11068 </varlistentry>
11070 <varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status">
11071 <term><varname>huge_pages_status</varname> (<type>enum</type>)
11072 <indexterm>
11073 <primary><varname>huge_pages_status</varname> configuration parameter</primary>
11074 </indexterm>
11075 </term>
11076 <listitem>
11077 <para>
11078 Reports the state of huge pages in the current instance:
11079 <literal>on</literal>, <literal>off</literal>, or
11080 <literal>unknown</literal> (if displayed with
11081 <literal>postgres -C</literal>).
11082 This parameter is useful to determine whether allocation of huge pages
11083 was successful under <literal>huge_pages=try</literal>.
11084 See <xref linkend="guc-huge-pages"/> for more information.
11085 </para>
11086 </listitem>
11087 </varlistentry>
11089 <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes">
11090 <term><varname>integer_datetimes</varname> (<type>boolean</type>)
11091 <indexterm>
11092 <primary><varname>integer_datetimes</varname> configuration parameter</primary>
11093 </indexterm>
11094 </term>
11095 <listitem>
11096 <para>
11097 Reports whether <productname>PostgreSQL</productname> was built with support for
11098 64-bit-integer dates and times. As of <productname>PostgreSQL</productname> 10,
11099 this is always <literal>on</literal>.
11100 </para>
11101 </listitem>
11102 </varlistentry>
11104 <varlistentry id="guc-in-hot-standby" xreflabel="in_hot_standby">
11105 <term><varname>in_hot_standby</varname> (<type>boolean</type>)
11106 <indexterm>
11107 <primary><varname>in_hot_standby</varname> configuration parameter</primary>
11108 </indexterm>
11109 </term>
11110 <listitem>
11111 <para>
11112 Reports whether the server is currently in hot standby mode. When
11113 this is <literal>on</literal>, all transactions are forced to be
11114 read-only. Within a session, this can change only if the server is
11115 promoted to be primary. See <xref linkend="hot-standby"/> for more
11116 information.
11117 </para>
11118 </listitem>
11119 </varlistentry>
11121 <varlistentry id="guc-max-function-args" xreflabel="max_function_args">
11122 <term><varname>max_function_args</varname> (<type>integer</type>)
11123 <indexterm>
11124 <primary><varname>max_function_args</varname> configuration parameter</primary>
11125 </indexterm>
11126 </term>
11127 <listitem>
11128 <para>
11129 Reports the maximum number of function arguments. It is determined by
11130 the value of <literal>FUNC_MAX_ARGS</literal> when building the server. The
11131 default value is 100 arguments.
11132 </para>
11133 </listitem>
11134 </varlistentry>
11136 <varlistentry id="guc-max-identifier-length" xreflabel="max_identifier_length">
11137 <term><varname>max_identifier_length</varname> (<type>integer</type>)
11138 <indexterm>
11139 <primary><varname>max_identifier_length</varname> configuration parameter</primary>
11140 </indexterm>
11141 </term>
11142 <listitem>
11143 <para>
11144 Reports the maximum identifier length. It is determined as one
11145 less than the value of <literal>NAMEDATALEN</literal> when building
11146 the server. The default value of <literal>NAMEDATALEN</literal> is
11147 64; therefore the default
11148 <varname>max_identifier_length</varname> is 63 bytes, which
11149 can be less than 63 characters when using multibyte encodings.
11150 </para>
11151 </listitem>
11152 </varlistentry>
11154 <varlistentry id="guc-max-index-keys" xreflabel="max_index_keys">
11155 <term><varname>max_index_keys</varname> (<type>integer</type>)
11156 <indexterm>
11157 <primary><varname>max_index_keys</varname> configuration parameter</primary>
11158 </indexterm>
11159 </term>
11160 <listitem>
11161 <para>
11162 Reports the maximum number of index keys. It is determined by
11163 the value of <literal>INDEX_MAX_KEYS</literal> when building the server. The
11164 default value is 32 keys.
11165 </para>
11166 </listitem>
11167 </varlistentry>
11169 <varlistentry id="guc-num-os-semaphores" xreflabel="num_os_semaphores">
11170 <term><varname>num_os_semaphores</varname> (<type>integer</type>)
11171 <indexterm>
11172 <primary><varname>num_os_semaphores</varname> configuration parameter</primary>
11173 </indexterm>
11174 </term>
11175 <listitem>
11176 <para>
11177 Reports the number of semaphores that are needed for the server based
11178 on the configured number of allowed connections
11179 (<xref linkend="guc-max-connections"/>), allowed autovacuum worker
11180 processes (<xref linkend="guc-autovacuum-max-workers"/>), allowed WAL
11181 sender processes (<xref linkend="guc-max-wal-senders"/>), allowed
11182 background processes (<xref linkend="guc-max-worker-processes"/>), etc.
11183 </para>
11184 </listitem>
11185 </varlistentry>
11187 <varlistentry id="guc-segment-size" xreflabel="segment_size">
11188 <term><varname>segment_size</varname> (<type>integer</type>)
11189 <indexterm>
11190 <primary><varname>segment_size</varname> configuration parameter</primary>
11191 </indexterm>
11192 </term>
11193 <listitem>
11194 <para>
11195 Reports the number of blocks (pages) that can be stored within a file
11196 segment. It is determined by the value of <literal>RELSEG_SIZE</literal>
11197 when building the server. The maximum size of a segment file in bytes
11198 is equal to <varname>segment_size</varname> multiplied by
11199 <varname>block_size</varname>; by default this is 1GB.
11200 </para>
11201 </listitem>
11202 </varlistentry>
11204 <varlistentry id="guc-server-encoding" xreflabel="server_encoding">
11205 <term><varname>server_encoding</varname> (<type>string</type>)
11206 <indexterm>
11207 <primary><varname>server_encoding</varname> configuration parameter</primary>
11208 </indexterm>
11209 <indexterm><primary>character set</primary></indexterm>
11210 </term>
11211 <listitem>
11212 <para>
11213 Reports the database encoding (character set).
11214 It is determined when the database is created. Ordinarily,
11215 clients need only be concerned with the value of <xref
11216 linkend="guc-client-encoding"/>.
11217 </para>
11218 </listitem>
11219 </varlistentry>
11221 <varlistentry id="guc-server-version" xreflabel="server_version">
11222 <term><varname>server_version</varname> (<type>string</type>)
11223 <indexterm>
11224 <primary><varname>server_version</varname> configuration parameter</primary>
11225 </indexterm>
11226 </term>
11227 <listitem>
11228 <para>
11229 Reports the version number of the server. It is determined by the
11230 value of <literal>PG_VERSION</literal> when building the server.
11231 </para>
11232 </listitem>
11233 </varlistentry>
11235 <varlistentry id="guc-server-version-num" xreflabel="server_version_num">
11236 <term><varname>server_version_num</varname> (<type>integer</type>)
11237 <indexterm>
11238 <primary><varname>server_version_num</varname> configuration parameter</primary>
11239 </indexterm>
11240 </term>
11241 <listitem>
11242 <para>
11243 Reports the version number of the server as an integer. It is determined
11244 by the value of <literal>PG_VERSION_NUM</literal> when building the server.
11245 </para>
11246 </listitem>
11247 </varlistentry>
11249 <varlistentry id="guc-shared-memory-size" xreflabel="shared_memory_size">
11250 <term><varname>shared_memory_size</varname> (<type>integer</type>)
11251 <indexterm>
11252 <primary><varname>shared_memory_size</varname> configuration parameter</primary>
11253 </indexterm>
11254 </term>
11255 <listitem>
11256 <para>
11257 Reports the size of the main shared memory area, rounded up to the
11258 nearest megabyte.
11259 </para>
11260 </listitem>
11261 </varlistentry>
11263 <varlistentry id="guc-shared-memory-size-in-huge-pages" xreflabel="shared_memory_size_in_huge_pages">
11264 <term><varname>shared_memory_size_in_huge_pages</varname> (<type>integer</type>)
11265 <indexterm>
11266 <primary><varname>shared_memory_size_in_huge_pages</varname> configuration parameter</primary>
11267 </indexterm>
11268 </term>
11269 <listitem>
11270 <para>
11271 Reports the number of huge pages that are needed for the main shared
11272 memory area based on the specified <xref linkend="guc-huge-page-size"/>.
11273 If huge pages are not supported, this will be <literal>-1</literal>.
11274 </para>
11275 <para>
11276 This setting is supported only on <productname>Linux</productname>. It
11277 is always set to <literal>-1</literal> on other platforms. For more
11278 details about using huge pages on <productname>Linux</productname>, see
11279 <xref linkend="linux-huge-pages"/>.
11280 </para>
11281 </listitem>
11282 </varlistentry>
11284 <varlistentry id="guc-ssl-library" xreflabel="ssl_library">
11285 <term><varname>ssl_library</varname> (<type>string</type>)
11286 <indexterm>
11287 <primary><varname>ssl_library</varname> configuration parameter</primary>
11288 </indexterm>
11289 </term>
11290 <listitem>
11291 <para>
11292 Reports the name of the SSL library that this
11293 <productname>PostgreSQL</productname> server was built with (even if
11294 SSL is not currently configured or in use on this instance), for
11295 example <literal>OpenSSL</literal>, or an empty string if none.
11296 </para>
11297 </listitem>
11298 </varlistentry>
11300 <varlistentry id="guc-wal-block-size" xreflabel="wal_block_size">
11301 <term><varname>wal_block_size</varname> (<type>integer</type>)
11302 <indexterm>
11303 <primary><varname>wal_block_size</varname> configuration parameter</primary>
11304 </indexterm>
11305 </term>
11306 <listitem>
11307 <para>
11308 Reports the size of a WAL disk block. It is determined by the value
11309 of <literal>XLOG_BLCKSZ</literal> when building the server. The default value
11310 is 8192 bytes.
11311 </para>
11312 </listitem>
11313 </varlistentry>
11315 <varlistentry id="guc-wal-segment-size" xreflabel="wal_segment_size">
11316 <term><varname>wal_segment_size</varname> (<type>integer</type>)
11317 <indexterm>
11318 <primary><varname>wal_segment_size</varname> configuration parameter</primary>
11319 </indexterm>
11320 </term>
11321 <listitem>
11322 <para>
11323 Reports the size of write ahead log segments. The default value is
11324 16MB. See <xref linkend="wal-configuration"/> for more information.
11325 </para>
11326 </listitem>
11327 </varlistentry>
11329 </variablelist>
11330 </sect1>
11332 <sect1 id="runtime-config-custom">
11333 <title>Customized Options</title>
11335 <para>
11336 This feature was designed to allow parameters not normally known to
11337 <productname>PostgreSQL</productname> to be added by add-on modules
11338 (such as procedural languages). This allows extension modules to be
11339 configured in the standard ways.
11340 </para>
11342 <para>
11343 Custom options have two-part names: an extension name, then a dot, then
11344 the parameter name proper, much like qualified names in SQL. An example
11345 is <literal>plpgsql.variable_conflict</literal>.
11346 </para>
11348 <para>
11349 Because custom options may need to be set in processes that have not
11350 loaded the relevant extension module, <productname>PostgreSQL</productname>
11351 will accept a setting for any two-part parameter name. Such variables
11352 are treated as placeholders and have no function until the module that
11353 defines them is loaded. When an extension module is loaded, it will add
11354 its variable definitions and convert any placeholder values according to
11355 those definitions. If there are any unrecognized placeholders
11356 that begin with its extension name, warnings are issued and those
11357 placeholders are removed.
11358 </para>
11359 </sect1>
11361 <sect1 id="runtime-config-developer">
11362 <title>Developer Options</title>
11364 <para>
11365 The following parameters are intended for developer testing, and
11366 should never be used on a production database. However, some of
11367 them can be used to assist with the recovery of severely damaged
11368 databases. As such, they have been excluded from the sample
11369 <filename>postgresql.conf</filename> file. Note that many of these
11370 parameters require special source compilation flags to work at all.
11371 </para>
11373 <variablelist>
11374 <varlistentry id="guc-allow-in-place-tablespaces" xreflabel="allow_in_place_tablespaces">
11375 <term><varname>allow_in_place_tablespaces</varname> (<type>boolean</type>)
11376 <indexterm>
11377 <primary><varname>allow_in_place_tablespaces</varname> configuration parameter</primary>
11378 </indexterm>
11379 </term>
11380 <listitem>
11381 <para>
11382 Allows tablespaces to be created as directories inside
11383 <filename>pg_tblspc</filename>, when an empty location string
11384 is provided to the <command>CREATE TABLESPACE</command> command. This
11385 is intended to allow testing replication scenarios where primary and
11386 standby servers are running on the same machine. Such directories
11387 are likely to confuse backup tools that expect to find only symbolic
11388 links in that location.
11389 Only superusers and users with the appropriate <literal>SET</literal>
11390 privilege can change this setting.
11391 </para>
11392 </listitem>
11393 </varlistentry>
11395 <varlistentry id="guc-allow-system-table-mods" xreflabel="allow_system_table_mods">
11396 <term><varname>allow_system_table_mods</varname> (<type>boolean</type>)
11397 <indexterm>
11398 <primary><varname>allow_system_table_mods</varname> configuration parameter</primary>
11399 </indexterm>
11400 </term>
11401 <listitem>
11402 <para>
11403 Allows modification of the structure of system tables as well as
11404 certain other risky actions on system tables. This is otherwise not
11405 allowed even for superusers. Ill-advised use of this setting can
11406 cause irretrievable data loss or seriously corrupt the database
11407 system.
11408 Only superusers and users with the appropriate <literal>SET</literal>
11409 privilege can change this setting.
11410 </para>
11411 </listitem>
11412 </varlistentry>
11414 <varlistentry id="guc-backtrace-functions" xreflabel="backtrace_functions">
11415 <term><varname>backtrace_functions</varname> (<type>string</type>)
11416 <indexterm>
11417 <primary><varname>backtrace_functions</varname> configuration parameter</primary>
11418 </indexterm>
11419 </term>
11420 <listitem>
11421 <para>
11422 This parameter contains a comma-separated list of C function names.
11423 If an error is raised and the name of the internal C function where
11424 the error happens matches a value in the list, then a backtrace is
11425 written to the server log together with the error message. This can
11426 be used to debug specific areas of the source code.
11427 </para>
11429 <para>
11430 Backtrace support is not available on all platforms, and the quality
11431 of the backtraces depends on compilation options.
11432 </para>
11434 <para>
11435 Only superusers and users with the appropriate <literal>SET</literal>
11436 privilege can change this setting.
11437 </para>
11438 </listitem>
11439 </varlistentry>
11441 <varlistentry id="guc-debug-copy-parse-plan-trees" xreflabel="debug_copy_parse_plan_trees">
11442 <term><varname>debug_copy_parse_plan_trees</varname> (<type>boolean</type>)
11443 <indexterm>
11444 <primary><varname>debug_copy_parse_plan_trees</varname> configuration parameter</primary>
11445 </indexterm>
11446 </term>
11447 <listitem>
11448 <para>
11449 Enabling this forces all parse and plan trees to be passed through
11450 <function>copyObject()</function>, to facilitate catching errors and
11451 omissions in <function>copyObject()</function>. The default is off.
11452 </para>
11454 <para>
11455 This parameter is only available when
11456 <symbol>DEBUG_NODE_TESTS_ENABLED</symbol> was defined at compile time
11457 (which happens automatically when using the
11458 <application>configure</application> option
11459 <option>--enable-cassert</option>).
11460 </para>
11461 </listitem>
11462 </varlistentry>
11464 <varlistentry id="guc-debug-discard-caches" xreflabel="debug_discard_caches">
11465 <term><varname>debug_discard_caches</varname> (<type>integer</type>)
11466 <indexterm>
11467 <primary><varname>debug_discard_caches</varname> configuration parameter</primary>
11468 </indexterm>
11469 </term>
11470 <listitem>
11471 <para>
11472 When set to <literal>1</literal>, each system catalog cache entry is
11473 invalidated at the first possible opportunity, whether or not
11474 anything that would render it invalid really occurred. Caching of
11475 system catalogs is effectively disabled as a result, so the server
11476 will run extremely slowly. Higher values run the cache invalidation
11477 recursively, which is even slower and only useful for testing
11478 the caching logic itself. The default value of <literal>0</literal>
11479 selects normal catalog caching behavior.
11480 </para>
11482 <para>
11483 This parameter can be very helpful when trying to trigger
11484 hard-to-reproduce bugs involving concurrent catalog changes, but it
11485 is otherwise rarely needed. See the source code files
11486 <filename>inval.c</filename> and
11487 <filename>pg_config_manual.h</filename> for details.
11488 </para>
11490 <para>
11491 This parameter is supported when
11492 <symbol>DISCARD_CACHES_ENABLED</symbol> was defined at compile time
11493 (which happens automatically when using the
11494 <application>configure</application> option
11495 <option>--enable-cassert</option>). In production builds, its value
11496 will always be <literal>0</literal> and attempts to set it to another
11497 value will raise an error.
11498 </para>
11499 </listitem>
11500 </varlistentry>
11502 <varlistentry id="guc-debug-io-direct" xreflabel="debug_io_direct">
11503 <term><varname>debug_io_direct</varname> (<type>string</type>)
11504 <indexterm>
11505 <primary><varname>debug_io_direct</varname> configuration parameter</primary>
11506 </indexterm>
11507 </term>
11508 <listitem>
11509 <para>
11510 Ask the kernel to minimize caching effects for relation data and WAL
11511 files using <literal>O_DIRECT</literal> (most Unix-like systems),
11512 <literal>F_NOCACHE</literal> (macOS) or
11513 <literal>FILE_FLAG_NO_BUFFERING</literal> (Windows).
11514 </para>
11515 <para>
11516 May be set to an empty string (the default) to disable use of direct
11517 I/O, or a comma-separated list of operations that should use direct I/O.
11518 The valid options are <literal>data</literal> for
11519 main data files, <literal>wal</literal> for WAL files, and
11520 <literal>wal_init</literal> for WAL files when being initially
11521 allocated.
11522 </para>
11523 <para>
11524 Some operating systems and file systems do not support direct I/O, so
11525 non-default settings may be rejected at startup or cause errors.
11526 </para>
11527 <para>
11528 Currently this feature reduces performance, and is intended for
11529 developer testing only.
11530 </para>
11531 </listitem>
11532 </varlistentry>
11534 <varlistentry id="guc-debug-parallel-query" xreflabel="debug_parallel_query">
11535 <term><varname>debug_parallel_query</varname> (<type>enum</type>)
11536 <indexterm>
11537 <primary><varname>debug_parallel_query</varname> configuration parameter</primary>
11538 </indexterm>
11539 </term>
11540 <listitem>
11541 <para>
11542 Allows the use of parallel queries for testing purposes even in cases
11543 where no performance benefit is expected.
11544 The allowed values of <varname>debug_parallel_query</varname> are
11545 <literal>off</literal> (use parallel mode only when it is expected to improve
11546 performance), <literal>on</literal> (force parallel query for all queries
11547 for which it is thought to be safe), and <literal>regress</literal> (like
11548 <literal>on</literal>, but with additional behavior changes as explained
11549 below).
11550 </para>
11552 <para>
11553 More specifically, setting this value to <literal>on</literal> will add
11554 a <literal>Gather</literal> node to the top of any query plan for which this
11555 appears to be safe, so that the query runs inside of a parallel worker.
11556 Even when a parallel worker is not available or cannot be used,
11557 operations such as starting a subtransaction that would be prohibited
11558 in a parallel query context will be prohibited unless the planner
11559 believes that this will cause the query to fail. If failures or
11560 unexpected results occur when this option is set, some functions used
11561 by the query may need to be marked <literal>PARALLEL UNSAFE</literal>
11562 (or, possibly, <literal>PARALLEL RESTRICTED</literal>).
11563 </para>
11565 <para>
11566 Setting this value to <literal>regress</literal> has all of the same effects
11567 as setting it to <literal>on</literal> plus some additional effects that are
11568 intended to facilitate automated regression testing. Normally,
11569 messages from a parallel worker include a context line indicating that,
11570 but a setting of <literal>regress</literal> suppresses this line so that the
11571 output is the same as in non-parallel execution. Also,
11572 the <literal>Gather</literal> nodes added to plans by this setting are hidden
11573 in <literal>EXPLAIN</literal> output so that the output matches what
11574 would be obtained if this setting were turned <literal>off</literal>.
11575 </para>
11576 </listitem>
11577 </varlistentry>
11579 <varlistentry id="guc-debug-raw-expression-coverage-test" xreflabel="debug_raw_expression_coverage_test">
11580 <term><varname>debug_raw_expression_coverage_test</varname> (<type>boolean</type>)
11581 <indexterm>
11582 <primary><varname>debug_raw_expression_coverage_test</varname> configuration parameter</primary>
11583 </indexterm>
11584 </term>
11585 <listitem>
11586 <para>
11587 Enabling this forces all raw parse trees for DML statements to be
11588 scanned by <function>raw_expression_tree_walker()</function>, to
11589 facilitate catching errors and omissions in that function. The
11590 default is off.
11591 </para>
11593 <para>
11594 This parameter is only available when
11595 <symbol>DEBUG_NODE_TESTS_ENABLED</symbol> was defined at compile time
11596 (which happens automatically when using the
11597 <application>configure</application> option
11598 <option>--enable-cassert</option>).
11599 </para>
11600 </listitem>
11601 </varlistentry>
11603 <varlistentry id="guc-debug-write-read-parse-plan-trees" xreflabel="debug_write_read_parse_plan_trees">
11604 <term><varname>debug_write_read_parse_plan_trees</varname> (<type>boolean</type>)
11605 <indexterm>
11606 <primary><varname>debug_write_read_parse_plan_trees</varname> configuration parameter</primary>
11607 </indexterm>
11608 </term>
11609 <listitem>
11610 <para>
11611 Enabling this forces all parse and plan trees to be passed through
11612 <filename>outfuncs.c</filename>/<filename>readfuncs.c</filename>, to
11613 facilitate catching errors and omissions in those modules. The
11614 default is off.
11615 </para>
11617 <para>
11618 This parameter is only available when
11619 <symbol>DEBUG_NODE_TESTS_ENABLED</symbol> was defined at compile time
11620 (which happens automatically when using the
11621 <application>configure</application> option
11622 <option>--enable-cassert</option>).
11623 </para>
11624 </listitem>
11625 </varlistentry>
11627 <varlistentry id="guc-ignore-system-indexes" xreflabel="ignore_system_indexes">
11628 <term><varname>ignore_system_indexes</varname> (<type>boolean</type>)
11629 <indexterm>
11630 <primary><varname>ignore_system_indexes</varname> configuration parameter</primary>
11631 </indexterm>
11632 </term>
11633 <listitem>
11634 <para>
11635 Ignore system indexes when reading system tables (but still
11636 update the indexes when modifying the tables). This is useful
11637 when recovering from damaged system indexes.
11638 This parameter cannot be changed after session start.
11639 </para>
11640 </listitem>
11641 </varlistentry>
11643 <varlistentry id="guc-post-auth-delay" xreflabel="post_auth_delay">
11644 <term><varname>post_auth_delay</varname> (<type>integer</type>)
11645 <indexterm>
11646 <primary><varname>post_auth_delay</varname> configuration parameter</primary>
11647 </indexterm>
11648 </term>
11649 <listitem>
11650 <para>
11651 The amount of time to delay when a new
11652 server process is started, after it conducts the
11653 authentication procedure. This is intended to give developers an
11654 opportunity to attach to the server process with a debugger.
11655 If this value is specified without units, it is taken as seconds.
11656 A value of zero (the default) disables the delay.
11657 This parameter cannot be changed after session start.
11658 </para>
11659 </listitem>
11660 </varlistentry>
11662 <varlistentry id="guc-pre-auth-delay" xreflabel="pre_auth_delay">
11663 <term><varname>pre_auth_delay</varname> (<type>integer</type>)
11664 <indexterm>
11665 <primary><varname>pre_auth_delay</varname> configuration parameter</primary>
11666 </indexterm>
11667 </term>
11668 <listitem>
11669 <para>
11670 The amount of time to delay just after a
11671 new server process is forked, before it conducts the
11672 authentication procedure. This is intended to give developers an
11673 opportunity to attach to the server process with a debugger to
11674 trace down misbehavior in authentication.
11675 If this value is specified without units, it is taken as seconds.
11676 A value of zero (the default) disables the delay.
11677 This parameter can only be set in the <filename>postgresql.conf</filename>
11678 file or on the server command line.
11679 </para>
11680 </listitem>
11681 </varlistentry>
11683 <varlistentry id="guc-trace-notify" xreflabel="trace_notify">
11684 <term><varname>trace_notify</varname> (<type>boolean</type>)
11685 <indexterm>
11686 <primary><varname>trace_notify</varname> configuration parameter</primary>
11687 </indexterm>
11688 </term>
11689 <listitem>
11690 <para>
11691 Generates a great amount of debugging output for the
11692 <command>LISTEN</command> and <command>NOTIFY</command>
11693 commands. <xref linkend="guc-client-min-messages"/> or
11694 <xref linkend="guc-log-min-messages"/> must be
11695 <literal>DEBUG1</literal> or lower to send this output to the
11696 client or server logs, respectively.
11697 </para>
11698 </listitem>
11699 </varlistentry>
11701 <varlistentry id="guc-trace-sort" xreflabel="trace_sort">
11702 <term><varname>trace_sort</varname> (<type>boolean</type>)
11703 <indexterm>
11704 <primary><varname>trace_sort</varname> configuration parameter</primary>
11705 </indexterm>
11706 </term>
11707 <listitem>
11708 <para>
11709 If on, emit information about resource usage during sort operations.
11710 </para>
11711 </listitem>
11712 </varlistentry>
11714 <varlistentry id="guc-trace-locks" xreflabel="trace_locks">
11715 <term><varname>trace_locks</varname> (<type>boolean</type>)
11716 <indexterm>
11717 <primary><varname>trace_locks</varname> configuration parameter</primary>
11718 </indexterm>
11719 </term>
11720 <listitem>
11721 <para>
11722 If on, emit information about lock usage. Information dumped
11723 includes the type of lock operation, the type of lock and the unique
11724 identifier of the object being locked or unlocked. Also included
11725 are bit masks for the lock types already granted on this object as
11726 well as for the lock types awaited on this object. For each lock
11727 type a count of the number of granted locks and waiting locks is
11728 also dumped as well as the totals. An example of the log file output
11729 is shown here:
11730 <screen>
11731 LOG: LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)
11732 grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
11733 wait(0) type(AccessShareLock)
11734 LOG: GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)
11735 grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1
11736 wait(0) type(AccessShareLock)
11737 LOG: UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)
11738 grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
11739 wait(0) type(AccessShareLock)
11740 LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
11741 grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
11742 wait(0) type(INVALID)
11743 </screen>
11744 Details of the structure being dumped may be found in
11745 <filename>src/include/storage/lock.h</filename>.
11746 </para>
11747 <para>
11748 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11749 macro was defined when <productname>PostgreSQL</productname> was
11750 compiled.
11751 </para>
11752 </listitem>
11753 </varlistentry>
11755 <varlistentry id="guc-trace-lwlocks" xreflabel="trace_lwlocks">
11756 <term><varname>trace_lwlocks</varname> (<type>boolean</type>)
11757 <indexterm>
11758 <primary><varname>trace_lwlocks</varname> configuration parameter</primary>
11759 </indexterm>
11760 </term>
11761 <listitem>
11762 <para>
11763 If on, emit information about lightweight lock usage. Lightweight
11764 locks are intended primarily to provide mutual exclusion of access
11765 to shared-memory data structures.
11766 </para>
11767 <para>
11768 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11769 macro was defined when <productname>PostgreSQL</productname> was
11770 compiled.
11771 </para>
11772 </listitem>
11773 </varlistentry>
11775 <varlistentry id="guc-trace-userlocks" xreflabel="trace_userlocks">
11776 <term><varname>trace_userlocks</varname> (<type>boolean</type>)
11777 <indexterm>
11778 <primary><varname>trace_userlocks</varname> configuration parameter</primary>
11779 </indexterm>
11780 </term>
11781 <listitem>
11782 <para>
11783 If on, emit information about user lock usage. Output is the same
11784 as for <symbol>trace_locks</symbol>, only for advisory locks.
11785 </para>
11786 <para>
11787 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11788 macro was defined when <productname>PostgreSQL</productname> was
11789 compiled.
11790 </para>
11791 </listitem>
11792 </varlistentry>
11794 <varlistentry id="guc-trace-lock-oidmin" xreflabel="trace_lock_oidmin">
11795 <term><varname>trace_lock_oidmin</varname> (<type>integer</type>)
11796 <indexterm>
11797 <primary><varname>trace_lock_oidmin</varname> configuration parameter</primary>
11798 </indexterm>
11799 </term>
11800 <listitem>
11801 <para>
11802 If set, do not trace locks for tables below this OID (used to avoid
11803 output on system tables).
11804 </para>
11805 <para>
11806 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11807 macro was defined when <productname>PostgreSQL</productname> was
11808 compiled.
11809 </para>
11810 </listitem>
11811 </varlistentry>
11813 <varlistentry id="guc-trace-lock-table" xreflabel="trace_lock_table">
11814 <term><varname>trace_lock_table</varname> (<type>integer</type>)
11815 <indexterm>
11816 <primary><varname>trace_lock_table</varname> configuration parameter</primary>
11817 </indexterm>
11818 </term>
11819 <listitem>
11820 <para>
11821 Unconditionally trace locks on this table (OID).
11822 </para>
11823 <para>
11824 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11825 macro was defined when <productname>PostgreSQL</productname> was
11826 compiled.
11827 </para>
11828 </listitem>
11829 </varlistentry>
11831 <varlistentry id="guc-debug-deadlocks" xreflabel="debug_deadlocks">
11832 <term><varname>debug_deadlocks</varname> (<type>boolean</type>)
11833 <indexterm>
11834 <primary><varname>debug_deadlocks</varname> configuration parameter</primary>
11835 </indexterm>
11836 </term>
11837 <listitem>
11838 <para>
11839 If set, dumps information about all current locks when a
11840 deadlock timeout occurs.
11841 </para>
11842 <para>
11843 This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
11844 macro was defined when <productname>PostgreSQL</productname> was
11845 compiled.
11846 </para>
11847 </listitem>
11848 </varlistentry>
11850 <varlistentry id="guc-log-btree-build-stats" xreflabel="log_btree_build_stats">
11851 <term><varname>log_btree_build_stats</varname> (<type>boolean</type>)
11852 <indexterm>
11853 <primary><varname>log_btree_build_stats</varname> configuration parameter</primary>
11854 </indexterm>
11855 </term>
11856 <listitem>
11857 <para>
11858 If set, logs system resource usage statistics (memory and CPU) on
11859 various B-tree operations.
11860 </para>
11861 <para>
11862 This parameter is only available if the <symbol>BTREE_BUILD_STATS</symbol>
11863 macro was defined when <productname>PostgreSQL</productname> was
11864 compiled.
11865 </para>
11866 </listitem>
11867 </varlistentry>
11869 <varlistentry id="guc-wal-consistency-checking" xreflabel="wal_consistency_checking">
11870 <term><varname>wal_consistency_checking</varname> (<type>string</type>)
11871 <indexterm>
11872 <primary><varname>wal_consistency_checking</varname> configuration parameter</primary>
11873 </indexterm>
11874 </term>
11875 <listitem>
11876 <para>
11877 This parameter is intended to be used to check for bugs in the WAL
11878 redo routines. When enabled, full-page images of any buffers modified
11879 in conjunction with the WAL record are added to the record.
11880 If the record is subsequently replayed, the system will first apply
11881 each record and then test whether the buffers modified by the record
11882 match the stored images. In certain cases (such as hint bits), minor
11883 variations are acceptable, and will be ignored. Any unexpected
11884 differences will result in a fatal error, terminating recovery.
11885 </para>
11887 <para>
11888 The default value of this setting is the empty string, which disables
11889 the feature. It can be set to <literal>all</literal> to check all
11890 records, or to a comma-separated list of resource managers to check
11891 only records originating from those resource managers. Currently,
11892 the supported resource managers are <literal>heap</literal>,
11893 <literal>heap2</literal>, <literal>btree</literal>, <literal>hash</literal>,
11894 <literal>gin</literal>, <literal>gist</literal>, <literal>sequence</literal>,
11895 <literal>spgist</literal>, <literal>brin</literal>, and <literal>generic</literal>.
11896 Extensions may define additional resource managers. Only superusers and users with
11897 the appropriate <literal>SET</literal> privilege can change this setting.
11898 </para>
11899 </listitem>
11900 </varlistentry>
11902 <varlistentry id="guc-wal-debug" xreflabel="wal_debug">
11903 <term><varname>wal_debug</varname> (<type>boolean</type>)
11904 <indexterm>
11905 <primary><varname>wal_debug</varname> configuration parameter</primary>
11906 </indexterm>
11907 </term>
11908 <listitem>
11909 <para>
11910 If on, emit WAL-related debugging output. This parameter is
11911 only available if the <symbol>WAL_DEBUG</symbol> macro was
11912 defined when <productname>PostgreSQL</productname> was
11913 compiled.
11914 </para>
11915 </listitem>
11916 </varlistentry>
11918 <varlistentry id="guc-ignore-checksum-failure" xreflabel="ignore_checksum_failure">
11919 <term><varname>ignore_checksum_failure</varname> (<type>boolean</type>)
11920 <indexterm>
11921 <primary><varname>ignore_checksum_failure</varname> configuration parameter</primary>
11922 </indexterm>
11923 </term>
11924 <listitem>
11925 <para>
11926 Only has effect if <xref linkend="app-initdb-data-checksums"/> are enabled.
11927 </para>
11928 <para>
11929 Detection of a checksum failure during a read normally causes
11930 <productname>PostgreSQL</productname> to report an error, aborting the current
11931 transaction. Setting <varname>ignore_checksum_failure</varname> to on causes
11932 the system to ignore the failure (but still report a warning), and
11933 continue processing. This behavior may <emphasis>cause crashes, propagate
11934 or hide corruption, or other serious problems</emphasis>. However, it may allow
11935 you to get past the error and retrieve undamaged tuples that might still be
11936 present in the table if the block header is still sane. If the header is
11937 corrupt an error will be reported even if this option is enabled. The
11938 default setting is <literal>off</literal>.
11939 Only superusers and users with the appropriate <literal>SET</literal>
11940 privilege can change this setting.
11941 </para>
11942 </listitem>
11943 </varlistentry>
11945 <varlistentry id="guc-zero-damaged-pages" xreflabel="zero_damaged_pages">
11946 <term><varname>zero_damaged_pages</varname> (<type>boolean</type>)
11947 <indexterm>
11948 <primary><varname>zero_damaged_pages</varname> configuration parameter</primary>
11949 </indexterm>
11950 </term>
11951 <listitem>
11952 <para>
11953 Detection of a damaged page header normally causes
11954 <productname>PostgreSQL</productname> to report an error, aborting the current
11955 transaction. Setting <varname>zero_damaged_pages</varname> to on causes
11956 the system to instead report a warning, zero out the damaged
11957 page in memory, and continue processing. This behavior <emphasis>will destroy data</emphasis>,
11958 namely all the rows on the damaged page. However, it does allow you to get
11959 past the error and retrieve rows from any undamaged pages that might
11960 be present in the table. It is useful for recovering data if
11961 corruption has occurred due to a hardware or software error. You should
11962 generally not set this on until you have given up hope of recovering
11963 data from the damaged pages of a table. Zeroed-out pages are not
11964 forced to disk so it is recommended to recreate the table or
11965 the index before turning this parameter off again. The
11966 default setting is <literal>off</literal>.
11967 Only superusers and users with the appropriate <literal>SET</literal>
11968 privilege can change this setting.
11969 </para>
11970 </listitem>
11971 </varlistentry>
11973 <varlistentry id="guc-ignore-invalid-pages" xreflabel="ignore_invalid_pages">
11974 <term><varname>ignore_invalid_pages</varname> (<type>boolean</type>)
11975 <indexterm>
11976 <primary><varname>ignore_invalid_pages</varname> configuration parameter</primary>
11977 </indexterm>
11978 </term>
11979 <listitem>
11980 <para>
11981 If set to <literal>off</literal> (the default), detection of
11982 WAL records having references to invalid pages during
11983 recovery causes <productname>PostgreSQL</productname> to
11984 raise a PANIC-level error, aborting the recovery. Setting
11985 <varname>ignore_invalid_pages</varname> to <literal>on</literal>
11986 causes the system to ignore invalid page references in WAL records
11987 (but still report a warning), and continue the recovery.
11988 This behavior may <emphasis>cause crashes, data loss,
11989 propagate or hide corruption, or other serious problems</emphasis>.
11990 However, it may allow you to get past the PANIC-level error,
11991 to finish the recovery, and to cause the server to start up.
11992 The parameter can only be set at server start. It only has effect
11993 during recovery or in standby mode.
11994 </para>
11995 </listitem>
11996 </varlistentry>
11998 <varlistentry id="guc-jit-debugging-support" xreflabel="jit_debugging_support">
11999 <term><varname>jit_debugging_support</varname> (<type>boolean</type>)
12000 <indexterm>
12001 <primary><varname>jit_debugging_support</varname> configuration parameter</primary>
12002 </indexterm>
12003 </term>
12004 <listitem>
12005 <para>
12006 If LLVM has the required functionality, register generated functions
12007 with <productname>GDB</productname>. This makes debugging easier.
12008 The default setting is <literal>off</literal>.
12009 This parameter can only be set at server start.
12010 </para>
12011 </listitem>
12012 </varlistentry>
12014 <varlistentry id="guc-jit-dump-bitcode" xreflabel="jit_dump_bitcode">
12015 <term><varname>jit_dump_bitcode</varname> (<type>boolean</type>)
12016 <indexterm>
12017 <primary><varname>jit_dump_bitcode</varname> configuration parameter</primary>
12018 </indexterm>
12019 </term>
12020 <listitem>
12021 <para>
12022 Writes the generated <productname>LLVM</productname> IR out to the
12023 file system, inside <xref linkend="guc-data-directory"/>. This is only
12024 useful for working on the internals of the JIT implementation.
12025 The default setting is <literal>off</literal>.
12026 Only superusers and users with the appropriate <literal>SET</literal>
12027 privilege can change this setting.
12028 </para>
12029 </listitem>
12030 </varlistentry>
12032 <varlistentry id="guc-jit-expressions" xreflabel="jit_expressions">
12033 <term><varname>jit_expressions</varname> (<type>boolean</type>)
12034 <indexterm>
12035 <primary><varname>jit_expressions</varname> configuration parameter</primary>
12036 </indexterm>
12037 </term>
12038 <listitem>
12039 <para>
12040 Determines whether expressions are JIT compiled, when JIT compilation
12041 is activated (see <xref linkend="jit-decision"/>). The default is
12042 <literal>on</literal>.
12043 </para>
12044 </listitem>
12045 </varlistentry>
12047 <varlistentry id="guc-jit-profiling-support" xreflabel="jit_profiling_support">
12048 <term><varname>jit_profiling_support</varname> (<type>boolean</type>)
12049 <indexterm>
12050 <primary><varname>jit_profiling_support</varname> configuration parameter</primary>
12051 </indexterm>
12052 </term>
12053 <listitem>
12054 <para>
12055 If LLVM has the required functionality, emit the data needed to allow
12056 <productname>perf</productname> to profile functions generated by JIT.
12057 This writes out files to <filename>~/.debug/jit/</filename>; the
12058 user is responsible for performing cleanup when desired.
12059 The default setting is <literal>off</literal>.
12060 This parameter can only be set at server start.
12061 </para>
12062 </listitem>
12063 </varlistentry>
12065 <varlistentry id="guc-jit-tuple-deforming" xreflabel="jit_tuple_deforming">
12066 <term><varname>jit_tuple_deforming</varname> (<type>boolean</type>)
12067 <indexterm>
12068 <primary><varname>jit_tuple_deforming</varname> configuration parameter</primary>
12069 </indexterm>
12070 </term>
12071 <listitem>
12072 <para>
12073 Determines whether tuple deforming is JIT compiled, when JIT
12074 compilation is activated (see <xref linkend="jit-decision"/>).
12075 The default is <literal>on</literal>.
12076 </para>
12077 </listitem>
12078 </varlistentry>
12080 <varlistentry id="guc-remove-temp-files-after-crash" xreflabel="remove_temp_files_after_crash">
12081 <term><varname>remove_temp_files_after_crash</varname> (<type>boolean</type>)
12082 <indexterm>
12083 <primary><varname>remove_temp_files_after_crash</varname> configuration parameter</primary>
12084 </indexterm>
12085 </term>
12086 <listitem>
12087 <para>
12088 When set to <literal>on</literal>, which is the default,
12089 <productname>PostgreSQL</productname> will automatically remove
12090 temporary files after a backend crash. If disabled, the files will be
12091 retained and may be used for debugging, for example. Repeated crashes
12092 may however result in accumulation of useless files. This parameter
12093 can only be set in the <filename>postgresql.conf</filename> file or on
12094 the server command line.
12095 </para>
12096 </listitem>
12097 </varlistentry>
12099 <varlistentry id="guc-send-abort-for-crash" xreflabel="send_abort_for_crash">
12100 <term><varname>send_abort_for_crash</varname> (<type>boolean</type>)
12101 <indexterm>
12102 <primary><varname>send_abort_for_crash</varname> configuration parameter</primary>
12103 </indexterm>
12104 </term>
12105 <listitem>
12106 <para>
12107 By default, after a backend crash the postmaster will stop remaining
12108 child processes by sending them <systemitem>SIGQUIT</systemitem>
12109 signals, which permits them to exit more-or-less gracefully. When
12110 this option is set to <literal>on</literal>,
12111 <systemitem>SIGABRT</systemitem> is sent instead. That normally
12112 results in production of a core dump file for each such child
12113 process.
12114 This can be handy for investigating the states of other processes
12115 after a crash. It can also consume lots of disk space in the event
12116 of repeated crashes, so do not enable this on systems you are not
12117 monitoring carefully.
12118 Beware that no support exists for cleaning up the core file(s)
12119 automatically.
12120 This parameter can only be set in
12121 the <filename>postgresql.conf</filename> file or on the server
12122 command line.
12123 </para>
12124 </listitem>
12125 </varlistentry>
12127 <varlistentry id="guc-send-abort-for-kill" xreflabel="send_abort_for_kill">
12128 <term><varname>send_abort_for_kill</varname> (<type>boolean</type>)
12129 <indexterm>
12130 <primary><varname>send_abort_for_kill</varname> configuration parameter</primary>
12131 </indexterm>
12132 </term>
12133 <listitem>
12134 <para>
12135 By default, after attempting to stop a child process with
12136 <systemitem>SIGQUIT</systemitem>, the postmaster will wait five
12137 seconds and then send <systemitem>SIGKILL</systemitem> to force
12138 immediate termination. When this option is set
12139 to <literal>on</literal>, <systemitem>SIGABRT</systemitem> is sent
12140 instead of <systemitem>SIGKILL</systemitem>. That normally results
12141 in production of a core dump file for each such child process.
12142 This can be handy for investigating the states
12143 of <quote>stuck</quote> child processes. It can also consume lots
12144 of disk space in the event of repeated crashes, so do not enable
12145 this on systems you are not monitoring carefully.
12146 Beware that no support exists for cleaning up the core file(s)
12147 automatically.
12148 This parameter can only be set in
12149 the <filename>postgresql.conf</filename> file or on the server
12150 command line.
12151 </para>
12152 </listitem>
12153 </varlistentry>
12155 <varlistentry id="guc-debug-logical-replication-streaming" xreflabel="debug_logical_replication_streaming">
12156 <term><varname>debug_logical_replication_streaming</varname> (<type>enum</type>)
12157 <indexterm>
12158 <primary><varname>debug_logical_replication_streaming</varname> configuration parameter</primary>
12159 </indexterm>
12160 </term>
12161 <listitem>
12162 <para>
12163 The allowed values are <literal>buffered</literal> and
12164 <literal>immediate</literal>. The default is <literal>buffered</literal>.
12165 This parameter is intended to be used to test logical decoding and
12166 replication of large transactions. The effect of
12167 <varname>debug_logical_replication_streaming</varname> is different for the
12168 publisher and subscriber:
12169 </para>
12171 <para>
12172 On the publisher side, <varname>debug_logical_replication_streaming</varname>
12173 allows streaming or serializing changes immediately in logical decoding.
12174 When set to <literal>immediate</literal>, stream each change if the
12175 <link linkend="sql-createsubscription-params-with-streaming"><literal>streaming</literal></link>
12176 option of
12177 <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
12178 is enabled, otherwise, serialize each change. When set to
12179 <literal>buffered</literal>, the decoding will stream or serialize
12180 changes when <varname>logical_decoding_work_mem</varname> is reached.
12181 </para>
12183 <para>
12184 On the subscriber side, if the <literal>streaming</literal> option is set to
12185 <literal>parallel</literal>, <varname>debug_logical_replication_streaming</varname>
12186 can be used to direct the leader apply worker to send changes to the
12187 shared memory queue or to serialize all changes to the file. When set to
12188 <literal>buffered</literal>, the leader sends changes to parallel apply
12189 workers via a shared memory queue. When set to
12190 <literal>immediate</literal>, the leader serializes all changes to files
12191 and notifies the parallel apply workers to read and apply them at the
12192 end of the transaction.
12193 </para>
12194 </listitem>
12195 </varlistentry>
12197 </variablelist>
12198 </sect1>
12199 <sect1 id="runtime-config-short">
12200 <title>Short Options</title>
12202 <para>
12203 For convenience there are also single letter command-line option
12204 switches available for some parameters. They are described in
12205 <xref linkend="runtime-config-short-table"/>. Some of these
12206 options exist for historical reasons, and their presence as a
12207 single-letter option does not necessarily indicate an endorsement
12208 to use the option heavily.
12209 </para>
12211 <table id="runtime-config-short-table">
12212 <title>Short Option Key</title>
12213 <tgroup cols="2">
12214 <colspec colname="col1" colwidth="1*"/>
12215 <colspec colname="col2" colwidth="2*"/>
12216 <thead>
12217 <row>
12218 <entry>Short Option</entry>
12219 <entry>Equivalent</entry>
12220 </row>
12221 </thead>
12223 <tbody>
12224 <row>
12225 <entry><option>-B <replaceable>x</replaceable></option></entry>
12226 <entry><literal>shared_buffers = <replaceable>x</replaceable></literal></entry>
12227 </row>
12228 <row>
12229 <entry><option>-d <replaceable>x</replaceable></option></entry>
12230 <entry><literal>log_min_messages = DEBUG<replaceable>x</replaceable></literal></entry>
12231 </row>
12232 <row>
12233 <entry><option>-e</option></entry>
12234 <entry><literal>datestyle = euro</literal></entry>
12235 </row>
12236 <row>
12237 <entry>
12238 <option>-fb</option>, <option>-fh</option>, <option>-fi</option>,
12239 <option>-fm</option>, <option>-fn</option>, <option>-fo</option>,
12240 <option>-fs</option>, <option>-ft</option>
12241 </entry>
12242 <entry>
12243 <literal>enable_bitmapscan = off</literal>,
12244 <literal>enable_hashjoin = off</literal>,
12245 <literal>enable_indexscan = off</literal>,
12246 <literal>enable_mergejoin = off</literal>,
12247 <literal>enable_nestloop = off</literal>,
12248 <literal>enable_indexonlyscan = off</literal>,
12249 <literal>enable_seqscan = off</literal>,
12250 <literal>enable_tidscan = off</literal>
12251 </entry>
12252 </row>
12253 <row>
12254 <entry><option>-F</option></entry>
12255 <entry><literal>fsync = off</literal></entry>
12256 </row>
12257 <row>
12258 <entry><option>-h <replaceable>x</replaceable></option></entry>
12259 <entry><literal>listen_addresses = <replaceable>x</replaceable></literal></entry>
12260 </row>
12261 <row>
12262 <entry><option>-i</option></entry>
12263 <entry><literal>listen_addresses = '*'</literal></entry>
12264 </row>
12265 <row>
12266 <entry><option>-k <replaceable>x</replaceable></option></entry>
12267 <entry><literal>unix_socket_directories = <replaceable>x</replaceable></literal></entry>
12268 </row>
12269 <row>
12270 <entry><option>-l</option></entry>
12271 <entry><literal>ssl = on</literal></entry>
12272 </row>
12273 <row>
12274 <entry><option>-N <replaceable>x</replaceable></option></entry>
12275 <entry><literal>max_connections = <replaceable>x</replaceable></literal></entry>
12276 </row>
12277 <row>
12278 <entry><option>-O</option></entry>
12279 <entry><literal>allow_system_table_mods = on</literal></entry>
12280 </row>
12281 <row>
12282 <entry><option>-p <replaceable>x</replaceable></option></entry>
12283 <entry><literal>port = <replaceable>x</replaceable></literal></entry>
12284 </row>
12285 <row>
12286 <entry><option>-P</option></entry>
12287 <entry><literal>ignore_system_indexes = on</literal></entry>
12288 </row>
12289 <row>
12290 <entry><option>-s</option></entry>
12291 <entry><literal>log_statement_stats = on</literal></entry>
12292 </row>
12293 <row>
12294 <entry><option>-S <replaceable>x</replaceable></option></entry>
12295 <entry><literal>work_mem = <replaceable>x</replaceable></literal></entry>
12296 </row>
12297 <row>
12298 <entry><option>-tpa</option>, <option>-tpl</option>, <option>-te</option></entry>
12299 <entry><literal>log_parser_stats = on</literal>,
12300 <literal>log_planner_stats = on</literal>,
12301 <literal>log_executor_stats = on</literal></entry>
12302 </row>
12303 <row>
12304 <entry><option>-W <replaceable>x</replaceable></option></entry>
12305 <entry><literal>post_auth_delay = <replaceable>x</replaceable></literal></entry>
12306 </row>
12307 </tbody>
12308 </tgroup>
12309 </table>
12311 </sect1>
12312 </chapter>