1 <!-- doc/src/sgml/config.sgml -->
3 <chapter id=
"runtime-config">
4 <title>Server Configuration
</title>
7 <primary>configuration
</primary>
8 <secondary>of the server
</secondary>
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.
18 <sect1 id=
"config-setting">
19 <title>Setting Parameters
</title>
21 <sect2 id=
"config-setting-names-values">
22 <title>Parameter Names and Values
</title>
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
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>,
44 (all case-insensitive) or any unambiguous prefix of one of these.
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.)
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.
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.
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.
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).
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.
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.
132 <sect2 id=
"config-setting-configuration-file">
133 <title>Parameter Interaction via the Configuration File
</title>
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:
143 log_connections = yes
144 log_destination = 'syslog'
145 search_path = '
"$user", public'
146 shared_buffers =
128MB
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)
156 If the file contains multiple entries for the same parameter,
157 all but the last one are ignored.
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.
169 <primary>SIGHUP
</primary>
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.
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>.
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).
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
219 <sect2 id=
"config-setting-sql">
220 <title>Parameter Interaction via SQL
</title>
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:
235 The
<link linkend=
"sql-alterdatabase"><command>ALTER DATABASE
</command></link> command allows global
236 settings to be overridden on a per-database basis.
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.
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).
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:
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"/>).
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"/>).
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:
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.
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
309 SET configuration_parameter TO DEFAULT;
313 UPDATE pg_settings SET setting = reset_val WHERE name = 'configuration_parameter';
321 <sect2 id=
"config-setting-shell">
322 <title>Parameter Interaction via the Shell
</title>
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.
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,
340 postgres -c log_connections=yes --log-destination='syslog'
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.
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,
360 env
PGOPTIONS=
"-c geqo=off --statement-timeout=5min" psql
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.
374 <sect2 id=
"config-includes">
375 <title>Managing Configuration File Contents
</title>
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.
386 <primary><literal>include
</literal></primary>
387 <secondary>in configuration file
</secondary>
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:
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.
405 <primary><literal>include_if_exists
</literal></primary>
406 <secondary>in configuration file
</secondary>
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.
418 <primary><literal>include_dir
</literal></primary>
419 <secondary>in configuration file
</secondary>
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
425 include_dir 'directory'
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).
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
451 include 'shared.conf'
452 include 'memory.conf'
453 include 'server.conf'
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.
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>:
470 Then you could name the files in the
<filename>conf.d
</filename> directory
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>.
486 You might instead use this approach to naming the files
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.)
502 <sect1 id=
"runtime-config-file-locations">
503 <title>File Locations
</title>
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
520 <varlistentry id=
"guc-data-directory" xreflabel=
"data_directory">
521 <term><varname>data_directory
</varname> (
<type>string
</type>)
523 <primary><varname>data_directory
</varname> configuration parameter
</primary>
528 Specifies the directory to use for data storage.
529 This parameter can only be set at server start.
534 <varlistentry id=
"guc-config-file" xreflabel=
"config_file">
535 <term><varname>config_file
</varname> (
<type>string
</type>)
537 <primary><varname>config_file
</varname> configuration parameter
</primary>
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.
549 <varlistentry id=
"guc-hba-file" xreflabel=
"hba_file">
550 <term><varname>hba_file
</varname> (
<type>string
</type>)
552 <primary><varname>hba_file
</varname> configuration parameter
</primary>
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.
564 <varlistentry id=
"guc-ident-file" xreflabel=
"ident_file">
565 <term><varname>ident_file
</varname> (
<type>string
</type>)
567 <primary><varname>ident_file
</varname> configuration parameter
</primary>
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"/>.
580 <varlistentry id=
"guc-external-pid-file" xreflabel=
"external_pid_file">
581 <term><varname>external_pid_file
</varname> (
<type>string
</type>)
583 <primary><varname>external_pid_file
</varname> configuration parameter
</primary>
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.
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.
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
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>.
630 When setting any of these parameters, a relative path will be interpreted
631 with respect to the directory in which
<command>postgres
</command>
636 <sect1 id=
"runtime-config-connection">
637 <title>Connections and Authentication
</title>
639 <sect2 id=
"runtime-config-connection-settings">
640 <title>Connection Settings
</title>
644 <varlistentry id=
"guc-listen-addresses" xreflabel=
"listen_addresses">
645 <term><varname>listen_addresses
</varname> (
<type>string
</type>)
647 <primary><varname>listen_addresses
</varname> configuration parameter
</primary>
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
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
680 <varlistentry id=
"guc-port" xreflabel=
"port">
681 <term><varname>port
</varname> (
<type>integer
</type>)
683 <primary><varname>port
</varname> configuration parameter
</primary>
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.
695 <varlistentry id=
"guc-max-connections" xreflabel=
"max_connections">
696 <term><varname>max_connections
</varname> (
<type>integer
</type>)
698 <primary><varname>max_connections
</varname> configuration parameter
</primary>
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.
711 <productname>PostgreSQL
</productname> 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.
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.
724 <varlistentry id=
"guc-reserved-connections" xreflabel=
"reserved_connections">
725 <term><varname>reserved_connections
</varname> (
<type>integer
</type>)
727 <primary><varname>reserved_connections
</varname> configuration parameter
</primary>
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
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.
755 <varlistentry id=
"guc-superuser-reserved-connections"
756 xreflabel=
"superuser_reserved_connections">
757 <term><varname>superuser_reserved_connections
</varname>
758 (
<type>integer
</type>)
760 <primary><varname>superuser_reserved_connections
</varname> configuration parameter
</primary>
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.
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.
787 <varlistentry id=
"guc-unix-socket-directories" xreflabel=
"unix_socket_directories">
788 <term><varname>unix_socket_directories
</varname> (
<type>string
</type>)
790 <primary><varname>unix_socket_directories
</varname> configuration parameter
</primary>
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.
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.
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>.
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
823 This parameter can only be set at server start.
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.
838 <varlistentry id=
"guc-unix-socket-group" xreflabel=
"unix_socket_group">
839 <term><varname>unix_socket_group
</varname> (
<type>string
</type>)
841 <primary><varname>unix_socket_group
</varname> configuration parameter
</primary>
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
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.
864 <varlistentry id=
"guc-unix-socket-permissions" xreflabel=
"unix_socket_permissions">
865 <term><varname>unix_socket_permissions
</varname> (
<type>integer
</type>)
867 <primary><varname>unix_socket_permissions
</varname> configuration parameter
</primary>
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).)
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.)
892 This access control mechanism is independent of the one
893 described in
<xref linkend=
"client-authentication"/>.
897 This parameter can only be set at server start.
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.
908 Sockets in the abstract namespace have no file permissions, so this
909 setting is also ignored in that case.
914 <varlistentry id=
"guc-bonjour" xreflabel=
"bonjour">
915 <term><varname>bonjour
</varname> (
<type>boolean
</type>)
917 <primary><varname>bonjour
</varname> configuration parameter
</primary>
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.
929 <varlistentry id=
"guc-bonjour-name" xreflabel=
"bonjour_name">
930 <term><varname>bonjour_name
</varname> (
<type>string
</type>)
932 <primary><varname>bonjour_name
</varname> configuration parameter
</primary>
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.
949 <sect2 id=
"runtime-config-tcp-settings">
950 <title>TCP Settings
</title>
954 <varlistentry id=
"guc-tcp-keepalives-idle" xreflabel=
"tcp_keepalives_idle">
955 <term><varname>tcp_keepalives_idle
</varname> (
<type>integer
</type>)
957 <primary><varname>tcp_keepalives_idle
</varname> configuration parameter
</primary>
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.
977 <varlistentry id=
"guc-tcp-keepalives-interval" xreflabel=
"tcp_keepalives_interval">
978 <term><varname>tcp_keepalives_interval
</varname> (
<type>integer
</type>)
980 <primary><varname>tcp_keepalives_interval
</varname> configuration parameter
</primary>
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.
1000 <varlistentry id=
"guc-tcp-keepalives-count" xreflabel=
"tcp_keepalives_count">
1001 <term><varname>tcp_keepalives_count
</varname> (
<type>integer
</type>)
1003 <primary><varname>tcp_keepalives_count
</varname> configuration parameter
</primary>
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.
1020 <varlistentry id=
"guc-tcp-user-timeout" xreflabel=
"tcp_user_timeout">
1021 <term><varname>tcp_user_timeout
</varname> (
<type>integer
</type>)
1023 <primary><varname>tcp_user_timeout
</varname> configuration parameter
</primary>
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.
1040 <varlistentry id=
"guc-client-connection-check-interval" xreflabel=
"client_connection_check_interval">
1041 <term><varname>client_connection_check_interval
</varname> (
<type>integer
</type>)
1043 <primary><varname>client_connection_check_interval
</varname> configuration parameter
</primary>
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.
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
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.
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>.
1080 <sect2 id=
"runtime-config-connection-authentication">
1081 <title>Authentication
</title>
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>
1089 <primary><varname>authentication_timeout
</varname> configuration parameter
</primary>
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.
1107 <varlistentry id=
"guc-password-encryption" xreflabel=
"password_encryption">
1108 <term><varname>password_encryption
</varname> (
<type>enum
</type>)
1110 <primary><varname>password_encryption
</varname> configuration parameter
</primary>
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>.
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.
1129 Support for MD5-encrypted passwords is deprecated and will be removed
1130 in a future release of
<productname>PostgreSQL
</productname>. Refer
1131 to
<xref linkend=
"auth-password"/> for details about migrating to
1132 another password type.
1138 <varlistentry id=
"guc-scram-iterations" xreflabel=
"scram_iterations">
1139 <term><varname>scram_iterations
</varname> (
<type>integer
</type>)
1141 <primary><varname>scram_iterations
</varname> configuration parameter
</primary>
1146 The number of computational iterations to be performed when encrypting
1147 a password using SCRAM-SHA-
256. The default is
<literal>4096</literal>.
1148 A higher number of iterations provides additional protection against
1149 brute-force attacks on stored passwords, but makes authentication
1150 slower. Changing the value has no effect on existing passwords
1151 encrypted with SCRAM-SHA-
256 as the iteration count is fixed at the
1152 time of encryption. In order to make use of a changed value, a new
1153 password must be set.
1158 <varlistentry id=
"guc-krb-server-keyfile" xreflabel=
"krb_server_keyfile">
1159 <term><varname>krb_server_keyfile
</varname> (
<type>string
</type>)
1161 <primary><varname>krb_server_keyfile
</varname> configuration parameter
</primary>
1166 Sets the location of the server's Kerberos key file. The default is
1167 <filename>FILE:/usr/local/pgsql/etc/krb5.keytab
</filename>
1168 (where the directory part is whatever was specified
1169 as
<varname>sysconfdir
</varname> at build time; use
1170 <literal>pg_config --sysconfdir
</literal> to determine that).
1171 If this parameter is set to an empty string, it is ignored and a
1172 system-dependent default is used.
1173 This parameter can only be set in the
1174 <filename>postgresql.conf
</filename> file or on the server command line.
1175 See
<xref linkend=
"gssapi-auth"/> for more information.
1180 <varlistentry id=
"guc-krb-caseins-users" xreflabel=
"krb_caseins_users">
1181 <term><varname>krb_caseins_users
</varname> (
<type>boolean
</type>)
1183 <primary><varname>krb_caseins_users
</varname> configuration parameter
</primary>
1188 Sets whether GSSAPI user names should be treated
1190 The default is
<literal>off
</literal> (case sensitive). This parameter can only be
1191 set in the
<filename>postgresql.conf
</filename> file or on the server command line.
1196 <varlistentry id=
"guc-gss-accept-delegation" xreflabel=
"gss_accept_delegation">
1197 <term><varname>gss_accept_delegation
</varname> (
<type>boolean
</type>)
1199 <primary><varname>gss_accept_delegation
</varname> configuration parameter
</primary>
1204 Sets whether GSSAPI delegation should be accepted from the client.
1205 The default is
<literal>off
</literal> meaning credentials from the client will
1206 <emphasis>not
</emphasis> be accepted. Changing this to
<literal>on
</literal> will make the server
1207 accept credentials delegated to it from the client. This parameter can only be
1208 set in the
<filename>postgresql.conf
</filename> file or on the server command line.
1215 <sect2 id=
"runtime-config-connection-ssl">
1219 See
<xref linkend=
"ssl-tcp"/> for more information about setting up
1220 <acronym>SSL
</acronym>. The configuration parameters for controlling
1221 transfer encryption using
<acronym>TLS
</acronym> protocols are named
1222 <literal>ssl
</literal> for historic reasons, even though support for
1223 the
<acronym>SSL
</acronym> protocol has been deprecated.
1224 <acronym>SSL
</acronym> is in this context used interchangeably with
1225 <acronym>TLS
</acronym>.
1229 <varlistentry id=
"guc-ssl" xreflabel=
"ssl">
1230 <term><varname>ssl
</varname> (
<type>boolean
</type>)
1232 <primary><varname>ssl
</varname> configuration parameter
</primary>
1237 Enables
<acronym>SSL
</acronym> connections.
1238 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1239 file or on the server command line.
1240 The default is
<literal>off
</literal>.
1245 <varlistentry id=
"guc-ssl-ca-file" xreflabel=
"ssl_ca_file">
1246 <term><varname>ssl_ca_file
</varname> (
<type>string
</type>)
1248 <primary><varname>ssl_ca_file
</varname> configuration parameter
</primary>
1253 Specifies the name of the file containing the SSL server certificate
1255 Relative paths are relative to the data directory.
1256 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1257 file or on the server command line.
1258 The default is empty, meaning no CA file is loaded,
1259 and client certificate verification is not performed.
1264 <varlistentry id=
"guc-ssl-cert-file" xreflabel=
"ssl_cert_file">
1265 <term><varname>ssl_cert_file
</varname> (
<type>string
</type>)
1267 <primary><varname>ssl_cert_file
</varname> configuration parameter
</primary>
1272 Specifies the name of the file containing the SSL server certificate.
1273 Relative paths are relative to the data directory.
1274 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1275 file or on the server command line.
1276 The default is
<filename>server.crt
</filename>.
1281 <varlistentry id=
"guc-ssl-crl-file" xreflabel=
"ssl_crl_file">
1282 <term><varname>ssl_crl_file
</varname> (
<type>string
</type>)
1284 <primary><varname>ssl_crl_file
</varname> configuration parameter
</primary>
1289 Specifies the name of the file containing the SSL client certificate
1290 revocation list (CRL).
1291 Relative paths are relative to the data directory.
1292 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1293 file or on the server command line.
1294 The default is empty, meaning no CRL file is loaded (unless
1295 <xref linkend=
"guc-ssl-crl-dir"/> is set).
1300 <varlistentry id=
"guc-ssl-crl-dir" xreflabel=
"ssl_crl_dir">
1301 <term><varname>ssl_crl_dir
</varname> (
<type>string
</type>)
1303 <primary><varname>ssl_crl_dir
</varname> configuration parameter
</primary>
1308 Specifies the name of the directory containing the SSL client
1309 certificate revocation list (CRL). Relative paths are relative to the
1310 data directory. This parameter can only be set in
1311 the
<filename>postgresql.conf
</filename> file or on the server command
1312 line. The default is empty, meaning no CRLs are used (unless
1313 <xref linkend=
"guc-ssl-crl-file"/> is set).
1317 The directory needs to be prepared with the
1318 <productname>OpenSSL
</productname> command
1319 <literal>openssl rehash
</literal> or
<literal>c_rehash
</literal>. See
1320 its documentation for details.
1324 When using this setting, CRLs in the specified directory are loaded
1325 on-demand at connection time. New CRLs can be added to the directory
1326 and will be used immediately. This is unlike
<xref
1327 linkend=
"guc-ssl-crl-file"/>, which causes the CRL in the file to be
1328 loaded at server start time or when the configuration is reloaded.
1329 Both settings can be used together.
1334 <varlistentry id=
"guc-ssl-key-file" xreflabel=
"ssl_key_file">
1335 <term><varname>ssl_key_file
</varname> (
<type>string
</type>)
1337 <primary><varname>ssl_key_file
</varname> configuration parameter
</primary>
1342 Specifies the name of the file containing the SSL server private key.
1343 Relative paths are relative to the data directory.
1344 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1345 file or on the server command line.
1346 The default is
<filename>server.key
</filename>.
1351 <varlistentry id=
"guc-ssl-tls13-ciphers" xreflabel=
"ssl_tls13_ciphers">
1352 <term><varname>ssl_tls13_ciphers
</varname> (
<type>string
</type>)
1354 <primary><varname>ssl_tls13_ciphers
</varname> configuration parameter
</primary>
1359 Specifies a list of cipher suites that are allowed by connections using
1360 <acronym>TLS
</acronym> version
1.3. Multiple cipher suites can be
1361 specified by using a colon separated list. If left blank, the default
1362 set of cipher suites in
<productname>OpenSSL
</productname> will be used.
1366 This parameter can only be set in the
1367 <filename>postgresql.conf
</filename> file or on the server command
1373 <varlistentry id=
"guc-ssl-ciphers" xreflabel=
"ssl_ciphers">
1374 <term><varname>ssl_ciphers
</varname> (
<type>string
</type>)
1376 <primary><varname>ssl_ciphers
</varname> configuration parameter
</primary>
1381 Specifies a list of
<acronym>SSL
</acronym> ciphers that are allowed by
1382 connections using TLS version
1.2 and lower, see
1383 <xref linkend=
"guc-ssl-tls13-ciphers"/> for TLS version
1.3 connections. See
1384 the
<citerefentry><refentrytitle>ciphers
</refentrytitle></citerefentry>
1385 manual page in the
<productname>OpenSSL
</productname> package for the
1386 syntax of this setting and a list of supported values. The default value
1387 is
<literal>HIGH:MEDIUM:+
3DES:!aNULL
</literal>. The default is usually a
1388 reasonable choice unless you have specific security requirements.
1392 This parameter can only be set in the
1393 <filename>postgresql.conf
</filename> file or on the server command
1398 Explanation of the default value:
1400 <varlistentry id=
"guc-ssl-ciphers-high">
1401 <term><literal>HIGH
</literal></term>
1404 Cipher suites that use ciphers from
<literal>HIGH
</literal> group (e.g.,
1405 AES, Camellia,
3DES)
1410 <varlistentry id=
"guc-ssl-ciphers-medium">
1411 <term><literal>MEDIUM
</literal></term>
1414 Cipher suites that use ciphers from
<literal>MEDIUM
</literal> group
1420 <varlistentry id=
"guc-ssl-ciphers-plus-3des">
1421 <term><literal>+
3DES
</literal></term>
1424 The
<productname>OpenSSL
</productname> default order for
1425 <literal>HIGH
</literal> is problematic because it orders
3DES
1426 higher than AES128. This is wrong because
3DES offers less
1427 security than AES128, and it is also much slower.
1428 <literal>+
3DES
</literal> reorders it after all other
1429 <literal>HIGH
</literal> and
<literal>MEDIUM
</literal> ciphers.
1434 <varlistentry id=
"guc-ssl-ciphers-not-anull">
1435 <term><literal>!aNULL
</literal></term>
1438 Disables anonymous cipher suites that do no authentication. Such
1439 cipher suites are vulnerable to
<acronym>MITM
</acronym> attacks and
1440 therefore should not be used.
1448 Available cipher suite details will vary across
1449 <productname>OpenSSL
</productname> versions. Use the command
1450 <literal>openssl ciphers -v 'HIGH:MEDIUM:+
3DES:!aNULL'
</literal> to
1451 see actual details for the currently installed
1452 <productname>OpenSSL
</productname> version. Note that this list is
1453 filtered at run time based on the server key type.
1458 <varlistentry id=
"guc-ssl-prefer-server-ciphers" xreflabel=
"ssl_prefer_server_ciphers">
1459 <term><varname>ssl_prefer_server_ciphers
</varname> (
<type>boolean
</type>)
1461 <primary><varname>ssl_prefer_server_ciphers
</varname> configuration parameter
</primary>
1466 Specifies whether to use the server's SSL cipher preferences, rather
1468 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1469 file or on the server command line.
1470 The default is
<literal>on
</literal>.
1474 <productname>PostgreSQL
</productname> versions before
9.4 do not have
1475 this setting and always use the client's preferences. This setting is
1476 mainly for backward compatibility with those versions. Using the
1477 server's preferences is usually better because it is more likely that
1478 the server is appropriately configured.
1483 <varlistentry id=
"guc-ssl-groups" xreflabel=
"ssl_groups">
1484 <term><varname>ssl_groups
</varname> (
<type>string
</type>)
1486 <primary><varname>ssl_groups
</varname> configuration parameter
</primary>
1491 Specifies the name of the curve to use in
<acronym>ECDH
</acronym> key
1492 exchange. It needs to be supported by all clients that connect.
1493 Multiple curves can be specified by using a colon-separated list.
1494 It does not need to be the same curve used by the server's Elliptic
1495 Curve key. This parameter can only be set in the
1496 <filename>postgresql.conf
</filename> file or on the server command line.
1497 The default is
<literal>prime256v1
</literal>.
1501 <productname>OpenSSL
</productname> names for the most common curves
1503 <literal>prime256v1
</literal> (NIST P-
256),
1504 <literal>secp384r1
</literal> (NIST P-
384),
1505 <literal>secp521r1
</literal> (NIST P-
521).
1506 An incomplete list of available groups can be shown with the command
1507 <command>openssl ecparam -list_curves
</command>. Not all of them are
1508 usable with
<acronym>TLS
</acronym> though, and many supported group
1509 names and aliases are omitted.
1513 In
<productname>PostgreSQL
</productname> versions before
18.0 this
1514 setting was named
<literal>ssl_ecdh_curve
</literal> and only accepted
1520 <varlistentry id=
"guc-ssl-min-protocol-version" xreflabel=
"ssl_min_protocol_version">
1521 <term><varname>ssl_min_protocol_version
</varname> (
<type>enum
</type>)
1523 <primary><varname>ssl_min_protocol_version
</varname> configuration parameter
</primary>
1528 Sets the minimum SSL/TLS protocol version to use. Valid values are
1529 currently:
<literal>TLSv1
</literal>,
<literal>TLSv1.1
</literal>,
1530 <literal>TLSv1.2
</literal>,
<literal>TLSv1.3
</literal>. Older
1531 versions of the
<productname>OpenSSL
</productname> library do not
1532 support all values; an error will be raised if an unsupported setting
1533 is chosen. Protocol versions before TLS
1.0, namely SSL version
2 and
1534 3, are always disabled.
1538 The default is
<literal>TLSv1.2
</literal>, which satisfies industry
1539 best practices as of this writing.
1543 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1544 file or on the server command line.
1549 <varlistentry id=
"guc-ssl-max-protocol-version" xreflabel=
"ssl_max_protocol_version">
1550 <term><varname>ssl_max_protocol_version
</varname> (
<type>enum
</type>)
1552 <primary><varname>ssl_max_protocol_version
</varname> configuration parameter
</primary>
1557 Sets the maximum SSL/TLS protocol version to use. Valid values are as
1558 for
<xref linkend=
"guc-ssl-min-protocol-version"/>, with addition of
1559 an empty string, which allows any protocol version. The default is to
1560 allow any version. Setting the maximum protocol version is mainly
1561 useful for testing or if some component has issues working with a
1566 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1567 file or on the server command line.
1572 <varlistentry id=
"guc-ssl-dh-params-file" xreflabel=
"ssl_dh_params_file">
1573 <term><varname>ssl_dh_params_file
</varname> (
<type>string
</type>)
1575 <primary><varname>ssl_dh_params_file
</varname> configuration parameter
</primary>
1580 Specifies the name of the file containing Diffie-Hellman parameters
1581 used for so-called ephemeral DH family of SSL ciphers. The default is
1582 empty, in which case compiled-in default DH parameters used. Using
1583 custom DH parameters reduces the exposure if an attacker manages to
1584 crack the well-known compiled-in DH parameters. You can create your own
1585 DH parameters file with the command
1586 <command>openssl dhparam -out dhparams.pem
2048</command>.
1590 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1591 file or on the server command line.
1596 <varlistentry id=
"guc-ssl-passphrase-command" xreflabel=
"ssl_passphrase_command">
1597 <term><varname>ssl_passphrase_command
</varname> (
<type>string
</type>)
1599 <primary><varname>ssl_passphrase_command
</varname> configuration parameter
</primary>
1604 Sets an external command to be invoked when a passphrase for
1605 decrypting an SSL file such as a private key needs to be obtained. By
1606 default, this parameter is empty, which means the built-in prompting
1610 The command must print the passphrase to the standard output and exit
1611 with code
0. In the parameter value,
<literal>%p
</literal> is
1612 replaced by a prompt string. (Write
<literal>%%
</literal> for a
1613 literal
<literal>%
</literal>.) Note that the prompt string will
1614 probably contain whitespace, so be sure to quote adequately. A single
1615 newline is stripped from the end of the output if present.
1618 The command does not actually have to prompt the user for a
1619 passphrase. It can read it from a file, obtain it from a keychain
1620 facility, or similar. It is up to the user to make sure the chosen
1621 mechanism is adequately secure.
1624 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1625 file or on the server command line.
1630 <varlistentry id=
"guc-ssl-passphrase-command-supports-reload" xreflabel=
"ssl_passphrase_command_supports_reload">
1631 <term><varname>ssl_passphrase_command_supports_reload
</varname> (
<type>boolean
</type>)
1633 <primary><varname>ssl_passphrase_command_supports_reload
</varname> configuration parameter
</primary>
1638 This parameter determines whether the passphrase command set by
1639 <varname>ssl_passphrase_command
</varname> will also be called during a
1640 configuration reload if a key file needs a passphrase. If this
1641 parameter is off (the default), then
1642 <varname>ssl_passphrase_command
</varname> will be ignored during a
1643 reload and the SSL configuration will not be reloaded if a passphrase
1644 is needed. That setting is appropriate for a command that requires a
1645 TTY for prompting, which might not be available when the server is
1646 running. Setting this parameter to on might be appropriate if the
1647 passphrase is obtained from a file, for example.
1650 This parameter can only be set in the
<filename>postgresql.conf
</filename>
1651 file or on the server command line.
1659 <sect1 id=
"runtime-config-resource">
1660 <title>Resource Consumption
</title>
1662 <sect2 id=
"runtime-config-resource-memory">
1663 <title>Memory
</title>
1666 <varlistentry id=
"guc-shared-buffers" xreflabel=
"shared_buffers">
1667 <term><varname>shared_buffers
</varname> (
<type>integer
</type>)
1669 <primary><varname>shared_buffers
</varname> configuration parameter
</primary>
1674 Sets the amount of memory the database server uses for shared
1675 memory buffers. The default is typically
128 megabytes
1676 (
<literal>128MB
</literal>), but might be less if your kernel settings will
1677 not support it (as determined during
<application>initdb
</application>).
1678 This setting must be at least
128 kilobytes. However,
1679 settings significantly higher than the minimum are usually needed
1680 for good performance.
1681 If this value is specified without units, it is taken as blocks,
1682 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
1683 (Non-default values of
<symbol>BLCKSZ
</symbol> change the minimum
1685 This parameter can only be set at server start.
1689 If you have a dedicated database server with
1GB or more of RAM, a
1690 reasonable starting value for
<varname>shared_buffers
</varname> is
25%
1691 of the memory in your system. There are some workloads where even
1692 larger settings for
<varname>shared_buffers
</varname> are effective, but
1693 because
<productname>PostgreSQL
</productname> also relies on the
1694 operating system cache, it is unlikely that an allocation of more than
1695 40% of RAM to
<varname>shared_buffers
</varname> will work better than a
1696 smaller amount. Larger settings for
<varname>shared_buffers
</varname>
1697 usually require a corresponding increase in
1698 <varname>max_wal_size
</varname>, in order to spread out the
1699 process of writing large quantities of new or changed data over a
1700 longer period of time.
1704 On systems with less than
1GB of RAM, a smaller percentage of RAM is
1705 appropriate, so as to leave adequate space for the operating system.
1711 <varlistentry id=
"guc-huge-pages" xreflabel=
"huge_pages">
1712 <term><varname>huge_pages
</varname> (
<type>enum
</type>)
1714 <primary><varname>huge_pages
</varname> configuration parameter
</primary>
1719 Controls whether huge pages are requested for the main shared memory
1720 area. Valid values are
<literal>try
</literal> (the default),
1721 <literal>on
</literal>, and
<literal>off
</literal>. With
1722 <varname>huge_pages
</varname> set to
<literal>try
</literal>, the
1723 server will try to request huge pages, but fall back to the default if
1724 that fails. With
<literal>on
</literal>, failure to request huge pages
1725 will prevent the server from starting up. With
<literal>off
</literal>,
1726 huge pages will not be requested. The actual state of huge pages is
1727 indicated by the server variable
1728 <xref linkend=
"guc-huge-pages-status"/>.
1732 At present, this setting is supported only on Linux and Windows. The
1733 setting is ignored on other systems when set to
1734 <literal>try
</literal>. On Linux, it is only supported when
1735 <varname>shared_memory_type
</varname> is set to
<literal>mmap
</literal>
1740 The use of huge pages results in smaller page tables and less CPU time
1741 spent on memory management, increasing performance. For more details about
1742 using huge pages on Linux, see
<xref linkend=
"linux-huge-pages"/>.
1746 Huge pages are known as large pages on Windows. To use them, you need to
1747 assign the user right
<quote>Lock pages in memory
</quote> to the Windows user account
1748 that runs
<productname>PostgreSQL
</productname>.
1749 You can use Windows Group Policy tool (gpedit.msc) to assign the user right
1750 <quote>Lock pages in memory
</quote>.
1751 To start the database server on the command prompt as a standalone process,
1752 not as a Windows service, the command prompt must be run as an administrator or
1753 User Access Control (UAC) must be disabled. When the UAC is enabled, the normal
1754 command prompt revokes the user right
<quote>Lock pages in memory
</quote> when started.
1758 Note that this setting only affects the main shared memory area.
1759 Operating systems such as Linux, FreeBSD, and Illumos can also use
1760 huge pages (also known as
<quote>super
</quote> pages or
1761 <quote>large
</quote> pages) automatically for normal memory
1762 allocation, without an explicit request from
1763 <productname>PostgreSQL
</productname>. On Linux, this is called
1764 <quote>transparent huge pages
</quote><indexterm><primary>transparent
1765 huge pages
</primary></indexterm> (THP). That feature has been known to
1766 cause performance degradation with
1767 <productname>PostgreSQL
</productname> for some users on some Linux
1768 versions, so its use is currently discouraged (unlike explicit use of
1769 <varname>huge_pages
</varname>).
1774 <varlistentry id=
"guc-huge-page-size" xreflabel=
"huge_page_size">
1775 <term><varname>huge_page_size
</varname> (
<type>integer
</type>)
1777 <primary><varname>huge_page_size
</varname> configuration parameter
</primary>
1782 Controls the size of huge pages, when they are enabled with
1783 <xref linkend=
"guc-huge-pages"/>.
1784 The default is zero (
<literal>0</literal>).
1785 When set to
<literal>0</literal>, the default huge page size on the
1786 system will be used. This parameter can only be set at server start.
1789 Some commonly available page sizes on modern
64 bit server architectures include:
1790 <literal>2MB
</literal> and
<literal>1GB
</literal> (Intel and AMD),
<literal>16MB
</literal> and
1791 <literal>16GB
</literal> (IBM POWER), and
<literal>64kB
</literal>,
<literal>2MB
</literal>,
1792 <literal>32MB
</literal> and
<literal>1GB
</literal> (ARM). For more information
1793 about usage and support, see
<xref linkend=
"linux-huge-pages"/>.
1796 Non-default settings are currently supported only on Linux.
1801 <varlistentry id=
"guc-temp-buffers" xreflabel=
"temp_buffers">
1802 <term><varname>temp_buffers
</varname> (
<type>integer
</type>)
1804 <primary><varname>temp_buffers
</varname> configuration parameter
</primary>
1809 Sets the maximum amount of memory used for temporary buffers within
1810 each database session. These are session-local buffers used only
1811 for access to temporary tables.
1812 If this value is specified without units, it is taken as blocks,
1813 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
1814 The default is eight megabytes (
<literal>8MB
</literal>).
1815 (If
<symbol>BLCKSZ
</symbol> is not
8kB, the default value scales
1816 proportionally to it.)
1817 This setting can be changed within individual
1818 sessions, but only before the first use of temporary tables
1819 within the session; subsequent attempts to change the value will
1820 have no effect on that session.
1824 A session will allocate temporary buffers as needed up to the limit
1825 given by
<varname>temp_buffers
</varname>. The cost of setting a large
1826 value in sessions that do not actually need many temporary
1827 buffers is only a buffer descriptor, or about
64 bytes, per
1828 increment in
<varname>temp_buffers
</varname>. However if a buffer is
1829 actually used an additional
8192 bytes will be consumed for it
1830 (or in general,
<symbol>BLCKSZ
</symbol> bytes).
1835 <varlistentry id=
"guc-max-prepared-transactions" xreflabel=
"max_prepared_transactions">
1836 <term><varname>max_prepared_transactions
</varname> (
<type>integer
</type>)
1838 <primary><varname>max_prepared_transactions
</varname> configuration parameter
</primary>
1843 Sets the maximum number of transactions that can be in the
1844 <quote>prepared
</quote> state simultaneously (see
<xref
1845 linkend=
"sql-prepare-transaction"/>).
1846 Setting this parameter to zero (which is the default)
1847 disables the prepared-transaction feature.
1848 This parameter can only be set at server start.
1852 If you are not planning to use prepared transactions, this parameter
1853 should be set to zero to prevent accidental creation of prepared
1854 transactions. If you are using prepared transactions, you will
1855 probably want
<varname>max_prepared_transactions
</varname> to be at
1856 least as large as
<xref linkend=
"guc-max-connections"/>, so that every
1857 session can have a prepared transaction pending.
1861 When running a standby server, you must set this parameter to the
1862 same or higher value than on the primary server. Otherwise, queries
1863 will not be allowed in the standby server.
1868 <varlistentry id=
"guc-work-mem" xreflabel=
"work_mem">
1869 <term><varname>work_mem
</varname> (
<type>integer
</type>)
1871 <primary><varname>work_mem
</varname> configuration parameter
</primary>
1876 Sets the base maximum amount of memory to be used by a query operation
1877 (such as a sort or hash table) before writing to temporary disk files.
1878 If this value is specified without units, it is taken as kilobytes.
1879 The default value is four megabytes (
<literal>4MB
</literal>).
1880 Note that a complex query might perform several sort and hash
1881 operations at the same time, with each operation generally being
1882 allowed to use as much memory as this value specifies before
1884 to write data into temporary files. Also, several running
1885 sessions could be doing such operations concurrently.
1886 Therefore, the total memory used could be many times the value
1887 of
<varname>work_mem
</varname>; it is necessary to keep this
1888 fact in mind when choosing the value. Sort operations are used
1889 for
<literal>ORDER BY
</literal>,
<literal>DISTINCT
</literal>,
1891 Hash tables are used in hash joins, hash-based aggregation, memoize
1892 nodes and hash-based processing of
<literal>IN
</literal> subqueries.
1895 Hash-based operations are generally more sensitive to memory
1896 availability than equivalent sort-based operations. The
1897 memory limit for a hash table is computed by multiplying
1898 <varname>work_mem
</varname> by
1899 <varname>hash_mem_multiplier
</varname>. This makes it
1900 possible for hash-based operations to use an amount of memory
1901 that exceeds the usual
<varname>work_mem
</varname> base
1907 <varlistentry id=
"guc-hash-mem-multiplier" xreflabel=
"hash_mem_multiplier">
1908 <term><varname>hash_mem_multiplier
</varname> (
<type>floating point
</type>)
1910 <primary><varname>hash_mem_multiplier
</varname> configuration parameter
</primary>
1915 Used to compute the maximum amount of memory that hash-based
1916 operations can use. The final limit is determined by
1917 multiplying
<varname>work_mem
</varname> by
1918 <varname>hash_mem_multiplier
</varname>. The default value is
1919 2.0, which makes hash-based operations use twice the usual
1920 <varname>work_mem
</varname> base amount.
1923 Consider increasing
<varname>hash_mem_multiplier
</varname> in
1924 environments where spilling by query operations is a regular
1925 occurrence, especially when simply increasing
1926 <varname>work_mem
</varname> results in memory pressure (memory
1927 pressure typically takes the form of intermittent out of
1928 memory errors). The default setting of
2.0 is often effective with
1929 mixed workloads. Higher settings in the range of
2.0 -
8.0 or
1930 more may be effective in environments where
1931 <varname>work_mem
</varname> has already been increased to
40MB
1937 <varlistentry id=
"guc-maintenance-work-mem" xreflabel=
"maintenance_work_mem">
1938 <term><varname>maintenance_work_mem
</varname> (
<type>integer
</type>)
1940 <primary><varname>maintenance_work_mem
</varname> configuration parameter
</primary>
1945 Specifies the maximum amount of memory to be used by maintenance
1946 operations, such as
<command>VACUUM
</command>,
<command>CREATE
1947 INDEX
</command>, and
<command>ALTER TABLE ADD FOREIGN KEY
</command>.
1948 If this value is specified without units, it is taken as kilobytes.
1950 to
64 megabytes (
<literal>64MB
</literal>). Since only one of these
1951 operations can be executed at a time by a database session, and
1952 an installation normally doesn't have many of them running
1953 concurrently, it's safe to set this value significantly larger
1954 than
<varname>work_mem
</varname>. Larger settings might improve
1955 performance for vacuuming and for restoring database dumps.
1958 Note that when autovacuum runs, up to
1959 <xref linkend=
"guc-autovacuum-max-workers"/> times this memory
1960 may be allocated, so be careful not to set the default value
1961 too high. It may be useful to control for this by separately
1962 setting
<xref linkend=
"guc-autovacuum-work-mem"/>.
1967 <varlistentry id=
"guc-autovacuum-work-mem" xreflabel=
"autovacuum_work_mem">
1968 <term><varname>autovacuum_work_mem
</varname> (
<type>integer
</type>)
1970 <primary><varname>autovacuum_work_mem
</varname> configuration parameter
</primary>
1975 Specifies the maximum amount of memory to be used by each
1976 autovacuum worker process.
1977 If this value is specified without units, it is taken as kilobytes.
1978 It defaults to -
1, indicating that
1979 the value of
<xref linkend=
"guc-maintenance-work-mem"/> should
1980 be used instead. The setting has no effect on the behavior of
1981 <command>VACUUM
</command> when run in other contexts.
1982 This parameter can only be set in the
1983 <filename>postgresql.conf
</filename> file or on the server command
1989 <varlistentry id=
"guc-vacuum-buffer-usage-limit" xreflabel=
"vacuum_buffer_usage_limit">
1991 <varname>vacuum_buffer_usage_limit
</varname> (
<type>integer
</type>)
1993 <primary><varname>vacuum_buffer_usage_limit
</varname> configuration parameter
</primary>
1998 Specifies the size of the
1999 <glossterm linkend=
"glossary-buffer-access-strategy">Buffer Access Strategy
</glossterm>
2000 used by the
<command>VACUUM
</command> and
<command>ANALYZE
</command>
2001 commands. A setting of
<literal>0</literal> will allow the operation
2002 to use any number of
<varname>shared_buffers
</varname>. Otherwise
2003 valid sizes range from
<literal>128 kB
</literal> to
2004 <literal>16 GB
</literal>. If the specified size would exceed
1/
8 the
2005 size of
<varname>shared_buffers
</varname>, the size is silently capped
2006 to that value. The default value is
<literal>2MB
</literal>. If
2007 this value is specified without units, it is taken as kilobytes. This
2008 parameter can be set at any time. It can be overridden for
2009 <xref linkend=
"sql-vacuum"/> and
<xref linkend=
"sql-analyze"/>
2010 when passing the
<option>BUFFER_USAGE_LIMIT
</option> option. Higher
2011 settings can allow
<command>VACUUM
</command> and
2012 <command>ANALYZE
</command> to run more quickly, but having too large a
2013 setting may cause too many other useful pages to be evicted from
2019 <varlistentry id=
"guc-logical-decoding-work-mem" xreflabel=
"logical_decoding_work_mem">
2020 <term><varname>logical_decoding_work_mem
</varname> (
<type>integer
</type>)
2022 <primary><varname>logical_decoding_work_mem
</varname> configuration parameter
</primary>
2027 Specifies the maximum amount of memory to be used by logical decoding,
2028 before some of the decoded changes are written to local disk. This
2029 limits the amount of memory used by logical streaming replication
2030 connections. It defaults to
64 megabytes (
<literal>64MB
</literal>).
2031 Since each replication connection only uses a single buffer of this size,
2032 and an installation normally doesn't have many such connections
2033 concurrently (as limited by
<varname>max_wal_senders
</varname>), it's
2034 safe to set this value significantly higher than
<varname>work_mem
</varname>,
2035 reducing the amount of decoded changes written to disk.
2040 <varlistentry id=
"guc-commit-timestamp-buffers" xreflabel=
"commit_timestamp_buffers">
2041 <term><varname>commit_timestamp_buffers
</varname> (
<type>integer
</type>)
2043 <primary><varname>commit_timestamp_buffers
</varname> configuration parameter
</primary>
2048 Specifies the amount of memory to use to cache the contents of
2049 <literal>pg_commit_ts
</literal> (see
2050 <xref linkend=
"pgdata-contents-table"/>).
2051 If this value is specified without units, it is taken as blocks,
2052 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2053 The default value is
<literal>0</literal>, which requests
2054 <varname>shared_buffers
</varname>/
512 up to
1024 blocks,
2055 but not fewer than
16 blocks.
2056 This parameter can only be set at server start.
2061 <varlistentry id=
"guc-multixact-member-buffers" xreflabel=
"multixact_member_buffers">
2062 <term><varname>multixact_member_buffers
</varname> (
<type>integer
</type>)
2064 <primary><varname>multixact_member_buffers
</varname> configuration parameter
</primary>
2069 Specifies the amount of shared memory to use to cache the contents
2070 of
<literal>pg_multixact/members
</literal> (see
2071 <xref linkend=
"pgdata-contents-table"/>).
2072 If this value is specified without units, it is taken as blocks,
2073 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2074 The default value is
<literal>32</literal>.
2075 This parameter can only be set at server start.
2080 <varlistentry id=
"guc-multixact-offset-buffers" xreflabel=
"multixact_offset_buffers">
2081 <term><varname>multixact_offset_buffers
</varname> (
<type>integer
</type>)
2083 <primary><varname>multixact_offset_buffers
</varname> configuration parameter
</primary>
2088 Specifies the amount of shared memory to use to cache the contents
2089 of
<literal>pg_multixact/offsets
</literal> (see
2090 <xref linkend=
"pgdata-contents-table"/>).
2091 If this value is specified without units, it is taken as blocks,
2092 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2093 The default value is
<literal>16</literal>.
2094 This parameter can only be set at server start.
2099 <varlistentry id=
"guc-notify-buffers" xreflabel=
"notify_buffers">
2100 <term><varname>notify_buffers
</varname> (
<type>integer
</type>)
2102 <primary><varname>notify_buffers
</varname> configuration parameter
</primary>
2107 Specifies the amount of shared memory to use to cache the contents
2108 of
<literal>pg_notify
</literal> (see
2109 <xref linkend=
"pgdata-contents-table"/>).
2110 If this value is specified without units, it is taken as blocks,
2111 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2112 The default value is
<literal>16</literal>.
2113 This parameter can only be set at server start.
2118 <varlistentry id=
"guc-serializable-buffers" xreflabel=
"serializable_buffers">
2119 <term><varname>serializable_buffers
</varname> (
<type>integer
</type>)
2121 <primary><varname>serializable_buffers
</varname> configuration parameter
</primary>
2126 Specifies the amount of shared memory to use to cache the contents
2127 of
<literal>pg_serial
</literal> (see
2128 <xref linkend=
"pgdata-contents-table"/>).
2129 If this value is specified without units, it is taken as blocks,
2130 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2131 The default value is
<literal>32</literal>.
2132 This parameter can only be set at server start.
2137 <varlistentry id=
"guc-subtransaction-buffers" xreflabel=
"subtransaction_buffers">
2138 <term><varname>subtransaction_buffers
</varname> (
<type>integer
</type>)
2140 <primary><varname>subtransaction_buffers
</varname> configuration parameter
</primary>
2145 Specifies the amount of shared memory to use to cache the contents
2146 of
<literal>pg_subtrans
</literal> (see
2147 <xref linkend=
"pgdata-contents-table"/>).
2148 If this value is specified without units, it is taken as blocks,
2149 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2150 The default value is
<literal>0</literal>, which requests
2151 <varname>shared_buffers
</varname>/
512 up to
1024 blocks,
2152 but not fewer than
16 blocks.
2153 This parameter can only be set at server start.
2158 <varlistentry id=
"guc-transaction-buffers" xreflabel=
"transaction_buffers">
2159 <term><varname>transaction_buffers
</varname> (
<type>integer
</type>)
2161 <primary><varname>transaction_buffers
</varname> configuration parameter
</primary>
2166 Specifies the amount of shared memory to use to cache the contents
2167 of
<literal>pg_xact
</literal> (see
2168 <xref linkend=
"pgdata-contents-table"/>).
2169 If this value is specified without units, it is taken as blocks,
2170 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2171 The default value is
<literal>0</literal>, which requests
2172 <varname>shared_buffers
</varname>/
512 up to
1024 blocks,
2173 but not fewer than
16 blocks.
2174 This parameter can only be set at server start.
2179 <varlistentry id=
"guc-max-stack-depth" xreflabel=
"max_stack_depth">
2180 <term><varname>max_stack_depth
</varname> (
<type>integer
</type>)
2182 <primary><varname>max_stack_depth
</varname> configuration parameter
</primary>
2187 Specifies the maximum safe depth of the server's execution stack.
2188 The ideal setting for this parameter is the actual stack size limit
2189 enforced by the kernel (as set by
<literal>ulimit -s
</literal> or local
2190 equivalent), less a safety margin of a megabyte or so. The safety
2191 margin is needed because the stack depth is not checked in every
2192 routine in the server, but only in key potentially-recursive routines.
2193 If this value is specified without units, it is taken as kilobytes.
2194 The default setting is two megabytes (
<literal>2MB
</literal>), which
2195 is conservatively small and unlikely to risk crashes. However,
2196 it might be too small to allow execution of complex functions.
2197 Only superusers and users with the appropriate
<literal>SET
</literal>
2198 privilege can change this setting.
2202 Setting
<varname>max_stack_depth
</varname> higher than
2203 the actual kernel limit will mean that a runaway recursive function
2204 can crash an individual backend process. On platforms where
2205 <productname>PostgreSQL
</productname> can determine the kernel limit,
2206 the server will not allow this variable to be set to an unsafe
2207 value. However, not all platforms provide the information,
2208 so caution is recommended in selecting a value.
2213 <varlistentry id=
"guc-shared-memory-type" xreflabel=
"shared_memory_type">
2214 <term><varname>shared_memory_type
</varname> (
<type>enum
</type>)
2216 <primary><varname>shared_memory_type
</varname> configuration parameter
</primary>
2221 Specifies the shared memory implementation that the server
2222 should use for the main shared memory region that holds
2223 <productname>PostgreSQL
</productname>'s shared buffers and other
2224 shared data. Possible values are
<literal>mmap
</literal> (for
2225 anonymous shared memory allocated using
<function>mmap
</function>),
2226 <literal>sysv
</literal> (for System V shared memory allocated via
2227 <function>shmget
</function>) and
<literal>windows
</literal> (for Windows
2228 shared memory). Not all values are supported on all platforms; the
2229 first supported option is the default for that platform. The use of
2230 the
<literal>sysv
</literal> option, which is not the default on any
2231 platform, is generally discouraged because it typically requires
2232 non-default kernel settings to allow for large allocations (see
<xref
2233 linkend=
"sysvipc"/>).
2238 <varlistentry id=
"guc-dynamic-shared-memory-type" xreflabel=
"dynamic_shared_memory_type">
2239 <term><varname>dynamic_shared_memory_type
</varname> (
<type>enum
</type>)
2241 <primary><varname>dynamic_shared_memory_type
</varname> configuration parameter
</primary>
2246 Specifies the dynamic shared memory implementation that the server
2247 should use. Possible values are
<literal>posix
</literal> (for POSIX shared
2248 memory allocated using
<literal>shm_open
</literal>),
<literal>sysv
</literal>
2249 (for System V shared memory allocated via
<literal>shmget
</literal>),
2250 <literal>windows
</literal> (for Windows shared memory),
2251 and
<literal>mmap
</literal> (to simulate shared memory using
2252 memory-mapped files stored in the data directory).
2253 Not all values are supported on all platforms; the first supported
2254 option is usually the default for that platform. The use of the
2255 <literal>mmap
</literal> option, which is not the default on any platform,
2256 is generally discouraged because the operating system may write
2257 modified pages back to disk repeatedly, increasing system I/O load;
2258 however, it may be useful for debugging, when the
2259 <literal>pg_dynshmem
</literal> directory is stored on a RAM disk, or when
2260 other shared memory facilities are not available.
2265 <varlistentry id=
"guc-min-dynamic-shared-memory" xreflabel=
"min_dynamic_shared_memory">
2266 <term><varname>min_dynamic_shared_memory
</varname> (
<type>integer
</type>)
2268 <primary><varname>min_dynamic_shared_memory
</varname> configuration parameter
</primary>
2273 Specifies the amount of memory that should be allocated at server
2274 startup for use by parallel queries. When this memory region is
2275 insufficient or exhausted by concurrent queries, new parallel queries
2276 try to allocate extra shared memory temporarily from the operating
2277 system using the method configured with
2278 <varname>dynamic_shared_memory_type
</varname>, which may be slower due
2279 to memory management overheads. Memory that is allocated at startup
2280 with
<varname>min_dynamic_shared_memory
</varname> is affected by
2281 the
<varname>huge_pages
</varname> setting on operating systems where
2282 that is supported, and may be more likely to benefit from larger pages
2283 on operating systems where that is managed automatically.
2284 The default value is
<literal>0</literal> (none). This parameter can
2285 only be set at server start.
2293 <sect2 id=
"runtime-config-resource-disk">
2297 <varlistentry id=
"guc-temp-file-limit" xreflabel=
"temp_file_limit">
2298 <term><varname>temp_file_limit
</varname> (
<type>integer
</type>)
2300 <primary><varname>temp_file_limit
</varname> configuration parameter
</primary>
2305 Specifies the maximum amount of disk space that a process can use
2306 for temporary files, such as sort and hash temporary files, or the
2307 storage file for a held cursor. A transaction attempting to exceed
2308 this limit will be canceled.
2309 If this value is specified without units, it is taken as kilobytes.
2310 <literal>-
1</literal> (the default) means no limit.
2311 Only superusers and users with the appropriate
<literal>SET
</literal>
2312 privilege can change this setting.
2315 This setting constrains the total space used at any instant by all
2316 temporary files used by a given
<productname>PostgreSQL
</productname> process.
2317 It should be noted that disk space used for explicit temporary
2318 tables, as opposed to temporary files used behind-the-scenes in query
2319 execution, does
<emphasis>not
</emphasis> count against this limit.
2324 <varlistentry id=
"guc-max-notify-queue-pages" xreflabel=
"max_notify_queue_pages">
2325 <term><varname>max_notify_queue_pages
</varname> (
<type>integer
</type>)
2327 <primary><varname>max_notify_queue_pages
</varname> configuration parameter
</primary>
2332 Specifies the maximum amount of allocated pages for
2333 <xref linkend=
"sql-notify"/> /
<xref linkend=
"sql-listen"/> queue.
2334 The default value is
1048576. For
8 KB pages it allows to consume
2335 up to
8 GB of disk space.
2343 <sect2 id=
"runtime-config-resource-kernel">
2344 <title>Kernel Resource Usage
</title>
2347 <varlistentry id=
"guc-max-files-per-process" xreflabel=
"max_files_per_process">
2348 <term><varname>max_files_per_process
</varname> (
<type>integer
</type>)
2350 <primary><varname>max_files_per_process
</varname> configuration parameter
</primary>
2355 Sets the maximum number of simultaneously open files allowed to each
2356 server subprocess. The default is one thousand files. If the kernel is enforcing
2357 a safe per-process limit, you don't need to worry about this setting.
2358 But on some platforms (notably, most BSD systems), the kernel will
2359 allow individual processes to open many more files than the system
2360 can actually support if many processes all try to open
2361 that many files. If you find yourself seeing
<quote>Too many open
2362 files
</quote> failures, try reducing this setting.
2363 This parameter can only be set at server start.
2371 <sect2 id=
"runtime-config-resource-background-writer">
2372 <title>Background Writer
</title>
2375 There is a separate server
2376 process called the
<firstterm>background writer
</firstterm>, whose function
2377 is to issue writes of
<quote>dirty
</quote> (new or modified) shared
2378 buffers. When the number of clean shared buffers appears to be
2379 insufficient, the background writer writes some dirty buffers to the
2380 file system and marks them as clean. This reduces the likelihood
2381 that server processes handling user queries will be unable to find
2382 clean buffers and have to write dirty buffers themselves.
2383 However, the background writer does cause a net overall
2384 increase in I/O load, because while a repeatedly-dirtied page might
2385 otherwise be written only once per checkpoint interval, the
2386 background writer might write it several times as it is dirtied
2387 in the same interval. The parameters discussed in this subsection
2388 can be used to tune the behavior for local needs.
2392 <varlistentry id=
"guc-bgwriter-delay" xreflabel=
"bgwriter_delay">
2393 <term><varname>bgwriter_delay
</varname> (
<type>integer
</type>)
2395 <primary><varname>bgwriter_delay
</varname> configuration parameter
</primary>
2400 Specifies the delay between activity rounds for the
2401 background writer. In each round the writer issues writes
2402 for some number of dirty buffers (controllable by the
2403 following parameters). It then sleeps for
2404 the length of
<varname>bgwriter_delay
</varname>, and repeats.
2405 When there are no dirty buffers in the
2406 buffer pool, though, it goes into a longer sleep regardless of
2407 <varname>bgwriter_delay
</varname>.
2408 If this value is specified without units, it is taken as milliseconds.
2409 The default value is
200
2410 milliseconds (
<literal>200ms
</literal>). Note that on some systems, the
2411 effective resolution of sleep delays is
10 milliseconds; setting
2412 <varname>bgwriter_delay
</varname> to a value that is not a multiple of
10
2413 might have the same results as setting it to the next higher multiple
2414 of
10. This parameter can only be set in the
2415 <filename>postgresql.conf
</filename> file or on the server command line.
2420 <varlistentry id=
"guc-bgwriter-lru-maxpages" xreflabel=
"bgwriter_lru_maxpages">
2421 <term><varname>bgwriter_lru_maxpages
</varname> (
<type>integer
</type>)
2423 <primary><varname>bgwriter_lru_maxpages
</varname> configuration parameter
</primary>
2428 In each round, no more than this many buffers will be written
2429 by the background writer. Setting this to zero disables
2430 background writing. (Note that checkpoints, which are managed by
2431 a separate, dedicated auxiliary process, are unaffected.)
2432 The default value is
100 buffers.
2433 This parameter can only be set in the
<filename>postgresql.conf
</filename>
2434 file or on the server command line.
2439 <varlistentry id=
"guc-bgwriter-lru-multiplier" xreflabel=
"bgwriter_lru_multiplier">
2440 <term><varname>bgwriter_lru_multiplier
</varname> (
<type>floating point
</type>)
2442 <primary><varname>bgwriter_lru_multiplier
</varname> configuration parameter
</primary>
2447 The number of dirty buffers written in each round is based on the
2448 number of new buffers that have been needed by server processes
2449 during recent rounds. The average recent need is multiplied by
2450 <varname>bgwriter_lru_multiplier
</varname> to arrive at an estimate of the
2451 number of buffers that will be needed during the next round. Dirty
2452 buffers are written until there are that many clean, reusable buffers
2453 available. (However, no more than
<varname>bgwriter_lru_maxpages
</varname>
2454 buffers will be written per round.)
2455 Thus, a setting of
1.0 represents a
<quote>just in time
</quote> policy
2456 of writing exactly the number of buffers predicted to be needed.
2457 Larger values provide some cushion against spikes in demand,
2458 while smaller values intentionally leave writes to be done by
2461 This parameter can only be set in the
<filename>postgresql.conf
</filename>
2462 file or on the server command line.
2467 <varlistentry id=
"guc-bgwriter-flush-after" xreflabel=
"bgwriter_flush_after">
2468 <term><varname>bgwriter_flush_after
</varname> (
<type>integer
</type>)
2470 <primary><varname>bgwriter_flush_after
</varname> configuration parameter
</primary>
2475 Whenever more than this amount of data has
2476 been written by the background writer, attempt to force the OS to issue these
2477 writes to the underlying storage. Doing so will limit the amount of
2478 dirty data in the kernel's page cache, reducing the likelihood of
2479 stalls when an
<function>fsync
</function> is issued at the end of a checkpoint, or when
2480 the OS writes data back in larger batches in the background. Often
2481 that will result in greatly reduced transaction latency, but there
2482 also are some cases, especially with workloads that are bigger than
2483 <xref linkend=
"guc-shared-buffers"/>, but smaller than the OS's page
2484 cache, where performance might degrade. This setting may have no
2485 effect on some platforms.
2486 If this value is specified without units, it is taken as blocks,
2487 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2488 The valid range is between
2489 <literal>0</literal>, which disables forced writeback, and
2490 <literal>2MB
</literal>. The default is
<literal>512kB
</literal> on Linux,
2491 <literal>0</literal> elsewhere. (If
<symbol>BLCKSZ
</symbol> is not
8kB,
2492 the default and maximum values scale proportionally to it.)
2493 This parameter can only be set in the
<filename>postgresql.conf
</filename>
2494 file or on the server command line.
2501 Smaller values of
<varname>bgwriter_lru_maxpages
</varname> and
2502 <varname>bgwriter_lru_multiplier
</varname> reduce the extra I/O load
2503 caused by the background writer, but make it more likely that server
2504 processes will have to issue writes for themselves, delaying interactive
2509 <sect2 id=
"runtime-config-resource-async-behavior">
2510 <title>Asynchronous Behavior
</title>
2513 <varlistentry id=
"guc-backend-flush-after" xreflabel=
"backend_flush_after">
2514 <term><varname>backend_flush_after
</varname> (
<type>integer
</type>)
2516 <primary><varname>backend_flush_after
</varname> configuration parameter
</primary>
2521 Whenever more than this amount of data has
2522 been written by a single backend, attempt to force the OS to issue
2523 these writes to the underlying storage. Doing so will limit the
2524 amount of dirty data in the kernel's page cache, reducing the
2525 likelihood of stalls when an
<function>fsync
</function> is issued at the end of a
2526 checkpoint, or when the OS writes data back in larger batches in the
2527 background. Often that will result in greatly reduced transaction
2528 latency, but there also are some cases, especially with workloads
2529 that are bigger than
<xref linkend=
"guc-shared-buffers"/>, but smaller
2530 than the OS's page cache, where performance might degrade. This
2531 setting may have no effect on some platforms.
2532 If this value is specified without units, it is taken as blocks,
2533 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
2535 between
<literal>0</literal>, which disables forced writeback,
2536 and
<literal>2MB
</literal>. The default is
<literal>0</literal>, i.e., no
2537 forced writeback. (If
<symbol>BLCKSZ
</symbol> is not
8kB,
2538 the maximum value scales proportionally to it.)
2543 <varlistentry id=
"guc-effective-io-concurrency" xreflabel=
"effective_io_concurrency">
2544 <term><varname>effective_io_concurrency
</varname> (
<type>integer
</type>)
2546 <primary><varname>effective_io_concurrency
</varname> configuration parameter
</primary>
2551 Sets the number of concurrent disk I/O operations that
2552 <productname>PostgreSQL
</productname> expects can be executed
2553 simultaneously. Raising this value will increase the number of I/O
2554 operations that any individual
<productname>PostgreSQL
</productname> session
2555 attempts to initiate in parallel. The allowed range is
1 to
1000,
2556 or zero to disable issuance of asynchronous I/O requests. Currently,
2557 this setting only affects bitmap heap scans.
2561 For magnetic drives, a good starting point for this setting is the
2563 drives comprising a RAID
0 stripe or RAID
1 mirror being used for the
2564 database. (For RAID
5 the parity drive should not be counted.)
2565 However, if the database is often busy with multiple queries issued in
2566 concurrent sessions, lower values may be sufficient to keep the disk
2567 array busy. A value higher than needed to keep the disks busy will
2568 only result in extra CPU overhead.
2569 SSDs and other memory-based storage can often process many
2570 concurrent requests, so the best value might be in the hundreds.
2574 Asynchronous I/O requires that the operating system supports issuing
2575 read-ahead advice. If there is no operating system support then
2576 setting this parameter to anything but zero will result in an error.
2580 The default is
1 on supported systems, otherwise
0. This value can
2581 be overridden for tables in a particular tablespace by setting the
2582 tablespace parameter of the same name (see
2583 <xref linkend=
"sql-altertablespace"/>).
2588 <varlistentry id=
"guc-maintenance-io-concurrency" xreflabel=
"maintenance_io_concurrency">
2589 <term><varname>maintenance_io_concurrency
</varname> (
<type>integer
</type>)
2591 <primary><varname>maintenance_io_concurrency
</varname> configuration parameter
</primary>
2596 Similar to
<varname>effective_io_concurrency
</varname>, but used
2597 for maintenance work that is done on behalf of many client sessions.
2600 The default is
10 on supported systems, otherwise
0. This value can
2601 be overridden for tables in a particular tablespace by setting the
2602 tablespace parameter of the same name (see
2603 <xref linkend=
"sql-altertablespace"/>).
2608 <varlistentry id=
"guc-io-combine-limit" xreflabel=
"io_combine_limit">
2609 <term><varname>io_combine_limit
</varname> (
<type>integer
</type>)
2611 <primary><varname>io_combine_limit
</varname> configuration parameter
</primary>
2616 Controls the largest I/O size in operations that combine I/O.
2617 The default is
128kB.
2622 <varlistentry id=
"guc-max-worker-processes" xreflabel=
"max_worker_processes">
2623 <term><varname>max_worker_processes
</varname> (
<type>integer
</type>)
2625 <primary><varname>max_worker_processes
</varname> configuration parameter
</primary>
2630 Sets the maximum number of background processes that the cluster
2631 can support. This parameter can only be set at server start. The
2636 When running a standby server, you must set this parameter to the
2637 same or higher value than on the primary server. Otherwise, queries
2638 will not be allowed in the standby server.
2642 When changing this value, consider also adjusting
2643 <xref linkend=
"guc-max-parallel-workers"/>,
2644 <xref linkend=
"guc-max-parallel-maintenance-workers"/>, and
2645 <xref linkend=
"guc-max-parallel-workers-per-gather"/>.
2650 <varlistentry id=
"guc-max-parallel-workers-per-gather" xreflabel=
"max_parallel_workers_per_gather">
2651 <term><varname>max_parallel_workers_per_gather
</varname> (
<type>integer
</type>)
2653 <primary><varname>max_parallel_workers_per_gather
</varname> configuration parameter
</primary>
2658 Sets the maximum number of workers that can be started by a single
2659 <literal>Gather
</literal> or
<literal>Gather Merge
</literal> node.
2660 Parallel workers are taken from the pool of processes established by
2661 <xref linkend=
"guc-max-worker-processes"/>, limited by
2662 <xref linkend=
"guc-max-parallel-workers"/>. Note that the requested
2663 number of workers may not actually be available at run time. If this
2664 occurs, the plan will run with fewer workers than expected, which may
2665 be inefficient. The default value is
2. Setting this value to
0
2666 disables parallel query execution.
2670 Note that parallel queries may consume very substantially more
2671 resources than non-parallel queries, because each worker process is
2672 a completely separate process which has roughly the same impact on the
2673 system as an additional user session. This should be taken into
2674 account when choosing a value for this setting, as well as when
2675 configuring other settings that control resource utilization, such
2676 as
<xref linkend=
"guc-work-mem"/>. Resource limits such as
2677 <varname>work_mem
</varname> are applied individually to each worker,
2678 which means the total utilization may be much higher across all
2679 processes than it would normally be for any single process.
2680 For example, a parallel query using
4 workers may use up to
5 times
2681 as much CPU time, memory, I/O bandwidth, and so forth as a query which
2682 uses no workers at all.
2686 For more information on parallel query, see
2687 <xref linkend=
"parallel-query"/>.
2692 <varlistentry id=
"guc-max-parallel-maintenance-workers" xreflabel=
"max_parallel_maintenance_workers">
2693 <term><varname>max_parallel_maintenance_workers
</varname> (
<type>integer
</type>)
2695 <primary><varname>max_parallel_maintenance_workers
</varname> configuration parameter
</primary>
2700 Sets the maximum number of parallel workers that can be
2701 started by a single utility command. Currently, the parallel
2702 utility commands that support the use of parallel workers are
2703 <command>CREATE INDEX
</command> when building a B-tree or BRIN index,
2704 and
<command>VACUUM
</command> without
<literal>FULL
</literal>
2705 option. Parallel workers are taken from the pool of processes
2706 established by
<xref linkend=
"guc-max-worker-processes"/>, limited
2707 by
<xref linkend=
"guc-max-parallel-workers"/>. Note that the requested
2708 number of workers may not actually be available at run time.
2709 If this occurs, the utility operation will run with fewer
2710 workers than expected. The default value is
2. Setting this
2711 value to
0 disables the use of parallel workers by utility
2716 Note that parallel utility commands should not consume
2717 substantially more memory than equivalent non-parallel
2718 operations. This strategy differs from that of parallel
2719 query, where resource limits generally apply per worker
2720 process. Parallel utility commands treat the resource limit
2721 <varname>maintenance_work_mem
</varname> as a limit to be applied to
2722 the entire utility command, regardless of the number of
2723 parallel worker processes. However, parallel utility
2724 commands may still consume substantially more CPU resources
2730 <varlistentry id=
"guc-max-parallel-workers" xreflabel=
"max_parallel_workers">
2731 <term><varname>max_parallel_workers
</varname> (
<type>integer
</type>)
2733 <primary><varname>max_parallel_workers
</varname> configuration parameter
</primary>
2738 Sets the maximum number of workers that the cluster can support for
2739 parallel operations. The default value is
8. When increasing or
2740 decreasing this value, consider also adjusting
2741 <xref linkend=
"guc-max-parallel-maintenance-workers"/> and
2742 <xref linkend=
"guc-max-parallel-workers-per-gather"/>.
2743 Also, note that a setting for this value which is higher than
2744 <xref linkend=
"guc-max-worker-processes"/> will have no effect,
2745 since parallel workers are taken from the pool of worker processes
2746 established by that setting.
2751 <varlistentry id=
"guc-parallel-leader-participation" xreflabel=
"parallel_leader_participation">
2753 <varname>parallel_leader_participation
</varname> (
<type>boolean
</type>)
2755 <primary><varname>parallel_leader_participation
</varname> configuration parameter
</primary>
2760 Allows the leader process to execute the query plan under
2761 <literal>Gather
</literal> and
<literal>Gather Merge
</literal> nodes
2762 instead of waiting for worker processes. The default is
2763 <literal>on
</literal>. Setting this value to
<literal>off
</literal>
2764 reduces the likelihood that workers will become blocked because the
2765 leader is not reading tuples fast enough, but requires the leader
2766 process to wait for worker processes to start up before the first
2767 tuples can be produced. The degree to which the leader can help or
2768 hinder performance depends on the plan type, number of workers and
2777 <sect1 id=
"runtime-config-wal">
2778 <title>Write Ahead Log
</title>
2781 For additional information on tuning these settings,
2782 see
<xref linkend=
"wal-configuration"/>.
2785 <sect2 id=
"runtime-config-wal-settings">
2786 <title>Settings
</title>
2789 <varlistentry id=
"guc-wal-level" xreflabel=
"wal_level">
2790 <term><varname>wal_level
</varname> (
<type>enum
</type>)
2792 <primary><varname>wal_level
</varname> configuration parameter
</primary>
2797 <varname>wal_level
</varname> determines how much information is written to
2798 the WAL. The default value is
<literal>replica
</literal>, which writes enough
2799 data to support WAL archiving and replication, including running
2800 read-only queries on a standby server.
<literal>minimal
</literal> removes all
2801 logging except the information required to recover from a crash or
2802 immediate shutdown. Finally,
2803 <literal>logical
</literal> adds information necessary to support logical
2804 decoding. Each level includes the information logged at all lower
2805 levels. This parameter can only be set at server start.
2808 The
<literal>minimal
</literal> level generates the least WAL
2809 volume. It logs no row information for permanent relations
2810 in transactions that create or
2811 rewrite them. This can make operations much faster (see
2812 <xref linkend=
"populate-pitr"/>). Operations that initiate this
2813 optimization include:
2815 <member><command>ALTER ... SET TABLESPACE
</command></member>
2816 <member><command>CLUSTER
</command></member>
2817 <member><command>CREATE TABLE
</command></member>
2818 <member><command>REFRESH MATERIALIZED VIEW
</command>
2819 (without
<option>CONCURRENTLY
</option>)
</member>
2820 <member><command>REINDEX
</command></member>
2821 <member><command>TRUNCATE
</command></member>
2823 However, minimal WAL does not contain sufficient information for
2824 point-in-time recovery, so
<literal>replica
</literal> or
2825 higher must be used to enable continuous archiving
2826 (
<xref linkend=
"guc-archive-mode"/>) and streaming binary replication.
2827 In fact, the server will not even start in this mode if
2828 <varname>max_wal_senders
</varname> is non-zero.
2829 Note that changing
<varname>wal_level
</varname> to
2830 <literal>minimal
</literal> makes previous base backups unusable
2831 for point-in-time recovery and standby servers.
2834 In
<literal>logical
</literal> level, the same information is logged as
2835 with
<literal>replica
</literal>, plus information needed to
2836 extract logical change sets from the WAL. Using a level of
2837 <literal>logical
</literal> will increase the WAL volume, particularly if many
2838 tables are configured for
<literal>REPLICA IDENTITY FULL
</literal> and
2839 many
<command>UPDATE
</command> and
<command>DELETE
</command> statements are
2843 In releases prior to
9.6, this parameter also allowed the
2844 values
<literal>archive
</literal> and
<literal>hot_standby
</literal>.
2845 These are still accepted but mapped to
<literal>replica
</literal>.
2850 <varlistentry id=
"guc-fsync" xreflabel=
"fsync">
2851 <term><varname>fsync
</varname> (
<type>boolean
</type>)
2853 <primary><varname>fsync
</varname> configuration parameter
</primary>
2858 If this parameter is on, the
<productname>PostgreSQL
</productname> server
2859 will try to make sure that updates are physically written to
2860 disk, by issuing
<function>fsync()
</function> system calls or various
2861 equivalent methods (see
<xref linkend=
"guc-wal-sync-method"/>).
2862 This ensures that the database cluster can recover to a
2863 consistent state after an operating system or hardware crash.
2867 While turning off
<varname>fsync
</varname> is often a performance
2868 benefit, this can result in unrecoverable data corruption in
2869 the event of a power failure or system crash. Thus it
2870 is only advisable to turn off
<varname>fsync
</varname> if
2871 you can easily recreate your entire database from external
2876 Examples of safe circumstances for turning off
2877 <varname>fsync
</varname> include the initial loading of a new
2878 database cluster from a backup file, using a database cluster
2879 for processing a batch of data after which the database
2880 will be thrown away and recreated,
2881 or for a read-only database clone which
2882 gets recreated frequently and is not used for failover. High
2883 quality hardware alone is not a sufficient justification for
2884 turning off
<varname>fsync
</varname>.
2888 For reliable recovery when changing
<varname>fsync
</varname>
2889 off to on, it is necessary to force all modified buffers in the
2890 kernel to durable storage. This can be done while the cluster
2891 is shutdown or while
<varname>fsync
</varname> is on by running
<command>initdb
2892 --sync-only
</command>, running
<command>sync
</command>, unmounting the
2893 file system, or rebooting the server.
2897 In many situations, turning off
<xref linkend=
"guc-synchronous-commit"/>
2898 for noncritical transactions can provide much of the potential
2899 performance benefit of turning off
<varname>fsync
</varname>, without
2900 the attendant risks of data corruption.
2904 <varname>fsync
</varname> can only be set in the
<filename>postgresql.conf
</filename>
2905 file or on the server command line.
2906 If you turn this parameter off, also consider turning off
2907 <xref linkend=
"guc-full-page-writes"/>.
2912 <varlistentry id=
"guc-synchronous-commit" xreflabel=
"synchronous_commit">
2913 <term><varname>synchronous_commit
</varname> (
<type>enum
</type>)
2915 <primary><varname>synchronous_commit
</varname> configuration parameter
</primary>
2920 Specifies how much WAL processing must complete before
2921 the database server returns a
<quote>success
</quote>
2922 indication to the client. Valid values are
2923 <literal>remote_apply
</literal>,
<literal>on
</literal>
2924 (the default),
<literal>remote_write
</literal>,
2925 <literal>local
</literal>, and
<literal>off
</literal>.
2929 If
<varname>synchronous_standby_names
</varname> is empty,
2930 the only meaningful settings are
<literal>on
</literal> and
2931 <literal>off
</literal>;
<literal>remote_apply
</literal>,
2932 <literal>remote_write
</literal> and
<literal>local
</literal>
2933 all provide the same local synchronization level
2934 as
<literal>on
</literal>. The local behavior of all
2935 non-
<literal>off
</literal> modes is to wait for local flush of WAL
2936 to disk. In
<literal>off
</literal> mode, there is no waiting,
2937 so there can be a delay between when success is reported to the
2938 client and when the transaction is later guaranteed to be safe
2939 against a server crash. (The maximum
2940 delay is three times
<xref linkend=
"guc-wal-writer-delay"/>.) Unlike
2941 <xref linkend=
"guc-fsync"/>, setting this parameter to
<literal>off
</literal>
2942 does not create any risk of database inconsistency: an operating
2943 system or database crash might
2944 result in some recent allegedly-committed transactions being lost, but
2945 the database state will be just the same as if those transactions had
2946 been aborted cleanly. So, turning
<varname>synchronous_commit
</varname> off
2947 can be a useful alternative when performance is more important than
2948 exact certainty about the durability of a transaction. For more
2949 discussion see
<xref linkend=
"wal-async-commit"/>.
2953 If
<xref linkend=
"guc-synchronous-standby-names"/> is non-empty,
2954 <varname>synchronous_commit
</varname> also controls whether
2955 transaction commits will wait for their WAL records to be
2956 processed on the standby server(s).
2960 When set to
<literal>remote_apply
</literal>, commits will wait
2961 until replies from the current synchronous standby(s) indicate they
2962 have received the commit record of the transaction and applied
2963 it, so that it has become visible to queries on the standby(s),
2964 and also written to durable storage on the standbys. This will
2965 cause much larger commit delays than previous settings since
2966 it waits for WAL replay. When set to
<literal>on
</literal>,
2967 commits wait until replies
2968 from the current synchronous standby(s) indicate they have received
2969 the commit record of the transaction and flushed it to durable storage. This
2970 ensures the transaction will not be lost unless both the primary and
2971 all synchronous standbys suffer corruption of their database storage.
2972 When set to
<literal>remote_write
</literal>, commits will wait until replies
2973 from the current synchronous standby(s) indicate they have
2974 received the commit record of the transaction and written it to
2975 their file systems. This setting ensures data preservation if a standby instance of
2976 <productname>PostgreSQL
</productname> crashes, but not if the standby
2977 suffers an operating-system-level crash because the data has not
2978 necessarily reached durable storage on the standby.
2979 The setting
<literal>local
</literal> causes commits to wait for
2980 local flush to disk, but not for replication. This is usually not
2981 desirable when synchronous replication is in use, but is provided for
2986 This parameter can be changed at any time; the behavior for any
2987 one transaction is determined by the setting in effect when it
2988 commits. It is therefore possible, and useful, to have some
2989 transactions commit synchronously and others asynchronously.
2990 For example, to make a single multistatement transaction commit
2991 asynchronously when the default is the opposite, issue
<command>SET
2992 LOCAL synchronous_commit TO OFF
</command> within the transaction.
2996 <xref linkend=
"synchronous-commit-matrix"/> summarizes the
2997 capabilities of the
<varname>synchronous_commit
</varname> settings.
3000 <table id=
"synchronous-commit-matrix">
3001 <title>synchronous_commit Modes
</title>
3003 <colspec colname=
"col1" colwidth=
"1.5*"/>
3004 <colspec colname=
"col2" colwidth=
"1*"/>
3005 <colspec colname=
"col3" colwidth=
"1*"/>
3006 <colspec colname=
"col4" colwidth=
"1*"/>
3007 <colspec colname=
"col5" colwidth=
"1*"/>
3010 <entry>synchronous_commit setting
</entry>
3011 <entry>local durable commit
</entry>
3012 <entry>standby durable commit after PG crash
</entry>
3013 <entry>standby durable commit after OS crash
</entry>
3014 <entry>standby query consistency
</entry>
3021 <entry>remote_apply
</entry>
3022 <entry align=
"center">•</entry>
3023 <entry align=
"center">•</entry>
3024 <entry align=
"center">•</entry>
3025 <entry align=
"center">•</entry>
3030 <entry align=
"center">•</entry>
3031 <entry align=
"center">•</entry>
3032 <entry align=
"center">•</entry>
3033 <entry align=
"center"></entry>
3037 <entry>remote_write
</entry>
3038 <entry align=
"center">•</entry>
3039 <entry align=
"center">•</entry>
3040 <entry align=
"center"></entry>
3041 <entry align=
"center"></entry>
3045 <entry>local
</entry>
3046 <entry align=
"center">•</entry>
3047 <entry align=
"center"></entry>
3048 <entry align=
"center"></entry>
3049 <entry align=
"center"></entry>
3054 <entry align=
"center"></entry>
3055 <entry align=
"center"></entry>
3056 <entry align=
"center"></entry>
3057 <entry align=
"center"></entry>
3067 <varlistentry id=
"guc-wal-sync-method" xreflabel=
"wal_sync_method">
3068 <term><varname>wal_sync_method
</varname> (
<type>enum
</type>)
3070 <primary><varname>wal_sync_method
</varname> configuration parameter
</primary>
3075 Method used for forcing WAL updates out to disk.
3076 If
<varname>fsync
</varname> is off then this setting is irrelevant,
3077 since WAL file updates will not be forced out at all.
3078 Possible values are:
3083 <literal>open_datasync
</literal> (write WAL files with
<function>open()
</function> option
<symbol>O_DSYNC
</symbol>)
3088 <literal>fdatasync
</literal> (call
<function>fdatasync()
</function> at each commit)
3093 <literal>fsync
</literal> (call
<function>fsync()
</function> at each commit)
3098 <literal>fsync_writethrough
</literal> (call
<function>fsync()
</function> at each commit, forcing write-through of any disk write cache)
3103 <literal>open_sync
</literal> (write WAL files with
<function>open()
</function> option
<symbol>O_SYNC
</symbol>)
3108 Not all of these choices are available on all platforms.
3109 The default is the first method in the above list that is supported
3110 by the platform, except that
<literal>fdatasync
</literal> is the default on
3111 Linux and FreeBSD. The default is not necessarily ideal; it might be
3112 necessary to change this setting or other aspects of your system
3113 configuration in order to create a crash-safe configuration or
3114 achieve optimal performance.
3115 These aspects are discussed in
<xref linkend=
"wal-reliability"/>.
3116 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3117 file or on the server command line.
3122 <varlistentry id=
"guc-full-page-writes" xreflabel=
"full_page_writes">
3123 <term><varname>full_page_writes
</varname> (
<type>boolean
</type>)
3125 <primary><varname>full_page_writes
</varname> configuration parameter
</primary>
3130 When this parameter is on, the
<productname>PostgreSQL
</productname> server
3131 writes the entire content of each disk page to WAL during the
3132 first modification of that page after a checkpoint.
3133 This is needed because
3134 a page write that is in process during an operating system crash might
3135 be only partially completed, leading to an on-disk page
3136 that contains a mix of old and new data. The row-level change data
3137 normally stored in WAL will not be enough to completely restore
3138 such a page during post-crash recovery. Storing the full page image
3139 guarantees that the page can be correctly restored, but at the price
3140 of increasing the amount of data that must be written to WAL.
3141 (Because WAL replay always starts from a checkpoint, it is sufficient
3142 to do this during the first change of each page after a checkpoint.
3143 Therefore, one way to reduce the cost of full-page writes is to
3144 increase the checkpoint interval parameters.)
3148 Turning this parameter off speeds normal operation, but
3149 might lead to either unrecoverable data corruption, or silent
3150 data corruption, after a system failure. The risks are similar to turning off
3151 <varname>fsync
</varname>, though smaller, and it should be turned off
3152 only based on the same circumstances recommended for that parameter.
3156 Turning off this parameter does not affect use of
3157 WAL archiving for point-in-time recovery (PITR)
3158 (see
<xref linkend=
"continuous-archiving"/>).
3162 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3163 file or on the server command line.
3164 The default is
<literal>on
</literal>.
3169 <varlistentry id=
"guc-wal-log-hints" xreflabel=
"wal_log_hints">
3170 <term><varname>wal_log_hints
</varname> (
<type>boolean
</type>)
3172 <primary><varname>wal_log_hints
</varname> configuration parameter
</primary>
3177 When this parameter is
<literal>on
</literal>, the
<productname>PostgreSQL
</productname>
3178 server writes the entire content of each disk page to WAL during the
3179 first modification of that page after a checkpoint, even for
3180 non-critical modifications of so-called hint bits.
3184 If data checksums are enabled, hint bit updates are always WAL-logged
3185 and this setting is ignored. You can use this setting to test how much
3186 extra WAL-logging would occur if your database had data checksums
3191 This parameter can only be set at server start. The default value is
<literal>off
</literal>.
3196 <varlistentry id=
"guc-wal-compression" xreflabel=
"wal_compression">
3197 <term><varname>wal_compression
</varname> (
<type>enum
</type>)
3199 <primary><varname>wal_compression
</varname> configuration parameter
</primary>
3204 This parameter enables compression of WAL using the specified
3206 When enabled, the
<productname>PostgreSQL
</productname>
3207 server compresses full page images written to WAL when
3208 <xref linkend=
"guc-full-page-writes"/> is on or during a base backup.
3209 A compressed page image will be decompressed during WAL replay.
3210 The supported methods are
<literal>pglz
</literal>,
3211 <literal>lz4
</literal> (if
<productname>PostgreSQL
</productname>
3212 was compiled with
<option>--with-lz4
</option>) and
3213 <literal>zstd
</literal> (if
<productname>PostgreSQL
</productname>
3214 was compiled with
<option>--with-zstd
</option>).
3215 The default value is
<literal>off
</literal>.
3216 Only superusers and users with the appropriate
<literal>SET
</literal>
3217 privilege can change this setting.
3221 Enabling compression can reduce the WAL volume without
3222 increasing the risk of unrecoverable data corruption,
3223 but at the cost of some extra CPU spent on the compression during
3224 WAL logging and on the decompression during WAL replay.
3229 <varlistentry id=
"guc-wal-init-zero" xreflabel=
"wal_init_zero">
3230 <term><varname>wal_init_zero
</varname> (
<type>boolean
</type>)
3232 <primary><varname>wal_init_zero
</varname> configuration parameter
</primary>
3237 If set to
<literal>on
</literal> (the default), this option causes new
3238 WAL files to be filled with zeroes. On some file systems, this ensures
3239 that space is allocated before we need to write WAL records. However,
3240 <firstterm>Copy-On-Write
</firstterm> (COW) file systems may not benefit
3241 from this technique, so the option is given to skip the unnecessary
3242 work. If set to
<literal>off
</literal>, only the final byte is written
3243 when the file is created so that it has the expected size.
3248 <varlistentry id=
"guc-wal-recycle" xreflabel=
"wal_recycle">
3249 <term><varname>wal_recycle
</varname> (
<type>boolean
</type>)
3251 <primary><varname>wal_recycle
</varname> configuration parameter
</primary>
3256 If set to
<literal>on
</literal> (the default), this option causes WAL
3257 files to be recycled by renaming them, avoiding the need to create new
3258 ones. On COW file systems, it may be faster to create new ones, so the
3259 option is given to disable this behavior.
3264 <varlistentry id=
"guc-wal-buffers" xreflabel=
"wal_buffers">
3265 <term><varname>wal_buffers
</varname> (
<type>integer
</type>)
3267 <primary><varname>wal_buffers
</varname> configuration parameter
</primary>
3272 The amount of shared memory used for WAL data that has not yet been
3273 written to disk. The default setting of -
1 selects a size equal to
3274 1/
32nd (about
3%) of
<xref linkend=
"guc-shared-buffers"/>, but not less
3275 than
<literal>64kB
</literal> nor more than the size of one WAL
3276 segment, typically
<literal>16MB
</literal>. This value can be set
3277 manually if the automatic choice is too large or too small,
3278 but any positive value less than
<literal>32kB
</literal> will be
3279 treated as
<literal>32kB
</literal>.
3280 If this value is specified without units, it is taken as WAL blocks,
3281 that is
<symbol>XLOG_BLCKSZ
</symbol> bytes, typically
8kB.
3282 This parameter can only be set at server start.
3286 The contents of the WAL buffers are written out to disk at every
3287 transaction commit, so extremely large values are unlikely to
3288 provide a significant benefit. However, setting this value to at
3289 least a few megabytes can improve write performance on a busy
3290 server where many clients are committing at once. The auto-tuning
3291 selected by the default setting of -
1 should give reasonable
3292 results in most cases.
3298 <varlistentry id=
"guc-wal-writer-delay" xreflabel=
"wal_writer_delay">
3299 <term><varname>wal_writer_delay
</varname> (
<type>integer
</type>)
3301 <primary><varname>wal_writer_delay
</varname> configuration parameter
</primary>
3306 Specifies how often the WAL writer flushes WAL, in time terms.
3307 After flushing WAL the writer sleeps for the length of time given
3308 by
<varname>wal_writer_delay
</varname>, unless woken up sooner
3309 by an asynchronously committing transaction. If the last flush
3310 happened less than
<varname>wal_writer_delay
</varname> ago and less
3311 than
<varname>wal_writer_flush_after
</varname> worth of WAL has been
3312 produced since, then WAL is only written to the operating system, not
3314 If this value is specified without units, it is taken as milliseconds.
3315 The default value is
200 milliseconds (
<literal>200ms
</literal>). Note that
3316 on some systems, the effective resolution of sleep delays is
10
3317 milliseconds; setting
<varname>wal_writer_delay
</varname> to a value that is
3318 not a multiple of
10 might have the same results as setting it to the
3319 next higher multiple of
10. This parameter can only be set in the
3320 <filename>postgresql.conf
</filename> file or on the server command line.
3325 <varlistentry id=
"guc-wal-writer-flush-after" xreflabel=
"wal_writer_flush_after">
3326 <term><varname>wal_writer_flush_after
</varname> (
<type>integer
</type>)
3328 <primary><varname>wal_writer_flush_after
</varname> configuration parameter
</primary>
3333 Specifies how often the WAL writer flushes WAL, in volume terms.
3334 If the last flush happened less
3335 than
<varname>wal_writer_delay
</varname> ago and less
3336 than
<varname>wal_writer_flush_after
</varname> worth of WAL has been
3337 produced since, then WAL is only written to the operating system, not
3338 flushed to disk. If
<varname>wal_writer_flush_after
</varname> is set
3339 to
<literal>0</literal> then WAL data is always flushed immediately.
3340 If this value is specified without units, it is taken as WAL blocks,
3341 that is
<symbol>XLOG_BLCKSZ
</symbol> bytes, typically
8kB.
3342 The default is
<literal>1MB
</literal>.
3343 This parameter can only be set in the
3344 <filename>postgresql.conf
</filename> file or on the server command line.
3349 <varlistentry id=
"guc-wal-skip-threshold" xreflabel=
"wal_skip_threshold">
3350 <term><varname>wal_skip_threshold
</varname> (
<type>integer
</type>)
3352 <primary><varname>wal_skip_threshold
</varname> configuration parameter
</primary>
3357 When
<varname>wal_level
</varname> is
<literal>minimal
</literal> and a
3358 transaction commits after creating or rewriting a permanent relation,
3359 this setting determines how to persist the new data. If the data is
3360 smaller than this setting, write it to the WAL log; otherwise, use an
3361 fsync of affected files. Depending on the properties of your storage,
3362 raising or lowering this value might help if such commits are slowing
3363 concurrent transactions. If this value is specified without units, it
3364 is taken as kilobytes. The default is two megabytes
3365 (
<literal>2MB
</literal>).
3370 <varlistentry id=
"guc-commit-delay" xreflabel=
"commit_delay">
3371 <term><varname>commit_delay
</varname> (
<type>integer
</type>)
3373 <primary><varname>commit_delay
</varname> configuration parameter
</primary>
3378 Setting
<varname>commit_delay
</varname> adds a time delay
3379 before a WAL flush is initiated. This can improve
3380 group commit throughput by allowing a larger number of transactions
3381 to commit via a single WAL flush, if system load is high enough
3382 that additional transactions become ready to commit within the
3383 given interval. However, it also increases latency by up to the
3384 <varname>commit_delay
</varname> for each WAL
3385 flush. Because the delay is just wasted if no other transactions
3386 become ready to commit, a delay is only performed if at least
3387 <varname>commit_siblings
</varname> other transactions are active
3388 when a flush is about to be initiated. Also, no delays are
3389 performed if
<varname>fsync
</varname> is disabled.
3390 If this value is specified without units, it is taken as microseconds.
3391 The default
<varname>commit_delay
</varname> is zero (no delay).
3392 Only superusers and users with the appropriate
<literal>SET
</literal>
3393 privilege can change this setting.
3396 In
<productname>PostgreSQL
</productname> releases prior to
9.3,
3397 <varname>commit_delay
</varname> behaved differently and was much
3398 less effective: it affected only commits, rather than all WAL flushes,
3399 and waited for the entire configured delay even if the WAL flush
3400 was completed sooner. Beginning in
<productname>PostgreSQL
</productname> 9.3,
3401 the first process that becomes ready to flush waits for the configured
3402 interval, while subsequent processes wait only until the leader
3403 completes the flush operation.
3408 <varlistentry id=
"guc-commit-siblings" xreflabel=
"commit_siblings">
3409 <term><varname>commit_siblings
</varname> (
<type>integer
</type>)
3411 <primary><varname>commit_siblings
</varname> configuration parameter
</primary>
3416 Minimum number of concurrent open transactions to require
3417 before performing the
<varname>commit_delay
</varname> delay. A larger
3418 value makes it more probable that at least one other
3419 transaction will become ready to commit during the delay
3420 interval. The default is five transactions.
3427 <sect2 id=
"runtime-config-wal-checkpoints">
3428 <title>Checkpoints
</title>
3431 <varlistentry id=
"guc-checkpoint-timeout" xreflabel=
"checkpoint_timeout">
3432 <term><varname>checkpoint_timeout
</varname> (
<type>integer
</type>)
3434 <primary><varname>checkpoint_timeout
</varname> configuration parameter
</primary>
3439 Maximum time between automatic WAL checkpoints.
3440 If this value is specified without units, it is taken as seconds.
3441 The valid range is between
30 seconds and one day.
3442 The default is five minutes (
<literal>5min
</literal>).
3443 Increasing this parameter can increase the amount of time needed
3445 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3446 file or on the server command line.
3451 <varlistentry id=
"guc-checkpoint-completion-target" xreflabel=
"checkpoint_completion_target">
3452 <term><varname>checkpoint_completion_target
</varname> (
<type>floating point
</type>)
3454 <primary><varname>checkpoint_completion_target
</varname> configuration parameter
</primary>
3459 Specifies the target of checkpoint completion, as a fraction of
3460 total time between checkpoints. The default is
0.9, which spreads the
3461 checkpoint across almost all of the available interval, providing fairly
3462 consistent I/O load while also leaving some time for checkpoint
3463 completion overhead. Reducing this parameter is not recommended because
3464 it causes the checkpoint to complete faster. This results in a higher
3465 rate of I/O during the checkpoint followed by a period of less I/O between
3466 the checkpoint completion and the next scheduled checkpoint. This
3467 parameter can only be set in the
<filename>postgresql.conf
</filename> file
3468 or on the server command line.
3473 <varlistentry id=
"guc-checkpoint-flush-after" xreflabel=
"checkpoint_flush_after">
3474 <term><varname>checkpoint_flush_after
</varname> (
<type>integer
</type>)
3476 <primary><varname>checkpoint_flush_after
</varname> configuration parameter
</primary>
3481 Whenever more than this amount of data has been
3482 written while performing a checkpoint, attempt to force the
3483 OS to issue these writes to the underlying storage. Doing so will
3484 limit the amount of dirty data in the kernel's page cache, reducing
3485 the likelihood of stalls when an
<function>fsync
</function> is issued at the end of the
3486 checkpoint, or when the OS writes data back in larger batches in the
3487 background. Often that will result in greatly reduced transaction
3488 latency, but there also are some cases, especially with workloads
3489 that are bigger than
<xref linkend=
"guc-shared-buffers"/>, but smaller
3490 than the OS's page cache, where performance might degrade. This
3491 setting may have no effect on some platforms.
3492 If this value is specified without units, it is taken as blocks,
3493 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
3495 between
<literal>0</literal>, which disables forced writeback,
3496 and
<literal>2MB
</literal>. The default is
<literal>256kB
</literal> on
3497 Linux,
<literal>0</literal> elsewhere. (If
<symbol>BLCKSZ
</symbol> is not
3498 8kB, the default and maximum values scale proportionally to it.)
3499 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3500 file or on the server command line.
3505 <varlistentry id=
"guc-checkpoint-warning" xreflabel=
"checkpoint_warning">
3506 <term><varname>checkpoint_warning
</varname> (
<type>integer
</type>)
3508 <primary><varname>checkpoint_warning
</varname> configuration parameter
</primary>
3513 Write a message to the server log if checkpoints caused by
3514 the filling of WAL segment files happen closer together
3515 than this amount of time (which suggests that
3516 <varname>max_wal_size
</varname> ought to be raised).
3517 If this value is specified without units, it is taken as seconds.
3518 The default is
30 seconds (
<literal>30s
</literal>).
3519 Zero disables the warning.
3520 No warnings will be generated if
<varname>checkpoint_timeout
</varname>
3521 is less than
<varname>checkpoint_warning
</varname>.
3522 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3523 file or on the server command line.
3528 <varlistentry id=
"guc-max-wal-size" xreflabel=
"max_wal_size">
3529 <term><varname>max_wal_size
</varname> (
<type>integer
</type>)
3531 <primary><varname>max_wal_size
</varname> configuration parameter
</primary>
3536 Maximum size to let the WAL grow during automatic
3537 checkpoints. This is a soft limit; WAL size can exceed
3538 <varname>max_wal_size
</varname> under special circumstances, such as
3539 heavy load, a failing
<varname>archive_command
</varname> or
<varname>archive_library
</varname>, or a high
3540 <varname>wal_keep_size
</varname> setting.
3541 If this value is specified without units, it is taken as megabytes.
3542 The default is
1 GB.
3543 Increasing this parameter can increase the amount of time needed for
3545 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3546 file or on the server command line.
3551 <varlistentry id=
"guc-min-wal-size" xreflabel=
"min_wal_size">
3552 <term><varname>min_wal_size
</varname> (
<type>integer
</type>)
3554 <primary><varname>min_wal_size
</varname> configuration parameter
</primary>
3559 As long as WAL disk usage stays below this setting, old WAL files are
3560 always recycled for future use at a checkpoint, rather than removed.
3561 This can be used to ensure that enough WAL space is reserved to
3562 handle spikes in WAL usage, for example when running large batch
3564 If this value is specified without units, it is taken as megabytes.
3565 The default is
80 MB.
3566 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3567 file or on the server command line.
3574 <sect2 id=
"runtime-config-wal-archiving">
3575 <title>Archiving
</title>
3578 <varlistentry id=
"guc-archive-mode" xreflabel=
"archive_mode">
3579 <term><varname>archive_mode
</varname> (
<type>enum
</type>)
3581 <primary><varname>archive_mode
</varname> configuration parameter
</primary>
3586 When
<varname>archive_mode
</varname> is enabled, completed WAL segments
3587 are sent to archive storage by setting
3588 <xref linkend=
"guc-archive-command"/> or
3589 <xref linkend=
"guc-archive-library"/>. In addition to
<literal>off
</literal>,
3590 to disable, there are two modes:
<literal>on
</literal>, and
3591 <literal>always
</literal>. During normal operation, there is no
3592 difference between the two modes, but when set to
<literal>always
</literal>
3593 the WAL archiver is enabled also during archive recovery or standby
3594 mode. In
<literal>always
</literal> mode, all files restored from the archive
3595 or streamed with streaming replication will be archived (again). See
3596 <xref linkend=
"continuous-archiving-in-standby"/> for details.
3599 <varname>archive_mode
</varname> is a separate setting from
3600 <varname>archive_command
</varname> and
3601 <varname>archive_library
</varname> so that
3602 <varname>archive_command
</varname> and
3603 <varname>archive_library
</varname> can be changed without leaving
3605 This parameter can only be set at server start.
3606 <varname>archive_mode
</varname> cannot be enabled when
3607 <varname>wal_level
</varname> is set to
<literal>minimal
</literal>.
3612 <varlistentry id=
"guc-archive-command" xreflabel=
"archive_command">
3613 <term><varname>archive_command
</varname> (
<type>string
</type>)
3615 <primary><varname>archive_command
</varname> configuration parameter
</primary>
3620 The local shell command to execute to archive a completed WAL file
3621 segment. Any
<literal>%p
</literal> in the string is
3622 replaced by the path name of the file to archive, and any
3623 <literal>%f
</literal> is replaced by only the file name.
3624 (The path name is relative to the working directory of the server,
3625 i.e., the cluster's data directory.)
3626 Use
<literal>%%
</literal> to embed an actual
<literal>%
</literal> character in the
3627 command. It is important for the command to return a zero
3628 exit status only if it succeeds. For more information see
3629 <xref linkend=
"backup-archiving-wal"/>.
3632 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3633 file or on the server command line. It is only used if
3634 <varname>archive_mode
</varname> was enabled at server start and
3635 <varname>archive_library
</varname> is set to an empty string. If both
3636 <varname>archive_command
</varname> and
<varname>archive_library
</varname>
3637 are set, an error will be raised.
3638 If
<varname>archive_command
</varname> is an empty string (the default) while
3639 <varname>archive_mode
</varname> is enabled (and
<varname>archive_library
</varname>
3640 is set to an empty string), WAL archiving is temporarily
3641 disabled, but the server continues to accumulate WAL segment files in
3642 the expectation that a command will soon be provided. Setting
3643 <varname>archive_command
</varname> to a command that does nothing but
3644 return true, e.g.,
<literal>/bin/true
</literal> (
<literal>REM
</literal> on
3645 Windows), effectively disables
3646 archiving, but also breaks the chain of WAL files needed for
3647 archive recovery, so it should only be used in unusual circumstances.
3652 <varlistentry id=
"guc-archive-library" xreflabel=
"archive_library">
3653 <term><varname>archive_library
</varname> (
<type>string
</type>)
3655 <primary><varname>archive_library
</varname> configuration parameter
</primary>
3660 The library to use for archiving completed WAL file segments. If set to
3661 an empty string (the default), archiving via shell is enabled, and
3662 <xref linkend=
"guc-archive-command"/> is used. If both
3663 <varname>archive_command
</varname> and
<varname>archive_library
</varname>
3664 are set, an error will be raised. Otherwise, the specified
3665 shared library is used for archiving. The WAL archiver process is
3666 restarted by the postmaster when this parameter changes. For more
3667 information, see
<xref linkend=
"backup-archiving-wal"/> and
3668 <xref linkend=
"archive-modules"/>.
3671 This parameter can only be set in the
3672 <filename>postgresql.conf
</filename> file or on the server command line.
3677 <varlistentry id=
"guc-archive-timeout" xreflabel=
"archive_timeout">
3678 <term><varname>archive_timeout
</varname> (
<type>integer
</type>)
3680 <primary><varname>archive_timeout
</varname> configuration parameter
</primary>
3685 The
<xref linkend=
"guc-archive-command"/> or
<xref linkend=
"guc-archive-library"/> is only invoked for
3686 completed WAL segments. Hence, if your server generates little WAL
3687 traffic (or has slack periods where it does so), there could be a
3688 long delay between the completion of a transaction and its safe
3689 recording in archive storage. To limit how old unarchived
3690 data can be, you can set
<varname>archive_timeout
</varname> to force the
3691 server to switch to a new WAL segment file periodically. When this
3692 parameter is greater than zero, the server will switch to a new
3693 segment file whenever this amount of time has elapsed since the last
3694 segment file switch, and there has been any database activity,
3695 including a single checkpoint (checkpoints are skipped if there is
3696 no database activity). Note that archived files that are closed
3697 early due to a forced switch are still the same length as completely
3698 full files. Therefore, it is unwise to use a very short
3699 <varname>archive_timeout
</varname> — it will bloat your archive
3700 storage.
<varname>archive_timeout
</varname> settings of a minute or so are
3701 usually reasonable. You should consider using streaming replication,
3702 instead of archiving, if you want data to be copied off the primary
3703 server more quickly than that.
3704 If this value is specified without units, it is taken as seconds.
3705 This parameter can only be set in the
3706 <filename>postgresql.conf
</filename> file or on the server command line.
3714 <sect2 id=
"runtime-config-wal-recovery">
3716 <title>Recovery
</title>
3719 <primary>configuration
</primary>
3720 <secondary>of recovery
</secondary>
3721 <tertiary>general settings
</tertiary>
3725 This section describes the settings that apply to recovery in general,
3726 affecting crash recovery, streaming replication and archive-based
3732 <varlistentry id=
"guc-recovery-prefetch" xreflabel=
"recovery_prefetch">
3733 <term><varname>recovery_prefetch
</varname> (
<type>enum
</type>)
3735 <primary><varname>recovery_prefetch
</varname> configuration parameter
</primary>
3740 Whether to try to prefetch blocks that are referenced in the WAL that
3741 are not yet in the buffer pool, during recovery. Valid values are
3742 <literal>off
</literal>,
<literal>on
</literal> and
3743 <literal>try
</literal> (the default). The setting
3744 <literal>try
</literal> enables
3745 prefetching only if the operating system provides support for issuing
3749 Prefetching blocks that will soon be needed can reduce I/O wait times
3750 during recovery with some workloads.
3751 See also the
<xref linkend=
"guc-wal-decode-buffer-size"/> and
3752 <xref linkend=
"guc-maintenance-io-concurrency"/> settings, which limit
3753 prefetching activity.
3758 <varlistentry id=
"guc-wal-decode-buffer-size" xreflabel=
"wal_decode_buffer_size">
3759 <term><varname>wal_decode_buffer_size
</varname> (
<type>integer
</type>)
3761 <primary><varname>wal_decode_buffer_size
</varname> configuration parameter
</primary>
3766 A limit on how far ahead the server can look in the WAL, to find
3767 blocks to prefetch. If this value is specified without units, it is
3769 The default is
512kB.
3777 <sect2 id=
"runtime-config-wal-archive-recovery">
3779 <title>Archive Recovery
</title>
3782 <primary>configuration
</primary>
3783 <secondary>of recovery
</secondary>
3784 <tertiary>of a standby server
</tertiary>
3788 This section describes the settings that apply only for the duration of
3789 the recovery. They must be reset for any subsequent recovery you wish to
3794 <quote>Recovery
</quote> covers using the server as a standby or for
3795 executing a targeted recovery. Typically, standby mode would be used to
3796 provide high availability and/or read scalability, whereas a targeted
3797 recovery is used to recover from data loss.
3801 To start the server in standby mode, create a file called
3802 <filename>standby.signal
</filename><indexterm><primary>standby.signal
</primary></indexterm>
3803 in the data directory. The server will enter recovery and will not stop
3804 recovery when the end of archived WAL is reached, but will keep trying to
3805 continue recovery by connecting to the sending server as specified by the
3806 <varname>primary_conninfo
</varname> setting and/or by fetching new WAL
3807 segments using
<varname>restore_command
</varname>. For this mode, the
3808 parameters from this section and
<xref
3809 linkend=
"runtime-config-replication-standby"/> are of interest.
3810 Parameters from
<xref linkend=
"runtime-config-wal-recovery-target"/> will
3811 also be applied but are typically not useful in this mode.
3815 To start the server in targeted recovery mode, create a file called
3816 <filename>recovery.signal
</filename><indexterm><primary>recovery.signal
</primary></indexterm>
3817 in the data directory. If both
<filename>standby.signal
</filename> and
3818 <filename>recovery.signal
</filename> files are created, standby mode
3819 takes precedence. Targeted recovery mode ends when the archived WAL is
3820 fully replayed, or when
<varname>recovery_target
</varname> is reached.
3821 In this mode, the parameters from both this section and
<xref
3822 linkend=
"runtime-config-wal-recovery-target"/> will be used.
3826 <varlistentry id=
"guc-restore-command" xreflabel=
"restore_command">
3827 <term><varname>restore_command
</varname> (
<type>string
</type>)
3829 <primary><varname>restore_command
</varname> configuration parameter
</primary>
3834 The local shell command to execute to retrieve an archived segment of
3835 the WAL file series. This parameter is required for archive recovery,
3836 but optional for streaming replication.
3837 Any
<literal>%f
</literal> in the string is
3838 replaced by the name of the file to retrieve from the archive,
3839 and any
<literal>%p
</literal> is replaced by the copy destination path name
3841 (The path name is relative to the current working directory,
3842 i.e., the cluster's data directory.)
3843 Any
<literal>%r
</literal> is replaced by the name of the file containing the
3844 last valid restart point. That is the earliest file that must be kept
3845 to allow a restore to be restartable, so this information can be used
3846 to truncate the archive to just the minimum required to support
3847 restarting from the current restore.
<literal>%r
</literal> is typically only
3848 used by warm-standby configurations
3849 (see
<xref linkend=
"warm-standby"/>).
3850 Write
<literal>%%
</literal> to embed an actual
<literal>%
</literal> character.
3854 It is important for the command to return a zero exit status
3855 only if it succeeds. The command
<emphasis>will
</emphasis> be asked for file
3856 names that are not present in the archive; it must return nonzero
3857 when so asked. Examples:
3859 restore_command = 'cp /mnt/server/archivedir/%f
"%p"'
3860 restore_command = 'copy
"C:\\server\\archivedir\\%f" "%p"' # Windows
3862 An exception is that if the command was terminated by a signal (other
3863 than
<systemitem>SIGTERM
</systemitem>, which is used as part of a
3864 database server shutdown) or an error by the shell (such as command
3865 not found), then recovery will abort and the server will not start up.
3869 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3870 file or on the server command line.
3875 <varlistentry id=
"guc-archive-cleanup-command" xreflabel=
"archive_cleanup_command">
3876 <term><varname>archive_cleanup_command
</varname> (
<type>string
</type>)
3878 <primary><varname>archive_cleanup_command
</varname> configuration parameter
</primary>
3883 This optional parameter specifies a shell command that will be executed
3884 at every restartpoint. The purpose of
3885 <varname>archive_cleanup_command
</varname> is to provide a mechanism for
3886 cleaning up old archived WAL files that are no longer needed by the
3888 Any
<literal>%r
</literal> is replaced by the name of the file containing the
3889 last valid restart point.
3890 That is the earliest file that must be
<emphasis>kept
</emphasis> to allow a
3891 restore to be restartable, and so all files earlier than
<literal>%r
</literal>
3892 may be safely removed.
3893 This information can be used to truncate the archive to just the
3894 minimum required to support restart from the current restore.
3895 The
<xref linkend=
"pgarchivecleanup"/> module
3896 is often used in
<varname>archive_cleanup_command
</varname> for
3897 single-standby configurations, for example:
3898 <programlisting>archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'
</programlisting>
3899 Note however that if multiple standby servers are restoring from the
3900 same archive directory, you will need to ensure that you do not delete
3901 WAL files until they are no longer needed by any of the servers.
3902 <varname>archive_cleanup_command
</varname> would typically be used in a
3903 warm-standby configuration (see
<xref linkend=
"warm-standby"/>).
3904 Write
<literal>%%
</literal> to embed an actual
<literal>%
</literal> character in the
3908 If the command returns a nonzero exit status then a warning log
3909 message will be written. An exception is that if the command was
3910 terminated by a signal or an error by the shell (such as command not
3911 found), a fatal error will be raised.
3914 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3915 file or on the server command line.
3920 <varlistentry id=
"guc-recovery-end-command" xreflabel=
"recovery_end_command">
3921 <term><varname>recovery_end_command
</varname> (
<type>string
</type>)
3923 <primary><varname>recovery_end_command
</varname> configuration parameter
</primary>
3928 This parameter specifies a shell command that will be executed once only
3929 at the end of recovery. This parameter is optional. The purpose of the
3930 <varname>recovery_end_command
</varname> is to provide a mechanism for cleanup
3931 following replication or recovery.
3932 Any
<literal>%r
</literal> is replaced by the name of the file containing the
3933 last valid restart point, like in
<xref linkend=
"guc-archive-cleanup-command"/>.
3936 If the command returns a nonzero exit status then a warning log
3937 message will be written and the database will proceed to start up
3938 anyway. An exception is that if the command was terminated by a
3939 signal or an error by the shell (such as command not found), the
3940 database will not proceed with startup.
3943 This parameter can only be set in the
<filename>postgresql.conf
</filename>
3944 file or on the server command line.
3953 <sect2 id=
"runtime-config-wal-recovery-target">
3955 <title>Recovery Target
</title>
3958 By default, recovery will recover to the end of the WAL log. The
3959 following parameters can be used to specify an earlier stopping point.
3960 At most one of
<varname>recovery_target
</varname>,
3961 <varname>recovery_target_lsn
</varname>,
<varname>recovery_target_name
</varname>,
3962 <varname>recovery_target_time
</varname>, or
<varname>recovery_target_xid
</varname>
3963 can be used; if more than one of these is specified in the configuration
3964 file, an error will be raised.
3965 These parameters can only be set at server start.
3969 <varlistentry id=
"guc-recovery-target" xreflabel=
"recovery_target">
3970 <term><varname>recovery_target
</varname><literal> = 'immediate'
</literal>
3972 <primary><varname>recovery_target
</varname> configuration parameter
</primary>
3977 This parameter specifies that recovery should end as soon as a
3978 consistent state is reached, i.e., as early as possible. When restoring
3979 from an online backup, this means the point where taking the backup
3983 Technically, this is a string parameter, but
<literal>'immediate'
</literal>
3984 is currently the only allowed value.
3989 <varlistentry id=
"guc-recovery-target-name" xreflabel=
"recovery_target_name">
3990 <term><varname>recovery_target_name
</varname> (
<type>string
</type>)
3992 <primary><varname>recovery_target_name
</varname> configuration parameter
</primary>
3997 This parameter specifies the named restore point (created with
3998 <function>pg_create_restore_point()
</function>) to which recovery will proceed.
4003 <varlistentry id=
"guc-recovery-target-time" xreflabel=
"recovery_target_time">
4004 <term><varname>recovery_target_time
</varname> (
<type>timestamp
</type>)
4006 <primary><varname>recovery_target_time
</varname> configuration parameter
</primary>
4011 This parameter specifies the time stamp up to which recovery
4013 The precise stopping point is also influenced by
4014 <xref linkend=
"guc-recovery-target-inclusive"/>.
4018 The value of this parameter is a time stamp in the same format
4019 accepted by the
<type>timestamp with time zone
</type> data type,
4020 except that you cannot use a time zone abbreviation (unless the
4021 <xref linkend=
"guc-timezone-abbreviations"/> variable has been set
4022 earlier in the configuration file). Preferred style is to use a
4023 numeric offset from UTC, or you can write a full time zone name,
4024 e.g.,
<literal>Europe/Helsinki
</literal> not
<literal>EEST
</literal>.
4029 <varlistentry id=
"guc-recovery-target-xid" xreflabel=
"recovery_target_xid">
4030 <term><varname>recovery_target_xid
</varname> (
<type>string
</type>)
4032 <primary><varname>recovery_target_xid
</varname> configuration parameter
</primary>
4037 This parameter specifies the transaction ID up to which recovery
4038 will proceed. Keep in mind
4039 that while transaction IDs are assigned sequentially at transaction
4040 start, transactions can complete in a different numeric order.
4041 The transactions that will be recovered are those that committed
4042 before (and optionally including) the specified one.
4043 The precise stopping point is also influenced by
4044 <xref linkend=
"guc-recovery-target-inclusive"/>.
4049 <varlistentry id=
"guc-recovery-target-lsn" xreflabel=
"recovery_target_lsn">
4050 <term><varname>recovery_target_lsn
</varname> (
<type>pg_lsn
</type>)
4052 <primary><varname>recovery_target_lsn
</varname> configuration parameter
</primary>
4057 This parameter specifies the LSN of the write-ahead log location up
4058 to which recovery will proceed. The precise stopping point is also
4059 influenced by
<xref linkend=
"guc-recovery-target-inclusive"/>. This
4060 parameter is parsed using the system data type
4061 <link linkend=
"datatype-pg-lsn"><type>pg_lsn
</type></link>.
4068 The following options further specify the recovery target, and affect
4069 what happens when the target is reached:
4073 <varlistentry id=
"guc-recovery-target-inclusive"
4074 xreflabel=
"recovery_target_inclusive">
4075 <term><varname>recovery_target_inclusive
</varname> (
<type>boolean
</type>)
4077 <primary><varname>recovery_target_inclusive
</varname> configuration parameter
</primary>
4082 Specifies whether to stop just after the specified recovery target
4083 (
<literal>on
</literal>), or just before the recovery target
4084 (
<literal>off
</literal>).
4085 Applies when
<xref linkend=
"guc-recovery-target-lsn"/>,
4086 <xref linkend=
"guc-recovery-target-time"/>, or
4087 <xref linkend=
"guc-recovery-target-xid"/> is specified.
4088 This setting controls whether transactions
4089 having exactly the target WAL location (LSN), commit time, or transaction ID, respectively, will
4090 be included in the recovery. Default is
<literal>on
</literal>.
4095 <varlistentry id=
"guc-recovery-target-timeline"
4096 xreflabel=
"recovery_target_timeline">
4097 <term><varname>recovery_target_timeline
</varname> (
<type>string
</type>)
4099 <primary><varname>recovery_target_timeline
</varname> configuration parameter
</primary>
4104 Specifies recovering into a particular timeline. The value can be a
4105 numeric timeline ID or a special value. The value
4106 <literal>current
</literal> recovers along the same timeline that was
4107 current when the base backup was taken. The
4108 value
<literal>latest
</literal> recovers
4109 to the latest timeline found in the archive, which is useful in
4110 a standby server.
<literal>latest
</literal> is the default.
4114 To specify a timeline ID in hexadecimal (for example, if extracted
4115 from a WAL file name or history file), prefix it with a
4116 <literal>0x
</literal>. For instance, if the WAL file name is
4117 <filename>00000011000000A10000004F
</filename>, then the timeline ID is
4118 <literal>0x11</literal> (or
17 decimal).
4122 You usually only need to set this parameter
4123 in complex re-recovery situations, where you need to return to
4124 a state that itself was reached after a point-in-time recovery.
4125 See
<xref linkend=
"backup-timelines"/> for discussion.
4130 <varlistentry id=
"guc-recovery-target-action"
4131 xreflabel=
"recovery_target_action">
4132 <term><varname>recovery_target_action
</varname> (
<type>enum
</type>)
4134 <primary><varname>recovery_target_action
</varname> configuration parameter
</primary>
4139 Specifies what action the server should take once the recovery target is
4140 reached. The default is
<literal>pause
</literal>, which means recovery will
4141 be paused.
<literal>promote
</literal> means the recovery process will finish
4142 and the server will start to accept connections.
4143 Finally
<literal>shutdown
</literal> will stop the server after reaching the
4147 The intended use of the
<literal>pause
</literal> setting is to allow queries
4148 to be executed against the database to check if this recovery target
4149 is the most desirable point for recovery.
4150 The paused state can be resumed by
4151 using
<function>pg_wal_replay_resume()
</function> (see
4152 <xref linkend=
"functions-recovery-control-table"/>), which then
4153 causes recovery to end. If this recovery target is not the
4154 desired stopping point, then shut down the server, change the
4155 recovery target settings to a later target and restart to
4159 The
<literal>shutdown
</literal> setting is useful to have the instance ready
4160 at the exact replay point desired. The instance will still be able to
4161 replay more WAL records (and in fact will have to replay WAL records
4162 since the last checkpoint next time it is started).
4165 Note that because
<filename>recovery.signal
</filename> will not be
4166 removed when
<varname>recovery_target_action
</varname> is set to
<literal>shutdown
</literal>,
4167 any subsequent start will end with immediate shutdown unless the
4168 configuration is changed or the
<filename>recovery.signal
</filename>
4169 file is removed manually.
4172 This setting has no effect if no recovery target is set.
4173 If
<xref linkend=
"guc-hot-standby"/> is not enabled, a setting of
4174 <literal>pause
</literal> will act the same as
<literal>shutdown
</literal>.
4175 If the recovery target is reached while a promotion is ongoing,
4176 a setting of
<literal>pause
</literal> will act the same as
4177 <literal>promote
</literal>.
4180 In any case, if a recovery target is configured but the archive
4181 recovery ends before the target is reached, the server will shut down
4190 <sect2 id=
"runtime-config-wal-summarization">
4191 <title>WAL Summarization
</title>
4194 These settings control WAL summarization, a feature which must be
4195 enabled in order to perform an
4196 <link linkend=
"backup-incremental-backup">incremental backup
</link>.
4200 <varlistentry id=
"guc-summarize-wal" xreflabel=
"summarize_wal">
4201 <term><varname>summarize_wal
</varname> (
<type>boolean
</type>)
4203 <primary><varname>summarize_wal
</varname> configuration parameter
</primary>
4208 Enables the WAL summarizer process. Note that WAL summarization can
4209 be enabled either on a primary or on a standby. This parameter can only
4210 be set in the
<filename>postgresql.conf
</filename> file or on the server
4211 command line. The default is
<literal>off
</literal>.
4214 The server cannot be started with
<literal>summarize_wal=on
</literal>
4215 if
<literal>wal_level
</literal> is set to
<literal>minimal
</literal>. If
4216 <literal>summarize_wal=on
</literal> is configured after server startup
4217 while
<literal>wal_level=minimal
</literal>, the summarizer will run
4218 but refuse to generate summary files for any WAL generated with
4219 <literal>wal_level=minimal
</literal>.
4224 <varlistentry id=
"guc-wal-summary-keep-time" xreflabel=
"wal_summary_keep_time">
4225 <term><varname>wal_summary_keep_time
</varname> (
<type>integer
</type>)
4227 <primary><varname>wal_summary_keep_time
</varname> configuration parameter
</primary>
4232 Configures the amount of time after which the WAL summarizer
4233 automatically removes old WAL summaries. The file timestamp is used to
4234 determine which files are old enough to remove. Typically, you should set
4235 this comfortably higher than the time that could pass between a backup
4236 and a later incremental backup that depends on it. WAL summaries must
4237 be available for the entire range of WAL records between the preceding
4238 backup and the new one being taken; if not, the incremental backup will
4239 fail. If this parameter is set to zero, WAL summaries will not be
4240 automatically deleted, but it is safe to manually remove files that you
4241 know will not be required for future incremental backups.
4242 This parameter can only be set in the
4243 <filename>postgresql.conf
</filename> file or on the server command line.
4244 If this value is specified without units, it is taken as minutes.
4245 The default is
10 days. If
<literal>summarize_wal = off
</literal>,
4246 existing WAL summaries will not be removed regardless of the value of
4247 this parameter, because the WAL summarizer will not run.
4258 <sect1 id=
"runtime-config-replication">
4259 <title>Replication
</title>
4262 These settings control the behavior of the built-in
4263 <firstterm>streaming replication
</firstterm> feature (see
4264 <xref linkend=
"streaming-replication"/>), and the built-in
4265 <firstterm>logical replication
</firstterm> feature (see
4266 <xref linkend=
"logical-replication"/>).
4270 For
<emphasis>streaming replication
</emphasis>, servers will be either a
4271 primary or a standby server. Primaries can send data, while standbys
4272 are always receivers of replicated data. When cascading replication
4273 (see
<xref linkend=
"cascading-replication"/>) is used, standby servers
4274 can also be senders, as well as receivers.
4275 Parameters are mainly for sending and standby servers, though some
4276 parameters have meaning only on the primary server. Settings may vary
4277 across the cluster without problems if that is required.
4281 For
<emphasis>logical replication
</emphasis>,
<firstterm>publishers
</firstterm>
4282 (servers that do
<link linkend=
"sql-createpublication"><command>CREATE PUBLICATION
</command></link>)
4283 replicate data to
<firstterm>subscribers
</firstterm>
4284 (servers that do
<link linkend=
"sql-createsubscription"><command>CREATE SUBSCRIPTION
</command></link>).
4285 Servers can also be publishers and subscribers at the same time. Note,
4286 the following sections refer to publishers as
"senders". For more details
4287 about logical replication configuration settings refer to
4288 <xref linkend=
"logical-replication-config"/>.
4291 <sect2 id=
"runtime-config-replication-sender">
4292 <title>Sending Servers
</title>
4295 These parameters can be set on any server that is
4296 to send replication data to one or more standby servers.
4297 The primary is always a sending server, so these parameters must
4298 always be set on the primary.
4299 The role and meaning of these parameters does not change after a
4300 standby becomes the primary.
4304 <varlistentry id=
"guc-max-wal-senders" xreflabel=
"max_wal_senders">
4305 <term><varname>max_wal_senders
</varname> (
<type>integer
</type>)
4307 <primary><varname>max_wal_senders
</varname> configuration parameter
</primary>
4312 Specifies the maximum number of concurrent connections from standby
4313 servers or streaming base backup clients (i.e., the maximum number of
4314 simultaneously running WAL sender processes). The default is
4315 <literal>10</literal>. The value
<literal>0</literal> means
4316 replication is disabled. Abrupt disconnection of a streaming client might
4317 leave an orphaned connection slot behind until a timeout is reached,
4318 so this parameter should be set slightly higher than the maximum
4319 number of expected clients so disconnected clients can immediately
4320 reconnect. This parameter can only be set at server start. Also,
4321 <varname>wal_level
</varname> must be set to
4322 <literal>replica
</literal> or higher to allow connections from standby
4327 When running a standby server, you must set this parameter to the
4328 same or higher value than on the primary server. Otherwise, queries
4329 will not be allowed in the standby server.
4334 <varlistentry id=
"guc-max-replication-slots" xreflabel=
"max_replication_slots">
4335 <term><varname>max_replication_slots
</varname> (
<type>integer
</type>)
4337 <primary><varname>max_replication_slots
</varname> configuration parameter
</primary>
4338 <secondary>in a sending server
</secondary>
4343 Specifies the maximum number of replication slots
4344 (see
<xref linkend=
"streaming-replication-slots"/>) that the server
4345 can support. The default is
10. This parameter can only be set at
4347 Setting it to a lower value than the number of currently
4348 existing replication slots will prevent the server from starting.
4349 Also,
<varname>wal_level
</varname> must be set
4350 to
<literal>replica
</literal> or higher to allow replication slots to
4355 Note that this parameter also applies on the subscriber side, but with
4356 a different meaning. See
<xref linkend=
"guc-max-replication-slots-subscriber"/>
4357 in
<xref linkend=
"runtime-config-replication-subscriber"/> for more
4363 <varlistentry id=
"guc-wal-keep-size" xreflabel=
"wal_keep_size">
4364 <term><varname>wal_keep_size
</varname> (
<type>integer
</type>)
4366 <primary><varname>wal_keep_size
</varname> configuration parameter
</primary>
4371 Specifies the minimum size of past WAL files kept in the
4372 <filename>pg_wal
</filename>
4373 directory, in case a standby server needs to fetch them for streaming
4374 replication. If a standby
4375 server connected to the sending server falls behind by more than
4376 <varname>wal_keep_size
</varname> megabytes, the sending server might
4377 remove a WAL segment still needed by the standby, in which case the
4378 replication connection will be terminated. Downstream connections
4379 will also eventually fail as a result. (However, the standby
4380 server can recover by fetching the segment from archive, if WAL
4381 archiving is in use.)
4385 This sets only the minimum size of segments retained in
4386 <filename>pg_wal
</filename>; the system might need to retain more segments
4387 for WAL archival or to recover from a checkpoint. If
4388 <varname>wal_keep_size
</varname> is zero (the default), the system
4389 doesn't keep any extra segments for standby purposes, so the number
4390 of old WAL segments available to standby servers is a function of
4391 the location of the previous checkpoint and status of WAL
4393 If this value is specified without units, it is taken as megabytes.
4394 This parameter can only be set in the
4395 <filename>postgresql.conf
</filename> file or on the server command line.
4400 <varlistentry id=
"guc-max-slot-wal-keep-size" xreflabel=
"max_slot_wal_keep_size">
4401 <term><varname>max_slot_wal_keep_size
</varname> (
<type>integer
</type>)
4403 <primary><varname>max_slot_wal_keep_size
</varname> configuration parameter
</primary>
4408 Specify the maximum size of WAL files
4409 that
<link linkend=
"streaming-replication-slots">replication
4410 slots
</link> are allowed to retain in the
<filename>pg_wal
</filename>
4411 directory at checkpoint time.
4412 If
<varname>max_slot_wal_keep_size
</varname> is -
1 (the default),
4413 replication slots may retain an unlimited amount of WAL files. Otherwise, if
4414 restart_lsn of a replication slot falls behind the current LSN by more
4415 than the given size, the standby using the slot may no longer be able
4416 to continue replication due to removal of required WAL files. You
4417 can see the WAL availability of replication slots
4418 in
<link linkend=
"view-pg-replication-slots">pg_replication_slots
</link>.
4419 If this value is specified without units, it is taken as megabytes.
4420 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4421 file or on the server command line.
4426 <varlistentry id=
"guc-wal-sender-timeout" xreflabel=
"wal_sender_timeout">
4427 <term><varname>wal_sender_timeout
</varname> (
<type>integer
</type>)
4429 <primary><varname>wal_sender_timeout
</varname> configuration parameter
</primary>
4434 Terminate replication connections that are inactive for longer
4435 than this amount of time. This is useful for
4436 the sending server to detect a standby crash or network outage.
4437 If this value is specified without units, it is taken as milliseconds.
4438 The default value is
60 seconds.
4439 A value of zero disables the timeout mechanism.
4442 With a cluster distributed across multiple geographic
4443 locations, using different values per location brings more flexibility
4444 in the cluster management. A smaller value is useful for faster
4445 failure detection with a standby having a low-latency network
4446 connection, and a larger value helps in judging better the health
4447 of a standby if located on a remote location, with a high-latency
4453 <varlistentry id=
"guc-track-commit-timestamp" xreflabel=
"track_commit_timestamp">
4454 <term><varname>track_commit_timestamp
</varname> (
<type>boolean
</type>)
4456 <primary><varname>track_commit_timestamp
</varname> configuration parameter
</primary>
4461 Record commit time of transactions. This parameter
4462 can only be set in
<filename>postgresql.conf
</filename> file or on the server
4463 command line. The default value is
<literal>off
</literal>.
4468 <varlistentry id=
"guc-synchronized-standby-slots" xreflabel=
"synchronized_standby_slots">
4469 <term><varname>synchronized_standby_slots
</varname> (
<type>string
</type>)
4471 <primary><varname>synchronized_standby_slots
</varname> configuration parameter
</primary>
4476 A comma-separated list of streaming replication standby server slot names
4477 that logical WAL sender processes will wait for. Logical WAL sender processes
4478 will send decoded changes to plugins only after the specified replication
4479 slots confirm receiving WAL. This guarantees that logical replication
4480 failover slots do not consume changes until those changes are received
4481 and flushed to corresponding physical standbys. If a
4482 logical replication connection is meant to switch to a physical standby
4483 after the standby is promoted, the physical replication slot for the
4484 standby should be listed here. Note that logical replication will not
4485 proceed if the slots specified in the
4486 <varname>synchronized_standby_slots
</varname> do not exist or are invalidated.
4487 Additionally, the replication management functions
4488 <link linkend=
"pg-replication-slot-advance">
4489 <function>pg_replication_slot_advance
</function></link>,
4490 <link linkend=
"pg-logical-slot-get-changes">
4491 <function>pg_logical_slot_get_changes
</function></link>, and
4492 <link linkend=
"pg-logical-slot-peek-changes">
4493 <function>pg_logical_slot_peek_changes
</function></link>,
4494 when used with logical failover slots, will block until all
4495 physical slots specified in
<varname>synchronized_standby_slots
</varname> have
4496 confirmed WAL receipt.
4499 The standbys corresponding to the physical replication slots in
4500 <varname>synchronized_standby_slots
</varname> must configure
4501 <literal>sync_replication_slots = true
</literal> so they can receive
4502 logical failover slot changes from the primary.
4510 <sect2 id=
"runtime-config-replication-primary">
4511 <title>Primary Server
</title>
4514 These parameters can be set on the primary server that is
4515 to send replication data to one or more standby servers.
4516 Note that in addition to these parameters,
4517 <xref linkend=
"guc-wal-level"/> must be set appropriately on the primary
4518 server, and optionally WAL archiving can be enabled as
4519 well (see
<xref linkend=
"runtime-config-wal-archiving"/>).
4520 The values of these parameters on standby servers are irrelevant,
4521 although you may wish to set them there in preparation for the
4522 possibility of a standby becoming the primary.
4527 <varlistentry id=
"guc-synchronous-standby-names" xreflabel=
"synchronous_standby_names">
4528 <term><varname>synchronous_standby_names
</varname> (
<type>string
</type>)
4530 <primary><varname>synchronous_standby_names
</varname> configuration parameter
</primary>
4535 Specifies a list of standby servers that can support
4536 <firstterm>synchronous replication
</firstterm>, as described in
4537 <xref linkend=
"synchronous-replication"/>.
4538 There will be one or more active synchronous standbys;
4539 transactions waiting for commit will be allowed to proceed after
4540 these standby servers confirm receipt of their data.
4541 The synchronous standbys will be those whose names appear
4543 that are both currently connected and streaming data in real-time
4544 (as shown by a state of
<literal>streaming
</literal> in the
4545 <link linkend=
"monitoring-pg-stat-replication-view">
4546 <structname>pg_stat_replication
</structname></link> view).
4547 Specifying more than one synchronous standby can allow for very high
4548 availability and protection against data loss.
4551 The name of a standby server for this purpose is the
4552 <varname>application_name
</varname> setting of the standby, as set in the
4553 standby's connection information. In case of a physical replication
4554 standby, this should be set in the
<varname>primary_conninfo
</varname>
4555 setting; the default is the setting of
<xref linkend=
"guc-cluster-name"/>
4556 if set, else
<literal>walreceiver
</literal>.
4557 For logical replication, this can be set in the connection
4558 information of the subscription, and it defaults to the
4559 subscription name. For other replication stream consumers,
4560 consult their documentation.
4563 This parameter specifies a list of standby servers using
4564 either of the following syntaxes:
4566 [FIRST]
<replaceable class=
"parameter">num_sync
</replaceable> (
<replaceable class=
"parameter">standby_name
</replaceable> [, ...] )
4567 ANY
<replaceable class=
"parameter">num_sync
</replaceable> (
<replaceable class=
"parameter">standby_name
</replaceable> [, ...] )
4568 <replaceable class=
"parameter">standby_name
</replaceable> [, ...]
4570 where
<replaceable class=
"parameter">num_sync
</replaceable> is
4571 the number of synchronous standbys that transactions need to
4572 wait for replies from,
4573 and
<replaceable class=
"parameter">standby_name
</replaceable>
4574 is the name of a standby server.
4575 <replaceable class=
"parameter">num_sync
</replaceable>
4576 must be an integer value greater than zero.
4577 <literal>FIRST
</literal> and
<literal>ANY
</literal> specify the method to choose
4578 synchronous standbys from the listed servers.
4581 The keyword
<literal>FIRST
</literal>, coupled with
4582 <replaceable class=
"parameter">num_sync
</replaceable>, specifies a
4583 priority-based synchronous replication and makes transaction commits
4584 wait until their WAL records are replicated to
4585 <replaceable class=
"parameter">num_sync
</replaceable> synchronous
4586 standbys chosen based on their priorities. For example, a setting of
4587 <literal>FIRST
3 (s1, s2, s3, s4)
</literal> will cause each commit to wait for
4588 replies from three higher-priority standbys chosen from standby servers
4589 <literal>s1
</literal>,
<literal>s2
</literal>,
<literal>s3
</literal> and
<literal>s4
</literal>.
4590 The standbys whose names appear earlier in the list are given higher
4591 priority and will be considered as synchronous. Other standby servers
4592 appearing later in this list represent potential synchronous standbys.
4593 If any of the current synchronous standbys disconnects for whatever
4594 reason, it will be replaced immediately with the next-highest-priority
4595 standby. The keyword
<literal>FIRST
</literal> is optional.
4598 The keyword
<literal>ANY
</literal>, coupled with
4599 <replaceable class=
"parameter">num_sync
</replaceable>, specifies a
4600 quorum-based synchronous replication and makes transaction commits
4601 wait until their WAL records are replicated to
<emphasis>at least
</emphasis>
4602 <replaceable class=
"parameter">num_sync
</replaceable> listed standbys.
4603 For example, a setting of
<literal>ANY
3 (s1, s2, s3, s4)
</literal> will cause
4604 each commit to proceed as soon as at least any three standbys of
4605 <literal>s1
</literal>,
<literal>s2
</literal>,
<literal>s3
</literal> and
<literal>s4
</literal>
4609 <literal>FIRST
</literal> and
<literal>ANY
</literal> are case-insensitive. If these
4610 keywords are used as the name of a standby server,
4611 its
<replaceable class=
"parameter">standby_name
</replaceable> must
4615 The third syntax was used before
<productname>PostgreSQL
</productname>
4616 version
9.6 and is still supported. It's the same as the first syntax
4617 with
<literal>FIRST
</literal> and
4618 <replaceable class=
"parameter">num_sync
</replaceable> equal to
1.
4619 For example,
<literal>FIRST
1 (s1, s2)
</literal> and
<literal>s1, s2
</literal> have
4620 the same meaning: either
<literal>s1
</literal> or
<literal>s2
</literal> is chosen
4621 as a synchronous standby.
4624 The special entry
<literal>*
</literal> matches any standby name.
4627 There is no mechanism to enforce uniqueness of standby names. In case
4628 of duplicates one of the matching standbys will be considered as
4629 higher priority, though exactly which one is indeterminate.
4633 Each
<replaceable class=
"parameter">standby_name
</replaceable>
4634 should have the form of a valid SQL identifier, unless it
4635 is
<literal>*
</literal>. You can use double-quoting if necessary. But note
4636 that
<replaceable class=
"parameter">standby_name
</replaceable>s are
4637 compared to standby application names case-insensitively, whether
4638 double-quoted or not.
4642 If no synchronous standby names are specified here, then synchronous
4643 replication is not enabled and transaction commits will not wait for
4644 replication. This is the default configuration. Even when
4645 synchronous replication is enabled, individual transactions can be
4646 configured not to wait for replication by setting the
4647 <xref linkend=
"guc-synchronous-commit"/> parameter to
4648 <literal>local
</literal> or
<literal>off
</literal>.
4651 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4652 file or on the server command line.
4660 <sect2 id=
"runtime-config-replication-standby">
4661 <title>Standby Servers
</title>
4664 These settings control the behavior of a
4665 <link linkend=
"standby-server-operation">standby server
</link>
4667 to receive replication data. Their values on the primary server
4673 <varlistentry id=
"guc-primary-conninfo" xreflabel=
"primary_conninfo">
4674 <term><varname>primary_conninfo
</varname> (
<type>string
</type>)
4676 <primary><varname>primary_conninfo
</varname> configuration parameter
</primary>
4681 Specifies a connection string to be used for the standby server
4682 to connect with a sending server. This string is in the format
4683 described in
<xref linkend=
"libpq-connstring"/>. If any option is
4684 unspecified in this string, then the corresponding environment
4685 variable (see
<xref linkend=
"libpq-envars"/>) is checked. If the
4686 environment variable is not set either, then
4690 The connection string should specify the host name (or address)
4691 of the sending server, as well as the port number if it is not
4692 the same as the standby server's default.
4693 Also specify a user name corresponding to a suitably-privileged role
4694 on the sending server (see
4695 <xref linkend=
"streaming-replication-authentication"/>).
4696 A password needs to be provided too, if the sender demands password
4697 authentication. It can be provided in the
4698 <varname>primary_conninfo
</varname> string, or in a separate
4699 <filename>~/.pgpass
</filename> file on the standby server (use
4700 <literal>replication
</literal> as the database name).
4703 For replication slot synchronization (see
4704 <xref linkend=
"logicaldecoding-replication-slots-synchronization"/>),
4705 it is also necessary to specify a valid
<literal>dbname
</literal>
4706 in the
<varname>primary_conninfo
</varname> string. This will only be
4707 used for slot synchronization. It is ignored for streaming.
4710 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4711 file or on the server command line.
4712 If this parameter is changed while the WAL receiver process is
4713 running, that process is signaled to shut down and expected to
4714 restart with the new setting (except if
<varname>primary_conninfo
</varname>
4715 is an empty string).
4716 This setting has no effect if the server is not in standby mode.
4720 <varlistentry id=
"guc-primary-slot-name" xreflabel=
"primary_slot_name">
4721 <term><varname>primary_slot_name
</varname> (
<type>string
</type>)
4723 <primary><varname>primary_slot_name
</varname> configuration parameter
</primary>
4728 Optionally specifies an existing replication slot to be used when
4729 connecting to the sending server via streaming replication to control
4730 resource removal on the upstream node
4731 (see
<xref linkend=
"streaming-replication-slots"/>).
4732 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4733 file or on the server command line.
4734 If this parameter is changed while the WAL receiver process is running,
4735 that process is signaled to shut down and expected to restart with the
4737 This setting has no effect if
<varname>primary_conninfo
</varname> is not
4738 set or the server is not in standby mode.
4743 <varlistentry id=
"guc-hot-standby" xreflabel=
"hot_standby">
4744 <term><varname>hot_standby
</varname> (
<type>boolean
</type>)
4746 <primary><varname>hot_standby
</varname> configuration parameter
</primary>
4751 Specifies whether or not you can connect and run queries during
4752 recovery, as described in
<xref linkend=
"hot-standby"/>.
4753 The default value is
<literal>on
</literal>.
4754 This parameter can only be set at server start. It only has effect
4755 during archive recovery or in standby mode.
4760 <varlistentry id=
"guc-max-standby-archive-delay" xreflabel=
"max_standby_archive_delay">
4761 <term><varname>max_standby_archive_delay
</varname> (
<type>integer
</type>)
4763 <primary><varname>max_standby_archive_delay
</varname> configuration parameter
</primary>
4768 When hot standby is active, this parameter determines how long the
4769 standby server should wait before canceling standby queries that
4770 conflict with about-to-be-applied WAL entries, as described in
4771 <xref linkend=
"hot-standby-conflict"/>.
4772 <varname>max_standby_archive_delay
</varname> applies when WAL data is
4773 being read from WAL archive (and is therefore not current).
4774 If this value is specified without units, it is taken as milliseconds.
4775 The default is
30 seconds.
4776 A value of -
1 allows the standby to wait forever for conflicting
4777 queries to complete.
4778 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4779 file or on the server command line.
4782 Note that
<varname>max_standby_archive_delay
</varname> is not the same as the
4783 maximum length of time a query can run before cancellation; rather it
4784 is the maximum total time allowed to apply any one WAL segment's data.
4785 Thus, if one query has resulted in significant delay earlier in the
4786 WAL segment, subsequent conflicting queries will have much less grace
4792 <varlistentry id=
"guc-max-standby-streaming-delay" xreflabel=
"max_standby_streaming_delay">
4793 <term><varname>max_standby_streaming_delay
</varname> (
<type>integer
</type>)
4795 <primary><varname>max_standby_streaming_delay
</varname> configuration parameter
</primary>
4800 When hot standby is active, this parameter determines how long the
4801 standby server should wait before canceling standby queries that
4802 conflict with about-to-be-applied WAL entries, as described in
4803 <xref linkend=
"hot-standby-conflict"/>.
4804 <varname>max_standby_streaming_delay
</varname> applies when WAL data is
4805 being received via streaming replication.
4806 If this value is specified without units, it is taken as milliseconds.
4807 The default is
30 seconds.
4808 A value of -
1 allows the standby to wait forever for conflicting
4809 queries to complete.
4810 This parameter can only be set in the
<filename>postgresql.conf
</filename>
4811 file or on the server command line.
4814 Note that
<varname>max_standby_streaming_delay
</varname> is not the same as
4815 the maximum length of time a query can run before cancellation; rather
4816 it is the maximum total time allowed to apply WAL data once it has
4817 been received from the primary server. Thus, if one query has
4818 resulted in significant delay, subsequent conflicting queries will
4819 have much less grace time until the standby server has caught up
4825 <varlistentry id=
"guc-wal-receiver-create-temp-slot" xreflabel=
"wal_receiver_create_temp_slot">
4826 <term><varname>wal_receiver_create_temp_slot
</varname> (
<type>boolean
</type>)
4828 <primary><varname>wal_receiver_create_temp_slot
</varname> configuration parameter
</primary>
4833 Specifies whether the WAL receiver process should create a temporary replication
4834 slot on the remote instance when no permanent replication slot to use
4835 has been configured (using
<xref linkend=
"guc-primary-slot-name"/>).
4836 The default is off. This parameter can only be set in the
4837 <filename>postgresql.conf
</filename> 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
4845 <varlistentry id=
"guc-wal-receiver-status-interval" xreflabel=
"wal_receiver_status_interval">
4846 <term><varname>wal_receiver_status_interval
</varname> (
<type>integer
</type>)
4848 <primary><varname>wal_receiver_status_interval
</varname> configuration parameter
</primary>
4853 Specifies the minimum frequency for the WAL receiver
4854 process on the standby to send information about replication progress
4855 to the primary or upstream standby, where it can be seen using the
4856 <link linkend=
"monitoring-pg-stat-replication-view">
4857 <structname>pg_stat_replication
</structname></link>
4858 view. The standby will report
4859 the last write-ahead log location it has written, the last position it
4860 has flushed to disk, and the last position it has applied.
4861 This parameter's value is the maximum amount of time between reports.
4862 Updates are sent each time the write or flush positions change, or as
4863 often as specified by this parameter if set to a non-zero value.
4864 There are additional cases where updates are sent while ignoring this
4865 parameter; for example, when processing of the existing WAL completes
4866 or when
<varname>synchronous_commit
</varname> is set to
4867 <literal>remote_apply
</literal>.
4868 Thus, the apply position may lag slightly behind the true position.
4869 If this value is specified without units, it is taken as seconds.
4870 The default value is
10 seconds. This parameter can only be set in
4871 the
<filename>postgresql.conf
</filename> file or on the server
4877 <varlistentry id=
"guc-hot-standby-feedback" xreflabel=
"hot_standby_feedback">
4878 <term><varname>hot_standby_feedback
</varname> (
<type>boolean
</type>)
4880 <primary><varname>hot_standby_feedback
</varname> configuration parameter
</primary>
4885 Specifies whether or not a hot standby will send feedback to the primary
4887 about queries currently executing on the standby. This parameter can
4888 be used to eliminate query cancels caused by cleanup records, but
4889 can cause database bloat on the primary for some workloads.
4890 Feedback messages will not be sent more frequently than once per
4891 <varname>wal_receiver_status_interval
</varname>. The default value is
4892 <literal>off
</literal>. This parameter can only be set in the
4893 <filename>postgresql.conf
</filename> file or on the server command line.
4896 If cascaded replication is in use the feedback is passed upstream
4897 until it eventually reaches the primary. Standbys make no other use
4898 of feedback they receive other than to pass upstream.
4903 <varlistentry id=
"guc-wal-receiver-timeout" xreflabel=
"wal_receiver_timeout">
4904 <term><varname>wal_receiver_timeout
</varname> (
<type>integer
</type>)
4906 <primary><varname>wal_receiver_timeout
</varname> configuration parameter
</primary>
4911 Terminate replication connections that are inactive for longer
4912 than this amount of time. This is useful for
4913 the receiving standby server to detect a primary node crash or network
4915 If this value is specified without units, it is taken as milliseconds.
4916 The default value is
60 seconds.
4917 A value of zero disables the timeout mechanism.
4918 This parameter can only be set in
4919 the
<filename>postgresql.conf
</filename> file or on the server
4925 <varlistentry id=
"guc-wal-retrieve-retry-interval" xreflabel=
"wal_retrieve_retry_interval">
4926 <term><varname>wal_retrieve_retry_interval
</varname> (
<type>integer
</type>)
4928 <primary><varname>wal_retrieve_retry_interval
</varname> configuration parameter
</primary>
4933 Specifies how long the standby server should wait when WAL data is not
4934 available from any sources (streaming replication,
4935 local
<filename>pg_wal
</filename> or WAL archive) before trying
4936 again to retrieve WAL data.
4937 If this value is specified without units, it is taken as milliseconds.
4938 The default value is
5 seconds.
4939 This parameter can only be set in
4940 the
<filename>postgresql.conf
</filename> file or on the server
4944 This parameter is useful in configurations where a node in recovery
4945 needs to control the amount of time to wait for new WAL data to be
4946 available. For example, in archive recovery, it is possible to
4947 make the recovery more responsive in the detection of a new WAL
4948 file by reducing the value of this parameter. On a system with
4949 low WAL activity, increasing it reduces the amount of requests necessary
4950 to access WAL archives, something useful for example in cloud
4951 environments where the number of times an infrastructure is accessed
4952 is taken into account.
4955 In logical replication, this parameter also limits how often a failing
4956 replication apply worker will be respawned.
4961 <varlistentry id=
"guc-recovery-min-apply-delay" xreflabel=
"recovery_min_apply_delay">
4962 <term><varname>recovery_min_apply_delay
</varname> (
<type>integer
</type>)
4964 <primary><varname>recovery_min_apply_delay
</varname> configuration parameter
</primary>
4969 By default, a standby server restores WAL records from the
4970 sending server as soon as possible. It may be useful to have a time-delayed
4971 copy of the data, offering opportunities to correct data loss errors.
4972 This parameter allows you to delay recovery by a specified amount
4973 of time. For example, if
4974 you set this parameter to
<literal>5min
</literal>, the standby will
4975 replay each transaction commit only when the system time on the standby
4976 is at least five minutes past the commit time reported by the primary.
4977 If this value is specified without units, it is taken as milliseconds.
4978 The default is zero, adding no delay.
4981 It is possible that the replication delay between servers exceeds the
4982 value of this parameter, in which case no delay is added.
4983 Note that the delay is calculated between the WAL time stamp as written
4984 on primary and the current time on the standby. Delays in transfer
4985 because of network lag or cascading replication configurations
4986 may reduce the actual wait time significantly. If the system
4987 clocks on primary and standby are not synchronized, this may lead to
4988 recovery applying records earlier than expected; but that is not a
4989 major issue because useful settings of this parameter are much larger
4990 than typical time deviations between servers.
4993 The delay occurs only on WAL records for transaction commits.
4994 Other records are replayed as quickly as possible, which
4995 is not a problem because MVCC visibility rules ensure their effects
4996 are not visible until the corresponding commit record is applied.
4999 The delay occurs once the database in recovery has reached a consistent
5000 state, until the standby is promoted or triggered. After that the standby
5001 will end recovery without further waiting.
5004 WAL records must be kept on the standby until they are ready to be
5005 applied. Therefore, longer delays will result in a greater accumulation
5006 of WAL files, increasing disk space requirements for the standby's
5007 <filename>pg_wal
</filename> directory.
5010 This parameter is intended for use with streaming replication deployments;
5011 however, if the parameter is specified it will be honored in all cases
5012 except crash recovery.
5014 <varname>hot_standby_feedback
</varname> will be delayed by use of this feature
5015 which could lead to bloat on the primary; use both together with care.
5019 Synchronous replication is affected by this setting when
<varname>synchronous_commit
</varname>
5020 is set to
<literal>remote_apply
</literal>; every
<literal>COMMIT
</literal>
5021 will need to wait to be applied.
5026 This parameter can only be set in the
<filename>postgresql.conf
</filename>
5027 file or on the server command line.
5032 <varlistentry id=
"guc-sync-replication-slots" xreflabel=
"sync_replication_slots">
5033 <term><varname>sync_replication_slots
</varname> (
<type>boolean
</type>)
5035 <primary><varname>sync_replication_slots
</varname> configuration parameter
</primary>
5040 It enables a physical standby to synchronize logical failover slots
5041 from the primary server so that logical subscribers can resume
5042 replication from the new primary server after failover.
5045 It is disabled by default. This parameter can only be set in the
5046 <filename>postgresql.conf
</filename> file or on the server command line.
5053 <sect2 id=
"runtime-config-replication-subscriber">
5054 <title>Subscribers
</title>
5057 These settings control the behavior of a logical replication subscriber.
5058 Their values on the publisher are irrelevant.
5059 See
<xref linkend=
"logical-replication-config"/> for more details.
5064 <varlistentry id=
"guc-max-replication-slots-subscriber" xreflabel=
"max_replication_slots">
5065 <term><varname>max_replication_slots
</varname> (
<type>integer
</type>)
5067 <primary><varname>max_replication_slots
</varname> configuration parameter
</primary>
5068 <secondary>in a subscriber
</secondary>
5073 Specifies how many replication origins (see
5074 <xref linkend=
"replication-origins"/>) can be tracked simultaneously,
5075 effectively limiting how many logical replication subscriptions can
5076 be created on the server. Setting it to a lower value than the current
5077 number of tracked replication origins (reflected in
5078 <link linkend=
"view-pg-replication-origin-status">pg_replication_origin_status
</link>)
5079 will prevent the server from starting.
5080 <literal>max_replication_slots
</literal> must be set to at least the
5081 number of subscriptions that will be added to the subscriber, plus some
5082 reserve for table synchronization.
5086 Note that this parameter also applies on a sending server, but with
5087 a different meaning. See
<xref linkend=
"guc-max-replication-slots"/>
5088 in
<xref linkend=
"runtime-config-replication-sender"/> for more
5094 <varlistentry id=
"guc-max-logical-replication-workers" xreflabel=
"max_logical_replication_workers">
5095 <term><varname>max_logical_replication_workers
</varname> (
<type>integer
</type>)
5097 <primary><varname>max_logical_replication_workers
</varname> configuration parameter
</primary>
5102 Specifies maximum number of logical replication workers. This includes
5103 leader apply workers, parallel apply workers, and table synchronization
5107 Logical replication workers are taken from the pool defined by
5108 <varname>max_worker_processes
</varname>.
5111 The default value is
4. This parameter can only be set at server
5117 <varlistentry id=
"guc-max-sync-workers-per-subscription" xreflabel=
"max_sync_workers_per_subscription">
5118 <term><varname>max_sync_workers_per_subscription
</varname> (
<type>integer
</type>)
5120 <primary><varname>max_sync_workers_per_subscription
</varname> configuration parameter
</primary>
5125 Maximum number of synchronization workers per subscription. This
5126 parameter controls the amount of parallelism of the initial data copy
5127 during the subscription initialization or when new tables are added.
5130 Currently, there can be only one synchronization worker per table.
5133 The synchronization workers are taken from the pool defined by
5134 <varname>max_logical_replication_workers
</varname>.
5137 The default value is
2. This parameter can only be set in the
5138 <filename>postgresql.conf
</filename> file or on the server command
5144 <varlistentry id=
"guc-max-parallel-apply-workers-per-subscription" xreflabel=
"max_parallel_apply_workers_per_subscription">
5145 <term><varname>max_parallel_apply_workers_per_subscription
</varname> (
<type>integer
</type>)
5147 <primary><varname>max_parallel_apply_workers_per_subscription
</varname> configuration parameter
</primary>
5152 Maximum number of parallel apply workers per subscription. This
5153 parameter controls the amount of parallelism for streaming of
5154 in-progress transactions with subscription parameter
5155 <literal>streaming = parallel
</literal>.
5158 The parallel apply workers are taken from the pool defined by
5159 <varname>max_logical_replication_workers
</varname>.
5162 The default value is
2. This parameter can only be set in the
5163 <filename>postgresql.conf
</filename> file or on the server command
5174 <sect1 id=
"runtime-config-query">
5175 <title>Query Planning
</title>
5177 <sect2 id=
"runtime-config-query-enable">
5178 <title>Planner Method Configuration
</title>
5181 These configuration parameters provide a crude method of
5182 influencing the query plans chosen by the query optimizer. If
5183 the default plan chosen by the optimizer for a particular query
5184 is not optimal, a
<emphasis>temporary
</emphasis> solution is to use one
5185 of these configuration parameters to force the optimizer to
5186 choose a different plan.
5187 Better ways to improve the quality of the
5188 plans chosen by the optimizer include adjusting the planner cost
5189 constants (see
<xref linkend=
"runtime-config-query-constants"/>),
5190 running
<link linkend=
"sql-analyze"><command>ANALYZE
</command></link> manually, increasing
5191 the value of the
<xref
5192 linkend=
"guc-default-statistics-target"/> configuration parameter,
5193 and increasing the amount of statistics collected for
5194 specific columns using
<command>ALTER TABLE SET
5195 STATISTICS
</command>.
5199 <varlistentry id=
"guc-enable-async-append" xreflabel=
"enable_async_append">
5200 <term><varname>enable_async_append
</varname> (
<type>boolean
</type>)
5202 <primary><varname>enable_async_append
</varname> configuration parameter
</primary>
5207 Enables or disables the query planner's use of async-aware
5208 append plan types. The default is
<literal>on
</literal>.
5213 <varlistentry id=
"guc-enable-bitmapscan" xreflabel=
"enable_bitmapscan">
5214 <term><varname>enable_bitmapscan
</varname> (
<type>boolean
</type>)
5216 <primary>bitmap scan
</primary>
5219 <primary><varname>enable_bitmapscan
</varname> configuration parameter
</primary>
5224 Enables or disables the query planner's use of bitmap-scan plan
5225 types. The default is
<literal>on
</literal>.
5230 <varlistentry id=
"guc-enable-distinct-reordering" xreflabel=
"enable_distinct_reordering">
5231 <term><varname>enable_distinct_reordering
</varname> (
<type>boolean
</type>)
5233 <primary><varname>enable_distinct_reordering
</varname> configuration parameter
</primary>
5238 Enables or disables the query planner's ability to reorder DISTINCT
5239 keys to match the input path's pathkeys. The default is
<literal>on
</literal>.
5244 <varlistentry id=
"guc-enable-gathermerge" xreflabel=
"enable_gathermerge">
5245 <term><varname>enable_gathermerge
</varname> (
<type>boolean
</type>)
5247 <primary><varname>enable_gathermerge
</varname> configuration parameter
</primary>
5252 Enables or disables the query planner's use of gather
5253 merge plan types. The default is
<literal>on
</literal>.
5258 <varlistentry id=
"guc-enable-groupby-reordering" xreflabel=
"enable_group_by_reordering">
5259 <term><varname>enable_group_by_reordering
</varname> (
<type>boolean
</type>)
5261 <primary><varname>enable_group_by_reordering
</varname> configuration parameter
</primary>
5266 Controls if the query planner will produce a plan which will provide
5267 <literal>GROUP BY
</literal> keys sorted in the order of keys of
5268 a child node of the plan, such as an index scan. When disabled, the
5269 query planner will produce a plan with
<literal>GROUP BY
</literal>
5270 keys only sorted to match the
<literal>ORDER BY
</literal> clause,
5271 if any. When enabled, the planner will try to produce a more
5272 efficient plan. The default value is
<literal>on
</literal>.
5277 <varlistentry id=
"guc-enable-hashagg" xreflabel=
"enable_hashagg">
5278 <term><varname>enable_hashagg
</varname> (
<type>boolean
</type>)
5280 <primary><varname>enable_hashagg
</varname> configuration parameter
</primary>
5285 Enables or disables the query planner's use of hashed
5286 aggregation plan types. The default is
<literal>on
</literal>.
5291 <varlistentry id=
"guc-enable-hashjoin" xreflabel=
"enable_hashjoin">
5292 <term><varname>enable_hashjoin
</varname> (
<type>boolean
</type>)
5294 <primary><varname>enable_hashjoin
</varname> configuration parameter
</primary>
5299 Enables or disables the query planner's use of hash-join plan
5300 types. The default is
<literal>on
</literal>.
5305 <varlistentry id=
"guc-enable-incremental-sort" xreflabel=
"enable_incremental_sort">
5306 <term><varname>enable_incremental_sort
</varname> (
<type>boolean
</type>)
5308 <primary><varname>enable_incremental_sort
</varname> configuration parameter
</primary>
5313 Enables or disables the query planner's use of incremental sort steps.
5314 The default is
<literal>on
</literal>.
5319 <varlistentry id=
"guc-enable-indexscan" xreflabel=
"enable_indexscan">
5320 <term><varname>enable_indexscan
</varname> (
<type>boolean
</type>)
5322 <primary>index scan
</primary>
5325 <primary><varname>enable_indexscan
</varname> configuration parameter
</primary>
5330 Enables or disables the query planner's use of index-scan and
5331 index-only-scan plan types. The default is
<literal>on
</literal>.
5332 Also see
<xref linkend=
"guc-enable-indexonlyscan"/>.
5337 <varlistentry id=
"guc-enable-indexonlyscan" xreflabel=
"enable_indexonlyscan">
5338 <term><varname>enable_indexonlyscan
</varname> (
<type>boolean
</type>)
5340 <primary><varname>enable_indexonlyscan
</varname> configuration parameter
</primary>
5345 Enables or disables the query planner's use of index-only-scan plan
5346 types (see
<xref linkend=
"indexes-index-only-scans"/>).
5347 The default is
<literal>on
</literal>. The
5348 <xref linkend=
"guc-enable-indexscan"/> setting must also be
5349 enabled to have the query planner consider index-only-scans.
5354 <varlistentry id=
"guc-enable-material" xreflabel=
"enable_material">
5355 <term><varname>enable_material
</varname> (
<type>boolean
</type>)
5357 <primary><varname>enable_material
</varname> configuration parameter
</primary>
5362 Enables or disables the query planner's use of materialization.
5363 It is impossible to suppress materialization entirely,
5364 but turning this variable off prevents the planner from inserting
5365 materialize nodes except in cases where it is required for correctness.
5366 The default is
<literal>on
</literal>.
5371 <varlistentry id=
"guc-enable-memoize" xreflabel=
"enable_memoize">
5372 <term><varname>enable_memoize
</varname> (
<type>boolean
</type>)
5374 <primary><varname>enable_memoize
</varname> configuration parameter
</primary>
5379 Enables or disables the query planner's use of memoize plans for
5380 caching results from parameterized scans inside nested-loop joins.
5381 This plan type allows scans to the underlying plans to be skipped when
5382 the results for the current parameters are already in the cache. Less
5383 commonly looked up results may be evicted from the cache when more
5384 space is required for new entries. The default is
5385 <literal>on
</literal>.
5390 <varlistentry id=
"guc-enable-mergejoin" xreflabel=
"enable_mergejoin">
5391 <term><varname>enable_mergejoin
</varname> (
<type>boolean
</type>)
5393 <primary><varname>enable_mergejoin
</varname> configuration parameter
</primary>
5398 Enables or disables the query planner's use of merge-join plan
5399 types. The default is
<literal>on
</literal>.
5404 <varlistentry id=
"guc-enable-nestloop" xreflabel=
"enable_nestloop">
5405 <term><varname>enable_nestloop
</varname> (
<type>boolean
</type>)
5407 <primary><varname>enable_nestloop
</varname> configuration parameter
</primary>
5412 Enables or disables the query planner's use of nested-loop join
5413 plans. It is impossible to suppress nested-loop joins entirely,
5414 but turning this variable off discourages the planner from using
5415 one if there are other methods available. The default is
5416 <literal>on
</literal>.
5421 <varlistentry id=
"guc-enable-parallel-append" xreflabel=
"enable_parallel_append">
5422 <term><varname>enable_parallel_append
</varname> (
<type>boolean
</type>)
5424 <primary><varname>enable_parallel_append
</varname> configuration parameter
</primary>
5429 Enables or disables the query planner's use of parallel-aware
5430 append plan types. The default is
<literal>on
</literal>.
5435 <varlistentry id=
"guc-enable-parallel-hash" xreflabel=
"enable_parallel_hash">
5436 <term><varname>enable_parallel_hash
</varname> (
<type>boolean
</type>)
5438 <primary><varname>enable_parallel_hash
</varname> configuration parameter
</primary>
5443 Enables or disables the query planner's use of hash-join plan
5444 types with parallel hash. Has no effect if hash-join plans are not
5445 also enabled. The default is
<literal>on
</literal>.
5450 <varlistentry id=
"guc-enable-partition-pruning" xreflabel=
"enable_partition_pruning">
5451 <term><varname>enable_partition_pruning
</varname> (
<type>boolean
</type>)
5453 <primary><varname>enable_partition_pruning
</varname> configuration parameter
</primary>
5458 Enables or disables the query planner's ability to eliminate a
5459 partitioned table's partitions from query plans. This also controls
5460 the planner's ability to generate query plans which allow the query
5461 executor to remove (ignore) partitions during query execution. The
5462 default is
<literal>on
</literal>.
5463 See
<xref linkend=
"ddl-partition-pruning"/> for details.
5468 <varlistentry id=
"guc-enable-partitionwise-join" xreflabel=
"enable_partitionwise_join">
5469 <term><varname>enable_partitionwise_join
</varname> (
<type>boolean
</type>)
5471 <primary><varname>enable_partitionwise_join
</varname> configuration parameter
</primary>
5476 Enables or disables the query planner's use of partitionwise join,
5477 which allows a join between partitioned tables to be performed by
5478 joining the matching partitions. Partitionwise join currently applies
5479 only when the join conditions include all the partition keys, which
5480 must be of the same data type and have one-to-one matching sets of
5481 child partitions. With this setting enabled, the number of nodes
5482 whose memory usage is restricted by
<varname>work_mem
</varname>
5483 appearing in the final plan can increase linearly according to the
5484 number of partitions being scanned. This can result in a large
5485 increase in overall memory consumption during the execution of the
5486 query. Query planning also becomes significantly more expensive in
5487 terms of memory and CPU. The default value is
<literal>off
</literal>.
5492 <varlistentry id=
"guc-enable-partitionwise-aggregate" xreflabel=
"enable_partitionwise_aggregate">
5493 <term><varname>enable_partitionwise_aggregate
</varname> (
<type>boolean
</type>)
5495 <primary><varname>enable_partitionwise_aggregate
</varname> configuration parameter
</primary>
5500 Enables or disables the query planner's use of partitionwise grouping
5501 or aggregation, which allows grouping or aggregation on partitioned
5502 tables to be performed separately for each partition. If the
5503 <literal>GROUP BY
</literal> clause does not include the partition
5504 keys, only partial aggregation can be performed on a per-partition
5505 basis, and finalization must be performed later. With this setting
5506 enabled, the number of nodes whose memory usage is restricted by
5507 <varname>work_mem
</varname> appearing in the final plan can increase
5508 linearly according to the number of partitions being scanned. This
5509 can result in a large increase in overall memory consumption during
5510 the execution of the query. Query planning also becomes significantly
5511 more expensive in terms of memory and CPU. The default value is
5512 <literal>off
</literal>.
5517 <varlistentry id=
"guc-enable-presorted-aggregate" xreflabel=
"enable_presorted_aggregate">
5518 <term><varname>enable_presorted_aggregate
</varname> (
<type>boolean
</type>)
5520 <primary><varname>enable_presorted_aggregate
</varname> configuration parameter
</primary>
5525 Controls if the query planner will produce a plan which will provide
5526 rows which are presorted in the order required for the query's
5527 <literal>ORDER BY
</literal> /
<literal>DISTINCT
</literal> aggregate
5528 functions. When disabled, the query planner will produce a plan which
5529 will always require the executor to perform a sort before performing
5530 aggregation of each aggregate function containing an
5531 <literal>ORDER BY
</literal> or
<literal>DISTINCT
</literal> clause.
5532 When enabled, the planner will try to produce a more efficient plan
5533 which provides input to the aggregate functions which is presorted in
5534 the order they require for aggregation. The default value is
5535 <literal>on
</literal>.
5540 <varlistentry id=
"guc-enable-seqscan" xreflabel=
"enable_seqscan">
5541 <term><varname>enable_seqscan
</varname> (
<type>boolean
</type>)
5543 <primary>sequential scan
</primary>
5546 <primary><varname>enable_seqscan
</varname> configuration parameter
</primary>
5551 Enables or disables the query planner's use of sequential scan
5552 plan types. It is impossible to suppress sequential scans
5553 entirely, but turning this variable off discourages the planner
5554 from using one if there are other methods available. The
5555 default is
<literal>on
</literal>.
5560 <varlistentry id=
"guc-enable-sort" xreflabel=
"enable_sort">
5561 <term><varname>enable_sort
</varname> (
<type>boolean
</type>)
5563 <primary><varname>enable_sort
</varname> configuration parameter
</primary>
5568 Enables or disables the query planner's use of explicit sort
5569 steps. It is impossible to suppress explicit sorts entirely,
5570 but turning this variable off discourages the planner from
5571 using one if there are other methods available. The default
5572 is
<literal>on
</literal>.
5577 <varlistentry id=
"guc-enable-tidscan" xreflabel=
"enable_tidscan">
5578 <term><varname>enable_tidscan
</varname> (
<type>boolean
</type>)
5580 <primary><varname>enable_tidscan
</varname> configuration parameter
</primary>
5585 Enables or disables the query planner's use of
<acronym>TID
</acronym>
5586 scan plan types. The default is
<literal>on
</literal>.
5593 <sect2 id=
"runtime-config-query-constants">
5594 <title>Planner Cost Constants
</title>
5597 The
<firstterm>cost
</firstterm> variables described in this section are measured
5598 on an arbitrary scale. Only their relative values matter, hence
5599 scaling them all up or down by the same factor will result in no change
5600 in the planner's choices. By default, these cost variables are based on
5601 the cost of sequential page fetches; that is,
5602 <varname>seq_page_cost
</varname> is conventionally set to
<literal>1.0</literal>
5603 and the other cost variables are set with reference to that. But
5604 you can use a different scale if you prefer, such as actual execution
5605 times in milliseconds on a particular machine.
5610 Unfortunately, there is no well-defined method for determining ideal
5611 values for the cost variables. They are best treated as averages over
5612 the entire mix of queries that a particular installation will receive. This
5613 means that changing them on the basis of just a few experiments is very
5620 <varlistentry id=
"guc-seq-page-cost" xreflabel=
"seq_page_cost">
5621 <term><varname>seq_page_cost
</varname> (
<type>floating point
</type>)
5623 <primary><varname>seq_page_cost
</varname> configuration parameter
</primary>
5628 Sets the planner's estimate of the cost of a disk page fetch
5629 that is part of a series of sequential fetches. The default is
1.0.
5630 This value can be overridden for tables and indexes in a particular
5631 tablespace by setting the tablespace parameter of the same name
5632 (see
<xref linkend=
"sql-altertablespace"/>).
5637 <varlistentry id=
"guc-random-page-cost" xreflabel=
"random_page_cost">
5638 <term><varname>random_page_cost
</varname> (
<type>floating point
</type>)
5640 <primary><varname>random_page_cost
</varname> configuration parameter
</primary>
5645 Sets the planner's estimate of the cost of a
5646 non-sequentially-fetched disk page. The default is
4.0.
5647 This value can be overridden for tables and indexes in a particular
5648 tablespace by setting the tablespace parameter of the same name
5649 (see
<xref linkend=
"sql-altertablespace"/>).
5653 Reducing this value relative to
<varname>seq_page_cost
</varname>
5654 will cause the system to prefer index scans; raising it will
5655 make index scans look relatively more expensive. You can raise
5656 or lower both values together to change the importance of disk I/O
5657 costs relative to CPU costs, which are described by the following
5662 Random access to mechanical disk storage is normally much more expensive
5663 than four times sequential access. However, a lower default is used
5664 (
4.0) because the majority of random accesses to disk, such as indexed
5665 reads, are assumed to be in cache. The default value can be thought of
5666 as modeling random access as
40 times slower than sequential, while
5667 expecting
90% of random reads to be cached.
5671 If you believe a
90% cache rate is an incorrect assumption
5672 for your workload, you can increase random_page_cost to better
5673 reflect the true cost of random storage reads. Correspondingly,
5674 if your data is likely to be completely in cache, such as when
5675 the database is smaller than the total server memory, decreasing
5676 random_page_cost can be appropriate. Storage that has a low random
5677 read cost relative to sequential, e.g., solid-state drives, might
5678 also be better modeled with a lower value for random_page_cost,
5679 e.g.,
<literal>1.1</literal>.
5684 Although the system will let you set
<varname>random_page_cost
</varname> to
5685 less than
<varname>seq_page_cost
</varname>, it is not physically sensible
5686 to do so. However, setting them equal makes sense if the database
5687 is entirely cached in RAM, since in that case there is no penalty
5688 for touching pages out of sequence. Also, in a heavily-cached
5689 database you should lower both values relative to the CPU parameters,
5690 since the cost of fetching a page already in RAM is much smaller
5691 than it would normally be.
5697 <varlistentry id=
"guc-cpu-tuple-cost" xreflabel=
"cpu_tuple_cost">
5698 <term><varname>cpu_tuple_cost
</varname> (
<type>floating point
</type>)
5700 <primary><varname>cpu_tuple_cost
</varname> configuration parameter
</primary>
5705 Sets the planner's estimate of the cost of processing
5706 each row during a query.
5707 The default is
0.01.
5712 <varlistentry id=
"guc-cpu-index-tuple-cost" xreflabel=
"cpu_index_tuple_cost">
5713 <term><varname>cpu_index_tuple_cost
</varname> (
<type>floating point
</type>)
5715 <primary><varname>cpu_index_tuple_cost
</varname> configuration parameter
</primary>
5720 Sets the planner's estimate of the cost of processing
5721 each index entry during an index scan.
5722 The default is
0.005.
5727 <varlistentry id=
"guc-cpu-operator-cost" xreflabel=
"cpu_operator_cost">
5728 <term><varname>cpu_operator_cost
</varname> (
<type>floating point
</type>)
5730 <primary><varname>cpu_operator_cost
</varname> configuration parameter
</primary>
5735 Sets the planner's estimate of the cost of processing each
5736 operator or function executed during a query.
5737 The default is
0.0025.
5742 <varlistentry id=
"guc-parallel-setup-cost" xreflabel=
"parallel_setup_cost">
5743 <term><varname>parallel_setup_cost
</varname> (
<type>floating point
</type>)
5745 <primary><varname>parallel_setup_cost
</varname> configuration parameter
</primary>
5750 Sets the planner's estimate of the cost of launching parallel worker
5752 The default is
1000.
5757 <varlistentry id=
"guc-parallel-tuple-cost" xreflabel=
"parallel_tuple_cost">
5758 <term><varname>parallel_tuple_cost
</varname> (
<type>floating point
</type>)
5760 <primary><varname>parallel_tuple_cost
</varname> configuration parameter
</primary>
5765 Sets the planner's estimate of the cost of transferring one tuple
5766 from a parallel worker process to another process.
5772 <varlistentry id=
"guc-min-parallel-table-scan-size" xreflabel=
"min_parallel_table_scan_size">
5773 <term><varname>min_parallel_table_scan_size
</varname> (
<type>integer
</type>)
5775 <primary><varname>min_parallel_table_scan_size
</varname> configuration parameter
</primary>
5780 Sets the minimum amount of table data that must be scanned in order
5781 for a parallel scan to be considered. For a parallel sequential scan,
5782 the amount of table data scanned is always equal to the size of the
5783 table, but when indexes are used the amount of table data
5784 scanned will normally be less.
5785 If this value is specified without units, it is taken as blocks,
5786 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
5787 The default is
8 megabytes (
<literal>8MB
</literal>).
5792 <varlistentry id=
"guc-min-parallel-index-scan-size" xreflabel=
"min_parallel_index_scan_size">
5793 <term><varname>min_parallel_index_scan_size
</varname> (
<type>integer
</type>)
5795 <primary><varname>min_parallel_index_scan_size
</varname> configuration parameter
</primary>
5800 Sets the minimum amount of index data that must be scanned in order
5801 for a parallel scan to be considered. Note that a parallel index scan
5802 typically won't touch the entire index; it is the number of pages
5803 which the planner believes will actually be touched by the scan which
5804 is relevant. This parameter is also used to decide whether a
5805 particular index can participate in a parallel vacuum. See
5806 <xref linkend=
"sql-vacuum"/>.
5807 If this value is specified without units, it is taken as blocks,
5808 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
5809 The default is
512 kilobytes (
<literal>512kB
</literal>).
5814 <varlistentry id=
"guc-effective-cache-size" xreflabel=
"effective_cache_size">
5815 <term><varname>effective_cache_size
</varname> (
<type>integer
</type>)
5817 <primary><varname>effective_cache_size
</varname> configuration parameter
</primary>
5822 Sets the planner's assumption about the effective size of the
5823 disk cache that is available to a single query. This is
5824 factored into estimates of the cost of using an index; a
5825 higher value makes it more likely index scans will be used, a
5826 lower value makes it more likely sequential scans will be
5827 used. When setting this parameter you should consider both
5828 <productname>PostgreSQL
</productname>'s shared buffers and the
5829 portion of the kernel's disk cache that will be used for
5830 <productname>PostgreSQL
</productname> data files, though some
5831 data might exist in both places. Also, take
5832 into account the expected number of concurrent queries on different
5833 tables, since they will have to share the available
5834 space. This parameter has no effect on the size of shared
5835 memory allocated by
<productname>PostgreSQL
</productname>, nor
5836 does it reserve kernel disk cache; it is used only for estimation
5837 purposes. The system also does not assume data remains in
5838 the disk cache between queries.
5839 If this value is specified without units, it is taken as blocks,
5840 that is
<symbol>BLCKSZ
</symbol> bytes, typically
8kB.
5841 The default is
4 gigabytes (
<literal>4GB
</literal>).
5842 (If
<symbol>BLCKSZ
</symbol> is not
8kB, the default value scales
5843 proportionally to it.)
5848 <varlistentry id=
"guc-jit-above-cost" xreflabel=
"jit_above_cost">
5849 <term><varname>jit_above_cost
</varname> (
<type>floating point
</type>)
5851 <primary><varname>jit_above_cost
</varname> configuration parameter
</primary>
5856 Sets the query cost above which JIT compilation is activated, if
5857 enabled (see
<xref linkend=
"jit"/>).
5858 Performing
<acronym>JIT
</acronym> costs planning time but can
5859 accelerate query execution.
5860 Setting this to
<literal>-
1</literal> disables JIT compilation.
5861 The default is
<literal>100000</literal>.
5866 <varlistentry id=
"guc-jit-inline-above-cost" xreflabel=
"jit_inline_above_cost">
5867 <term><varname>jit_inline_above_cost
</varname> (
<type>floating point
</type>)
5869 <primary><varname>jit_inline_above_cost
</varname> configuration parameter
</primary>
5874 Sets the query cost above which JIT compilation attempts to inline
5875 functions and operators. Inlining adds planning time, but can
5876 improve execution speed. It is not meaningful to set this to less
5877 than
<varname>jit_above_cost
</varname>.
5878 Setting this to
<literal>-
1</literal> disables inlining.
5879 The default is
<literal>500000</literal>.
5884 <varlistentry id=
"guc-jit-optimize-above-cost" xreflabel=
"jit_optimize_above_cost">
5885 <term><varname>jit_optimize_above_cost
</varname> (
<type>floating point
</type>)
5887 <primary><varname>jit_optimize_above_cost
</varname> configuration parameter
</primary>
5892 Sets the query cost above which JIT compilation applies expensive
5893 optimizations. Such optimization adds planning time, but can improve
5894 execution speed. It is not meaningful to set this to less
5895 than
<varname>jit_above_cost
</varname>, and it is unlikely to be
5896 beneficial to set it to more
5897 than
<varname>jit_inline_above_cost
</varname>.
5898 Setting this to
<literal>-
1</literal> disables expensive optimizations.
5899 The default is
<literal>500000</literal>.
5907 <sect2 id=
"runtime-config-query-geqo">
5908 <title>Genetic Query Optimizer
</title>
5911 The genetic query optimizer (GEQO) is an algorithm that does query
5912 planning using heuristic searching. This reduces planning time for
5913 complex queries (those joining many relations), at the cost of producing
5914 plans that are sometimes inferior to those found by the normal
5915 exhaustive-search algorithm.
5916 For more information see
<xref linkend=
"geqo"/>.
5921 <varlistentry id=
"guc-geqo" xreflabel=
"geqo">
5922 <term><varname>geqo
</varname> (
<type>boolean
</type>)
5924 <primary>genetic query optimization
</primary>
5927 <primary>GEQO
</primary>
5928 <see>genetic query optimization
</see>
5931 <primary><varname>geqo
</varname> configuration parameter
</primary>
5936 Enables or disables genetic query optimization.
5937 This is on by default. It is usually best not to turn it off in
5938 production; the
<varname>geqo_threshold
</varname> variable provides
5939 more granular control of GEQO.
5944 <varlistentry id=
"guc-geqo-threshold" xreflabel=
"geqo_threshold">
5945 <term><varname>geqo_threshold
</varname> (
<type>integer
</type>)
5947 <primary><varname>geqo_threshold
</varname> configuration parameter
</primary>
5952 Use genetic query optimization to plan queries with at least
5953 this many
<literal>FROM
</literal> items involved. (Note that a
5954 <literal>FULL OUTER JOIN
</literal> construct counts as only one
<literal>FROM
</literal>
5955 item.) The default is
12. For simpler queries it is usually best
5956 to use the regular, exhaustive-search planner, but for queries with
5957 many tables the exhaustive search takes too long, often
5958 longer than the penalty of executing a suboptimal plan. Thus,
5959 a threshold on the size of the query is a convenient way to manage
5965 <varlistentry id=
"guc-geqo-effort" xreflabel=
"geqo_effort">
5966 <term><varname>geqo_effort
</varname> (
<type>integer
</type>)
5968 <primary><varname>geqo_effort
</varname> configuration parameter
</primary>
5973 Controls the trade-off between planning time and query plan
5974 quality in GEQO. This variable must be an integer in the
5975 range from
1 to
10. The default value is five. Larger values
5976 increase the time spent doing query planning, but also
5977 increase the likelihood that an efficient query plan will be
5982 <varname>geqo_effort
</varname> doesn't actually do anything
5983 directly; it is only used to compute the default values for
5984 the other variables that influence GEQO behavior (described
5985 below). If you prefer, you can set the other parameters by
5991 <varlistentry id=
"guc-geqo-pool-size" xreflabel=
"geqo_pool_size">
5992 <term><varname>geqo_pool_size
</varname> (
<type>integer
</type>)
5994 <primary><varname>geqo_pool_size
</varname> configuration parameter
</primary>
5999 Controls the pool size used by GEQO, that is the
6000 number of individuals in the genetic population. It must be
6001 at least two, and useful values are typically
100 to
1000. If
6002 it is set to zero (the default setting) then a suitable
6003 value is chosen based on
<varname>geqo_effort
</varname> and
6004 the number of tables in the query.
6009 <varlistentry id=
"guc-geqo-generations" xreflabel=
"geqo_generations">
6010 <term><varname>geqo_generations
</varname> (
<type>integer
</type>)
6012 <primary><varname>geqo_generations
</varname> configuration parameter
</primary>
6017 Controls the number of generations used by GEQO, that is
6018 the number of iterations of the algorithm. It must
6019 be at least one, and useful values are in the same range as
6020 the pool size. If it is set to zero (the default setting)
6021 then a suitable value is chosen based on
6022 <varname>geqo_pool_size
</varname>.
6027 <varlistentry id=
"guc-geqo-selection-bias" xreflabel=
"geqo_selection_bias">
6028 <term><varname>geqo_selection_bias
</varname> (
<type>floating point
</type>)
6030 <primary><varname>geqo_selection_bias
</varname> configuration parameter
</primary>
6035 Controls the selection bias used by GEQO. The selection bias
6036 is the selective pressure within the population. Values can be
6037 from
1.50 to
2.00; the latter is the default.
6042 <varlistentry id=
"guc-geqo-seed" xreflabel=
"geqo_seed">
6043 <term><varname>geqo_seed
</varname> (
<type>floating point
</type>)
6045 <primary><varname>geqo_seed
</varname> configuration parameter
</primary>
6050 Controls the initial value of the random number generator used
6051 by GEQO to select random paths through the join order search space.
6052 The value can range from zero (the default) to one. Varying the
6053 value changes the set of join paths explored, and may result in a
6054 better or worse best path being found.
6061 <sect2 id=
"runtime-config-query-other">
6062 <title>Other Planner Options
</title>
6066 <varlistentry id=
"guc-default-statistics-target" xreflabel=
"default_statistics_target">
6067 <term><varname>default_statistics_target
</varname> (
<type>integer
</type>)
6069 <primary><varname>default_statistics_target
</varname> configuration parameter
</primary>
6074 Sets the default statistics target for table columns without
6075 a column-specific target set via
<command>ALTER TABLE
6076 SET STATISTICS
</command>. Larger values increase the time needed to
6077 do
<command>ANALYZE
</command>, but might improve the quality of the
6078 planner's estimates. The default is
100. For more information
6079 on the use of statistics by the
<productname>PostgreSQL
</productname>
6080 query planner, refer to
<xref linkend=
"planner-stats"/>.
6085 <varlistentry id=
"guc-constraint-exclusion" xreflabel=
"constraint_exclusion">
6086 <term><varname>constraint_exclusion
</varname> (
<type>enum
</type>)
6088 <primary>constraint exclusion
</primary>
6091 <primary><varname>constraint_exclusion
</varname> configuration parameter
</primary>
6096 Controls the query planner's use of table constraints to
6098 The allowed values of
<varname>constraint_exclusion
</varname> are
6099 <literal>on
</literal> (examine constraints for all tables),
6100 <literal>off
</literal> (never examine constraints), and
6101 <literal>partition
</literal> (examine constraints only for inheritance
6102 child tables and
<literal>UNION ALL
</literal> subqueries).
6103 <literal>partition
</literal> is the default setting.
6104 It is often used with traditional inheritance trees to improve
6109 When this parameter allows it for a particular table, the planner
6110 compares query conditions with the table's
<literal>CHECK
</literal>
6111 constraints, and omits scanning tables for which the conditions
6112 contradict the constraints. For example:
6115 CREATE TABLE parent(key integer, ...);
6116 CREATE TABLE child1000(check (key between
1000 and
1999)) INHERITS(parent);
6117 CREATE TABLE child2000(check (key between
2000 and
2999)) INHERITS(parent);
6119 SELECT * FROM parent WHERE key =
2400;
6122 With constraint exclusion enabled, this
<command>SELECT
</command>
6123 will not scan
<structname>child1000
</structname> at all, improving performance.
6127 Currently, constraint exclusion is enabled by default
6128 only for cases that are often used to implement table partitioning via
6129 inheritance trees. Turning it on for all tables imposes extra
6130 planning overhead that is quite noticeable on simple queries, and most
6131 often will yield no benefit for simple queries. If you have no
6132 tables that are partitioned using traditional inheritance, you might
6133 prefer to turn it off entirely. (Note that the equivalent feature for
6134 partitioned tables is controlled by a separate parameter,
6135 <xref linkend=
"guc-enable-partition-pruning"/>.)
6139 Refer to
<xref linkend=
"ddl-partitioning-constraint-exclusion"/> for
6140 more information on using constraint exclusion to implement
6146 <varlistentry id=
"guc-cursor-tuple-fraction" xreflabel=
"cursor_tuple_fraction">
6147 <term><varname>cursor_tuple_fraction
</varname> (
<type>floating point
</type>)
6149 <primary><varname>cursor_tuple_fraction
</varname> configuration parameter
</primary>
6154 Sets the planner's estimate of the fraction of a cursor's rows that
6155 will be retrieved. The default is
0.1. Smaller values of this
6156 setting bias the planner towards using
<quote>fast start
</quote> plans
6157 for cursors, which will retrieve the first few rows quickly while
6158 perhaps taking a long time to fetch all rows. Larger values
6159 put more emphasis on the total estimated time. At the maximum
6160 setting of
1.0, cursors are planned exactly like regular queries,
6161 considering only the total estimated time and not how soon the
6162 first rows might be delivered.
6167 <varlistentry id=
"guc-from-collapse-limit" xreflabel=
"from_collapse_limit">
6168 <term><varname>from_collapse_limit
</varname> (
<type>integer
</type>)
6170 <primary><varname>from_collapse_limit
</varname> configuration parameter
</primary>
6175 The planner will merge sub-queries into upper queries if the
6176 resulting
<literal>FROM
</literal> list would have no more than
6177 this many items. Smaller values reduce planning time but might
6178 yield inferior query plans. The default is eight.
6179 For more information see
<xref linkend=
"explicit-joins"/>.
6183 Setting this value to
<xref linkend=
"guc-geqo-threshold"/> or more
6184 may trigger use of the GEQO planner, resulting in non-optimal
6185 plans. See
<xref linkend=
"runtime-config-query-geqo"/>.
6190 <varlistentry id=
"guc-jit" xreflabel=
"jit">
6191 <term><varname>jit
</varname> (
<type>boolean
</type>)
6193 <primary><varname>jit
</varname> configuration parameter
</primary>
6198 Determines whether
<acronym>JIT
</acronym> compilation may be used by
6199 <productname>PostgreSQL
</productname>, if available (see
<xref
6201 The default is
<literal>on
</literal>.
6206 <varlistentry id=
"guc-join-collapse-limit" xreflabel=
"join_collapse_limit">
6207 <term><varname>join_collapse_limit
</varname> (
<type>integer
</type>)
6209 <primary><varname>join_collapse_limit
</varname> configuration parameter
</primary>
6214 The planner will rewrite explicit
<literal>JOIN
</literal>
6215 constructs (except
<literal>FULL JOIN
</literal>s) into lists of
6216 <literal>FROM
</literal> items whenever a list of no more than this many items
6217 would result. Smaller values reduce planning time but might
6218 yield inferior query plans.
6222 By default, this variable is set the same as
6223 <varname>from_collapse_limit
</varname>, which is appropriate
6224 for most uses. Setting it to
1 prevents any reordering of
6225 explicit
<literal>JOIN
</literal>s. Thus, the explicit join order
6226 specified in the query will be the actual order in which the
6227 relations are joined. Because the query planner does not always choose
6228 the optimal join order, advanced users can elect to
6229 temporarily set this variable to
1, and then specify the join
6230 order they desire explicitly.
6231 For more information see
<xref linkend=
"explicit-joins"/>.
6235 Setting this value to
<xref linkend=
"guc-geqo-threshold"/> or more
6236 may trigger use of the GEQO planner, resulting in non-optimal
6237 plans. See
<xref linkend=
"runtime-config-query-geqo"/>.
6242 <varlistentry id=
"guc-plan-cache-mode" xreflabel=
"plan_cache_mode">
6243 <term><varname>plan_cache_mode
</varname> (
<type>enum
</type>)
6245 <primary><varname>plan_cache_mode
</varname> configuration parameter
</primary>
6250 Prepared statements (either explicitly prepared or implicitly
6251 generated, for example by PL/pgSQL) can be executed using custom or
6252 generic plans. Custom plans are made afresh for each execution
6253 using its specific set of parameter values, while generic plans do
6254 not rely on the parameter values and can be re-used across
6255 executions. Thus, use of a generic plan saves planning time, but if
6256 the ideal plan depends strongly on the parameter values then a
6257 generic plan may be inefficient. The choice between these options
6258 is normally made automatically, but it can be overridden
6259 with
<varname>plan_cache_mode
</varname>.
6260 The allowed values are
<literal>auto
</literal> (the default),
6261 <literal>force_custom_plan
</literal> and
6262 <literal>force_generic_plan
</literal>.
6263 This setting is considered when a cached plan is to be executed,
6264 not when it is prepared.
6265 For more information see
<xref linkend=
"sql-prepare"/>.
6270 <varlistentry id=
"guc-recursive-worktable-factor" xreflabel=
"recursive_worktable_factor">
6271 <term><varname>recursive_worktable_factor
</varname> (
<type>floating point
</type>)
6273 <primary><varname>recursive_worktable_factor
</varname> configuration parameter
</primary>
6278 Sets the planner's estimate of the average size of the working
6279 table of a
<link linkend=
"queries-with-recursive">recursive
6280 query
</link>, as a multiple of the estimated size of the initial
6281 non-recursive term of the query. This helps the planner choose
6282 the most appropriate method for joining the working table to the
6283 query's other tables.
6284 The default value is
<literal>10.0</literal>. A smaller value
6285 such as
<literal>1.0</literal> can be helpful when the recursion
6286 has low
<quote>fan-out
</quote> from one step to the next, as for
6287 example in shortest-path queries. Graph analytics queries may
6288 benefit from larger-than-default values.
6297 <sect1 id=
"runtime-config-logging">
6298 <title>Error Reporting and Logging
</title>
6300 <indexterm zone=
"runtime-config-logging">
6301 <primary>server log
</primary>
6304 <sect2 id=
"runtime-config-logging-where">
6305 <title>Where to Log
</title>
6307 <indexterm zone=
"runtime-config-logging-where">
6308 <primary>where to log
</primary>
6312 <primary>current_logfiles
</primary>
6313 <secondary>and the log_destination configuration parameter
</secondary>
6318 <varlistentry id=
"guc-log-destination" xreflabel=
"log_destination">
6319 <term><varname>log_destination
</varname> (
<type>string
</type>)
6321 <primary><varname>log_destination
</varname> configuration parameter
</primary>
6326 <productname>PostgreSQL
</productname> supports several methods
6327 for logging server messages, including
6328 <systemitem>stderr
</systemitem>,
<systemitem>csvlog
</systemitem>,
6329 <systemitem>jsonlog
</systemitem>, and
6330 <systemitem>syslog
</systemitem>. On Windows,
6331 <systemitem>eventlog
</systemitem> is also supported. Set this
6332 parameter to a list of desired log destinations separated by
6333 commas. The default is to log to
<systemitem>stderr
</systemitem>
6335 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6336 file or on the server command line.
6339 If
<systemitem>csvlog
</systemitem> is included in
<varname>log_destination
</varname>,
6340 log entries are output in
<quote>comma-separated
6341 value
</quote> (
<acronym>CSV
</acronym>) format, which is convenient for
6342 loading logs into programs.
6343 See
<xref linkend=
"runtime-config-logging-csvlog"/> for details.
6344 <xref linkend=
"guc-logging-collector"/> must be enabled to generate
6345 CSV-format log output.
6348 If
<systemitem>jsonlog
</systemitem> is included in
6349 <varname>log_destination
</varname>, log entries are output in
6350 <acronym>JSON
</acronym> format, which is convenient for loading logs
6352 See
<xref linkend=
"runtime-config-logging-jsonlog"/> for details.
6353 <xref linkend=
"guc-logging-collector"/> must be enabled to generate
6354 JSON-format log output.
6357 When either
<systemitem>stderr
</systemitem>,
6358 <systemitem>csvlog
</systemitem> or
<systemitem>jsonlog
</systemitem> are
6359 included, the file
<filename>current_logfiles
</filename> is created to
6360 record the location of the log file(s) currently in use by the logging
6361 collector and the associated logging destination. This provides a
6362 convenient way to find the logs currently in use by the instance. Here
6363 is an example of this file's content:
6365 stderr log/postgresql.log
6366 csvlog log/postgresql.csv
6367 jsonlog log/postgresql.json
6370 <filename>current_logfiles
</filename> is recreated when a new log file
6371 is created as an effect of rotation, and
6372 when
<varname>log_destination
</varname> is reloaded. It is removed when
6373 none of
<systemitem>stderr
</systemitem>,
6374 <systemitem>csvlog
</systemitem> or
<systemitem>jsonlog
</systemitem> are
6375 included in
<varname>log_destination
</varname>, and when the logging
6376 collector is disabled.
6381 On most Unix systems, you will need to alter the configuration of
6382 your system's
<application>syslog
</application> daemon in order
6383 to make use of the
<systemitem>syslog
</systemitem> option for
6384 <varname>log_destination
</varname>.
<productname>PostgreSQL
</productname>
6385 can log to
<application>syslog
</application> facilities
6386 <literal>LOCAL0
</literal> through
<literal>LOCAL7
</literal> (see
<xref
6387 linkend=
"guc-syslog-facility"/>), but the default
6388 <application>syslog
</application> configuration on most platforms
6389 will discard all such messages. You will need to add something like:
6391 local0.* /var/log/postgresql
6393 to the
<application>syslog
</application> daemon's configuration file
6397 On Windows, when you use the
<literal>eventlog
</literal>
6398 option for
<varname>log_destination
</varname>, you should
6399 register an event source and its library with the operating
6400 system so that the Windows Event Viewer can display event
6401 log messages cleanly.
6402 See
<xref linkend=
"event-log-registration"/> for details.
6408 <varlistentry id=
"guc-logging-collector" xreflabel=
"logging_collector">
6409 <term><varname>logging_collector
</varname> (
<type>boolean
</type>)
6411 <primary><varname>logging_collector
</varname> configuration parameter
</primary>
6416 This parameter enables the
<firstterm>logging collector
</firstterm>, which
6417 is a background process that captures log messages
6418 sent to
<systemitem>stderr
</systemitem> and redirects them into log files.
6419 This approach is often more useful than
6420 logging to
<application>syslog
</application>, since some types of messages
6421 might not appear in
<application>syslog
</application> output. (One common
6422 example is dynamic-linker failure messages; another is error messages
6423 produced by scripts such as
<varname>archive_command
</varname>.)
6424 This parameter can only be set at server start.
6429 It is possible to log to
<systemitem>stderr
</systemitem> without using the
6430 logging collector; the log messages will just go to wherever the
6431 server's
<systemitem>stderr
</systemitem> is directed. However, that method is
6432 only suitable for low log volumes, since it provides no convenient
6433 way to rotate log files. Also, on some platforms not using the
6434 logging collector can result in lost or garbled log output, because
6435 multiple processes writing concurrently to the same log file can
6436 overwrite each other's output.
6442 The logging collector is designed to never lose messages. This means
6443 that in case of extremely high load, server processes could be
6444 blocked while trying to send additional log messages when the
6445 collector has fallen behind. In contrast,
<application>syslog
</application>
6446 prefers to drop messages if it cannot write them, which means it
6447 may fail to log some messages in such cases but it will not block
6448 the rest of the system.
6455 <varlistentry id=
"guc-log-directory" xreflabel=
"log_directory">
6456 <term><varname>log_directory
</varname> (
<type>string
</type>)
6458 <primary><varname>log_directory
</varname> configuration parameter
</primary>
6463 When
<varname>logging_collector
</varname> is enabled,
6464 this parameter determines the directory in which log files will be created.
6465 It can be specified as an absolute path, or relative to the
6466 cluster data directory.
6467 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6468 file or on the server command line.
6469 The default is
<literal>log
</literal>.
6474 <varlistentry id=
"guc-log-filename" xreflabel=
"log_filename">
6475 <term><varname>log_filename
</varname> (
<type>string
</type>)
6477 <primary><varname>log_filename
</varname> configuration parameter
</primary>
6482 When
<varname>logging_collector
</varname> is enabled,
6483 this parameter sets the file names of the created log files. The value
6484 is treated as a
<function>strftime
</function> pattern,
6485 so
<literal>%
</literal>-escapes can be used to specify time-varying
6486 file names. (Note that if there are
6487 any time-zone-dependent
<literal>%
</literal>-escapes, the computation
6488 is done in the zone specified
6489 by
<xref linkend=
"guc-log-timezone"/>.)
6490 The supported
<literal>%
</literal>-escapes are similar to those
6491 listed in the Open Group's
<ulink
6492 url=
"https://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime
6493 </ulink> specification.
6494 Note that the system's
<function>strftime
</function> is not used
6495 directly, so platform-specific (nonstandard) extensions do not work.
6496 The default is
<literal>postgresql-%Y-%m-%d_%H%M%S.log
</literal>.
6499 If you specify a file name without escapes, you should plan to
6500 use a log rotation utility to avoid eventually filling the
6501 entire disk. In releases prior to
8.4, if
6502 no
<literal>%
</literal> escapes were
6503 present,
<productname>PostgreSQL
</productname> would append
6504 the epoch of the new log file's creation time, but this is no
6508 If CSV-format output is enabled in
<varname>log_destination
</varname>,
6509 <literal>.csv
</literal> will be appended to the timestamped
6510 log file name to create the file name for CSV-format output.
6511 (If
<varname>log_filename
</varname> ends in
<literal>.log
</literal>, the suffix is
6515 If JSON-format output is enabled in
<varname>log_destination
</varname>,
6516 <literal>.json
</literal> will be appended to the timestamped
6517 log file name to create the file name for JSON-format output.
6518 (If
<varname>log_filename
</varname> ends in
<literal>.log
</literal>, the suffix is
6522 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6523 file or on the server command line.
6528 <varlistentry id=
"guc-log-file-mode" xreflabel=
"log_file_mode">
6529 <term><varname>log_file_mode
</varname> (
<type>integer
</type>)
6531 <primary><varname>log_file_mode
</varname> configuration parameter
</primary>
6536 On Unix systems this parameter sets the permissions for log files
6537 when
<varname>logging_collector
</varname> is enabled. (On Microsoft
6538 Windows this parameter is ignored.)
6539 The parameter value is expected to be a numeric mode
6540 specified in the format accepted by the
6541 <function>chmod
</function> and
<function>umask
</function>
6542 system calls. (To use the customary octal format the number
6543 must start with a
<literal>0</literal> (zero).)
6546 The default permissions are
<literal>0600</literal>, meaning only the
6547 server owner can read or write the log files. The other commonly
6548 useful setting is
<literal>0640</literal>, allowing members of the owner's
6549 group to read the files. Note however that to make use of such a
6550 setting, you'll need to alter
<xref linkend=
"guc-log-directory"/> to
6551 store the files somewhere outside the cluster data directory. In
6552 any case, it's unwise to make the log files world-readable, since
6553 they might contain sensitive data.
6556 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6557 file or on the server command line.
6562 <varlistentry id=
"guc-log-rotation-age" xreflabel=
"log_rotation_age">
6563 <term><varname>log_rotation_age
</varname> (
<type>integer
</type>)
6565 <primary><varname>log_rotation_age
</varname> configuration parameter
</primary>
6570 When
<varname>logging_collector
</varname> is enabled,
6571 this parameter determines the maximum amount of time to use an
6572 individual log file, after which a new log file will be created.
6573 If this value is specified without units, it is taken as minutes.
6574 The default is
24 hours.
6575 Set to zero to disable time-based creation of new log files.
6576 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6577 file or on the server command line.
6582 <varlistentry id=
"guc-log-rotation-size" xreflabel=
"log_rotation_size">
6583 <term><varname>log_rotation_size
</varname> (
<type>integer
</type>)
6585 <primary><varname>log_rotation_size
</varname> configuration parameter
</primary>
6590 When
<varname>logging_collector
</varname> is enabled,
6591 this parameter determines the maximum size of an individual log file.
6592 After this amount of data has been emitted into a log file,
6593 a new log file will be created.
6594 If this value is specified without units, it is taken as kilobytes.
6595 The default is
10 megabytes.
6596 Set to zero to disable size-based creation of new log files.
6597 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6598 file or on the server command line.
6603 <varlistentry id=
"guc-log-truncate-on-rotation" xreflabel=
"log_truncate_on_rotation">
6604 <term><varname>log_truncate_on_rotation
</varname> (
<type>boolean
</type>)
6606 <primary><varname>log_truncate_on_rotation
</varname> configuration parameter
</primary>
6611 When
<varname>logging_collector
</varname> is enabled,
6612 this parameter will cause
<productname>PostgreSQL
</productname> to truncate (overwrite),
6613 rather than append to, any existing log file of the same name.
6614 However, truncation will occur only when a new file is being opened
6615 due to time-based rotation, not during server startup or size-based
6616 rotation. When off, pre-existing files will be appended to in
6617 all cases. For example, using this setting in combination with
6618 a
<varname>log_filename
</varname> like
<literal>postgresql-%H.log
</literal>
6619 would result in generating twenty-four hourly log files and then
6620 cyclically overwriting them.
6621 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6622 file or on the server command line.
6625 Example: To keep
7 days of logs, one log file per day named
6626 <literal>server_log.Mon
</literal>,
<literal>server_log.Tue
</literal>,
6627 etc., and automatically overwrite last week's log with this week's log,
6628 set
<varname>log_filename
</varname> to
<literal>server_log.%a
</literal>,
6629 <varname>log_truncate_on_rotation
</varname> to
<literal>on
</literal>, and
6630 <varname>log_rotation_age
</varname> to
<literal>1440</literal>.
6633 Example: To keep
24 hours of logs, one log file per hour, but
6634 also rotate sooner if the log file size exceeds
1GB, set
6635 <varname>log_filename
</varname> to
<literal>server_log.%H%M
</literal>,
6636 <varname>log_truncate_on_rotation
</varname> to
<literal>on
</literal>,
6637 <varname>log_rotation_age
</varname> to
<literal>60</literal>, and
6638 <varname>log_rotation_size
</varname> to
<literal>1000000</literal>.
6639 Including
<literal>%M
</literal> in
<varname>log_filename
</varname> allows
6640 any size-driven rotations that might occur to select a file name
6641 different from the hour's initial file name.
6646 <varlistentry id=
"guc-syslog-facility" xreflabel=
"syslog_facility">
6647 <term><varname>syslog_facility
</varname> (
<type>enum
</type>)
6649 <primary><varname>syslog_facility
</varname> configuration parameter
</primary>
6654 When logging to
<application>syslog
</application> is enabled, this parameter
6655 determines the
<application>syslog
</application>
6656 <quote>facility
</quote> to be used. You can choose
6657 from
<literal>LOCAL0
</literal>,
<literal>LOCAL1
</literal>,
6658 <literal>LOCAL2
</literal>,
<literal>LOCAL3
</literal>,
<literal>LOCAL4
</literal>,
6659 <literal>LOCAL5
</literal>,
<literal>LOCAL6
</literal>,
<literal>LOCAL7
</literal>;
6660 the default is
<literal>LOCAL0
</literal>. See also the
6661 documentation of your system's
6662 <application>syslog
</application> daemon.
6663 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6664 file or on the server command line.
6669 <varlistentry id=
"guc-syslog-ident" xreflabel=
"syslog_ident">
6670 <term><varname>syslog_ident
</varname> (
<type>string
</type>)
6672 <primary><varname>syslog_ident
</varname> configuration parameter
</primary>
6677 When logging to
<application>syslog
</application> is enabled, this parameter
6678 determines the program name used to identify
6679 <productname>PostgreSQL
</productname> messages in
6680 <application>syslog
</application> logs. The default is
6681 <literal>postgres
</literal>.
6682 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6683 file or on the server command line.
6688 <varlistentry id=
"guc-syslog-sequence-numbers" xreflabel=
"syslog_sequence_numbers">
6689 <term><varname>syslog_sequence_numbers
</varname> (
<type>boolean
</type>)
6691 <primary><varname>syslog_sequence_numbers
</varname> configuration parameter
</primary>
6697 When logging to
<application>syslog
</application> and this is on (the
6698 default), then each message will be prefixed by an increasing
6699 sequence number (such as
<literal>[
2]
</literal>). This circumvents
6700 the
<quote>--- last message repeated N times ---
</quote> suppression
6701 that many syslog implementations perform by default. In more modern
6702 syslog implementations, repeated message suppression can be configured
6703 (for example,
<literal>$RepeatedMsgReduction
</literal>
6704 in
<productname>rsyslog
</productname>), so this might not be
6705 necessary. Also, you could turn this off if you actually want to
6706 suppress repeated messages.
6710 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6711 file or on the server command line.
6716 <varlistentry id=
"guc-syslog-split-messages" xreflabel=
"syslog_split_messages">
6717 <term><varname>syslog_split_messages
</varname> (
<type>boolean
</type>)
6719 <primary><varname>syslog_split_messages
</varname> configuration parameter
</primary>
6724 When logging to
<application>syslog
</application> is enabled, this parameter
6725 determines how messages are delivered to syslog. When on (the
6726 default), messages are split by lines, and long lines are split so
6727 that they will fit into
1024 bytes, which is a typical size limit for
6728 traditional syslog implementations. When off, PostgreSQL server log
6729 messages are delivered to the syslog service as is, and it is up to
6730 the syslog service to cope with the potentially bulky messages.
6734 If syslog is ultimately logging to a text file, then the effect will
6735 be the same either way, and it is best to leave the setting on, since
6736 most syslog implementations either cannot handle large messages or
6737 would need to be specially configured to handle them. But if syslog
6738 is ultimately writing into some other medium, it might be necessary or
6739 more useful to keep messages logically together.
6743 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6744 file or on the server command line.
6749 <varlistentry id=
"guc-event-source" xreflabel=
"event_source">
6750 <term><varname>event_source
</varname> (
<type>string
</type>)
6752 <primary><varname>event_source
</varname> configuration parameter
</primary>
6757 When logging to
<application>event log
</application> is enabled, this parameter
6758 determines the program name used to identify
6759 <productname>PostgreSQL
</productname> messages in
6760 the log. The default is
<literal>PostgreSQL
</literal>.
6761 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6762 file or on the server command line.
6769 <sect2 id=
"runtime-config-logging-when">
6770 <title>When to Log
</title>
6774 <varlistentry id=
"guc-log-min-messages" xreflabel=
"log_min_messages">
6775 <term><varname>log_min_messages
</varname> (
<type>enum
</type>)
6777 <primary><varname>log_min_messages
</varname> configuration parameter
</primary>
6782 Controls which
<link linkend=
"runtime-config-severity-levels">message
6783 levels
</link> are written to the server log.
6784 Valid values are
<literal>DEBUG5
</literal>,
<literal>DEBUG4
</literal>,
6785 <literal>DEBUG3
</literal>,
<literal>DEBUG2
</literal>,
<literal>DEBUG1
</literal>,
6786 <literal>INFO
</literal>,
<literal>NOTICE
</literal>,
<literal>WARNING
</literal>,
6787 <literal>ERROR
</literal>,
<literal>LOG
</literal>,
<literal>FATAL
</literal>, and
6788 <literal>PANIC
</literal>. Each level includes all the levels that
6789 follow it. The later the level, the fewer messages are sent
6790 to the log. The default is
<literal>WARNING
</literal>. Note that
6791 <literal>LOG
</literal> has a different rank here than in
6792 <xref linkend=
"guc-client-min-messages"/>.
6793 Only superusers and users with the appropriate
<literal>SET
</literal>
6794 privilege can change this setting.
6799 <varlistentry id=
"guc-log-min-error-statement" xreflabel=
"log_min_error_statement">
6800 <term><varname>log_min_error_statement
</varname> (
<type>enum
</type>)
6802 <primary><varname>log_min_error_statement
</varname> configuration parameter
</primary>
6807 Controls which SQL statements that cause an error
6808 condition are recorded in the server log. The current
6809 SQL statement is included in the log entry for any message of
6811 <link linkend=
"runtime-config-severity-levels">severity
</link>
6813 Valid values are
<literal>DEBUG5
</literal>,
6814 <literal>DEBUG4
</literal>,
<literal>DEBUG3
</literal>,
6815 <literal>DEBUG2
</literal>,
<literal>DEBUG1
</literal>,
6816 <literal>INFO
</literal>,
<literal>NOTICE
</literal>,
6817 <literal>WARNING
</literal>,
<literal>ERROR
</literal>,
6818 <literal>LOG
</literal>,
6819 <literal>FATAL
</literal>, and
<literal>PANIC
</literal>.
6820 The default is
<literal>ERROR
</literal>, which means statements
6821 causing errors, log messages, fatal errors, or panics will be logged.
6822 To effectively turn off logging of failing statements,
6823 set this parameter to
<literal>PANIC
</literal>.
6824 Only superusers and users with the appropriate
<literal>SET
</literal>
6825 privilege can change this setting.
6830 <varlistentry id=
"guc-log-min-duration-statement" xreflabel=
"log_min_duration_statement">
6831 <term><varname>log_min_duration_statement
</varname> (
<type>integer
</type>)
6833 <primary><varname>log_min_duration_statement
</varname> configuration parameter
</primary>
6838 Causes the duration of each completed statement to be logged
6839 if the statement ran for at least the specified amount of time.
6840 For example, if you set it to
<literal>250ms
</literal>
6841 then all SQL statements that run
250ms or longer will be
6842 logged. Enabling this parameter can be helpful in tracking down
6843 unoptimized queries in your applications.
6844 If this value is specified without units, it is taken as milliseconds.
6845 Setting this to zero prints all statement durations.
6846 <literal>-
1</literal> (the default) disables logging statement
6848 Only superusers and users with the appropriate
<literal>SET
</literal>
6849 privilege can change this setting.
6853 This overrides
<xref linkend=
"guc-log-min-duration-sample"/>,
6854 meaning that queries with duration exceeding this setting are not
6855 subject to sampling and are always logged.
6859 For clients using extended query protocol, durations of the Parse,
6860 Bind, and Execute steps are logged independently.
6865 When using this option together with
6866 <xref linkend=
"guc-log-statement"/>,
6867 the text of statements that are logged because of
6868 <varname>log_statement
</varname> will not be repeated in the
6869 duration log message.
6870 If you are not using
<application>syslog
</application>, it is recommended
6871 that you log the PID or session ID using
6872 <xref linkend=
"guc-log-line-prefix"/>
6873 so that you can link the statement message to the later
6874 duration message using the process ID or session ID.
6880 <varlistentry id=
"guc-log-min-duration-sample" xreflabel=
"log_min_duration_sample">
6881 <term><varname>log_min_duration_sample
</varname> (
<type>integer
</type>)
6883 <primary><varname>log_min_duration_sample
</varname> configuration parameter
</primary>
6888 Allows sampling the duration of completed statements that ran for
6889 at least the specified amount of time. This produces the same
6890 kind of log entries as
6891 <xref linkend=
"guc-log-min-duration-statement"/>, but only for a
6892 subset of the executed statements, with sample rate controlled by
6893 <xref linkend=
"guc-log-statement-sample-rate"/>.
6894 For example, if you set it to
<literal>100ms
</literal> then all
6895 SQL statements that run
100ms or longer will be considered for
6896 sampling. Enabling this parameter can be helpful when the
6897 traffic is too high to log all queries.
6898 If this value is specified without units, it is taken as milliseconds.
6899 Setting this to zero samples all statement durations.
6900 <literal>-
1</literal> (the default) disables sampling statement
6902 Only superusers and users with the appropriate
<literal>SET
</literal>
6903 privilege can change this setting.
6907 This setting has lower priority
6908 than
<varname>log_min_duration_statement
</varname>, meaning that
6909 statements with durations
6910 exceeding
<varname>log_min_duration_statement
</varname> are not
6911 subject to sampling and are always logged.
6915 Other notes for
<varname>log_min_duration_statement
</varname>
6916 apply also to this setting.
6921 <varlistentry id=
"guc-log-statement-sample-rate" xreflabel=
"log_statement_sample_rate">
6922 <term><varname>log_statement_sample_rate
</varname> (
<type>floating point
</type>)
6924 <primary><varname>log_statement_sample_rate
</varname> configuration parameter
</primary>
6929 Determines the fraction of statements with duration exceeding
6930 <xref linkend=
"guc-log-min-duration-sample"/> that will be logged.
6931 Sampling is stochastic, for example
<literal>0.5</literal> means
6932 there is statistically one chance in two that any given statement
6934 The default is
<literal>1.0</literal>, meaning to log all sampled
6936 Setting this to zero disables sampled statement-duration logging,
6938 <varname>log_min_duration_sample
</varname> to
6939 <literal>-
1</literal>.
6940 Only superusers and users with the appropriate
<literal>SET
</literal>
6941 privilege can change this setting.
6946 <varlistentry id=
"guc-log-transaction-sample-rate" xreflabel=
"log_transaction_sample_rate">
6947 <term><varname>log_transaction_sample_rate
</varname> (
<type>floating point
</type>)
6949 <primary><varname>log_transaction_sample_rate
</varname> configuration parameter
</primary>
6954 Sets the fraction of transactions whose statements are all logged,
6955 in addition to statements logged for other reasons. It applies to
6956 each new transaction regardless of its statements' durations.
6957 Sampling is stochastic, for example
<literal>0.1</literal> means
6958 there is statistically one chance in ten that any given transaction
6960 <varname>log_transaction_sample_rate
</varname> can be helpful to
6961 construct a sample of transactions.
6962 The default is
<literal>0</literal>, meaning not to log
6963 statements from any additional transactions. Setting this
6964 to
<literal>1</literal> logs all statements of all transactions.
6965 Only superusers and users with the appropriate
<literal>SET
</literal>
6966 privilege can change this setting.
6970 Like all statement-logging options, this option can add significant
6977 <varlistentry id=
"guc-log-startup-progress-interval" xreflabel=
"log_startup_progress_interval">
6978 <term><varname>log_startup_progress_interval
</varname> (
<type>integer
</type>)
6980 <primary><varname>log_startup_progress_interval
</varname> configuration parameter
</primary>
6985 Sets the amount of time after which the startup process will log
6986 a message about a long-running operation that is still in progress,
6987 as well as the interval between further progress messages for that
6988 operation. The default is
10 seconds. A setting of
<literal>0</literal>
6989 disables the feature. If this value is specified without units,
6990 it is taken as milliseconds. This setting is applied separately to
6992 This parameter can only be set in the
<filename>postgresql.conf
</filename>
6993 file or on the server command line.
6997 For example, if syncing the data directory takes
25 seconds and
6998 thereafter resetting unlogged relations takes
8 seconds, and if this
6999 setting has the default value of
10 seconds, then a messages will be
7000 logged for syncing the data directory after it has been in progress
7001 for
10 seconds and again after it has been in progress for
20 seconds,
7002 but nothing will be logged for resetting unlogged relations.
7010 <xref linkend=
"runtime-config-severity-levels"/> explains the message
7011 severity levels used by
<productname>PostgreSQL
</productname>. If logging output
7012 is sent to
<systemitem>syslog
</systemitem> or Windows'
7013 <systemitem>eventlog
</systemitem>, the severity levels are translated
7014 as shown in the table.
7017 <table id=
"runtime-config-severity-levels">
7018 <title>Message Severity Levels
</title>
7020 <colspec colname=
"col1" colwidth=
"1*"/>
7021 <colspec colname=
"col2" colwidth=
"2*"/>
7022 <colspec colname=
"col3" colwidth=
"1*"/>
7023 <colspec colname=
"col4" colwidth=
"1*"/>
7026 <entry>Severity
</entry>
7027 <entry>Usage
</entry>
7028 <entry><systemitem>syslog
</systemitem></entry>
7029 <entry><systemitem>eventlog
</systemitem></entry>
7035 <entry><literal>DEBUG1 .. DEBUG5
</literal></entry>
7036 <entry>Provides successively-more-detailed information for use by
7038 <entry><literal>DEBUG
</literal></entry>
7039 <entry><literal>INFORMATION
</literal></entry>
7043 <entry><literal>INFO
</literal></entry>
7044 <entry>Provides information implicitly requested by the user,
7045 e.g., output from
<command>VACUUM VERBOSE
</command>.
</entry>
7046 <entry><literal>INFO
</literal></entry>
7047 <entry><literal>INFORMATION
</literal></entry>
7051 <entry><literal>NOTICE
</literal></entry>
7052 <entry>Provides information that might be helpful to users, e.g.,
7053 notice of truncation of long identifiers.
</entry>
7054 <entry><literal>NOTICE
</literal></entry>
7055 <entry><literal>INFORMATION
</literal></entry>
7059 <entry><literal>WARNING
</literal></entry>
7060 <entry>Provides warnings of likely problems, e.g.,
<command>COMMIT
</command>
7061 outside a transaction block.
</entry>
7062 <entry><literal>NOTICE
</literal></entry>
7063 <entry><literal>WARNING
</literal></entry>
7067 <entry><literal>ERROR
</literal></entry>
7068 <entry>Reports an error that caused the current command to
7070 <entry><literal>WARNING
</literal></entry>
7071 <entry><literal>ERROR
</literal></entry>
7075 <entry><literal>LOG
</literal></entry>
7076 <entry>Reports information of interest to administrators, e.g.,
7077 checkpoint activity.
</entry>
7078 <entry><literal>INFO
</literal></entry>
7079 <entry><literal>INFORMATION
</literal></entry>
7083 <entry><literal>FATAL
</literal></entry>
7084 <entry>Reports an error that caused the current session to
7086 <entry><literal>ERR
</literal></entry>
7087 <entry><literal>ERROR
</literal></entry>
7091 <entry><literal>PANIC
</literal></entry>
7092 <entry>Reports an error that caused all database sessions to abort.
</entry>
7093 <entry><literal>CRIT
</literal></entry>
7094 <entry><literal>ERROR
</literal></entry>
7101 <sect2 id=
"runtime-config-logging-what">
7102 <title>What to Log
</title>
7106 What you choose to log can have security implications; see
7107 <xref linkend=
"logfile-maintenance"/>.
7113 <varlistentry id=
"guc-application-name" xreflabel=
"application_name">
7114 <term><varname>application_name
</varname> (
<type>string
</type>)
7116 <primary><varname>application_name
</varname> configuration parameter
</primary>
7121 The
<varname>application_name
</varname> can be any string of less than
7122 <symbol>NAMEDATALEN
</symbol> characters (
64 characters in a standard build).
7123 It is typically set by an application upon connection to the server.
7124 The name will be displayed in the
<structname>pg_stat_activity
</structname> view
7125 and included in CSV log entries. It can also be included in regular
7126 log entries via the
<xref linkend=
"guc-log-line-prefix"/> parameter.
7127 Only printable ASCII characters may be used in the
7128 <varname>application_name
</varname> value.
7129 Other characters are replaced with
<link
7130 linkend=
"sql-syntax-strings-escape">C-style hexadecimal escapes
</link>.
7135 <varlistentry id=
"guc-debug-print-parse">
7136 <term><varname>debug_print_parse
</varname> (
<type>boolean
</type>)
7138 <primary><varname>debug_print_parse
</varname> configuration parameter
</primary>
7141 <term><varname>debug_print_rewritten
</varname> (
<type>boolean
</type>)
7143 <primary><varname>debug_print_rewritten
</varname> configuration parameter
</primary>
7146 <term><varname>debug_print_plan
</varname> (
<type>boolean
</type>)
7148 <primary><varname>debug_print_plan
</varname> configuration parameter
</primary>
7153 These parameters enable various debugging output to be emitted.
7154 When set, they print the resulting parse tree, the query rewriter
7155 output, or the execution plan for each executed query.
7156 These messages are emitted at
<literal>LOG
</literal> message level, so by
7157 default they will appear in the server log but will not be sent to the
7158 client. You can change that by adjusting
7159 <xref linkend=
"guc-client-min-messages"/> and/or
7160 <xref linkend=
"guc-log-min-messages"/>.
7161 These parameters are off by default.
7166 <varlistentry id=
"guc-debug-pretty-print">
7167 <term><varname>debug_pretty_print
</varname> (
<type>boolean
</type>)
7169 <primary><varname>debug_pretty_print
</varname> configuration parameter
</primary>
7174 When set,
<varname>debug_pretty_print
</varname> indents the messages
7175 produced by
<varname>debug_print_parse
</varname>,
7176 <varname>debug_print_rewritten
</varname>, or
7177 <varname>debug_print_plan
</varname>. This results in more readable
7178 but much longer output than the
<quote>compact
</quote> format used when
7179 it is off. It is on by default.
7184 <varlistentry id=
"guc-log-autovacuum-min-duration" xreflabel=
"log_autovacuum_min_duration">
7185 <term><varname>log_autovacuum_min_duration
</varname> (
<type>integer
</type>)
7187 <primary><varname>log_autovacuum_min_duration
</varname></primary>
7188 <secondary>configuration parameter
</secondary>
7193 Causes each action executed by autovacuum to be logged if it ran for at
7194 least the specified amount of time. Setting this to zero logs
7195 all autovacuum actions.
<literal>-
1</literal> disables logging autovacuum
7196 actions. If this value is specified without units, it is taken as milliseconds.
7197 For example, if you set this to
7198 <literal>250ms
</literal> then all automatic vacuums and analyzes that run
7199 250ms or longer will be logged. In addition, when this parameter is
7200 set to any value other than
<literal>-
1</literal>, a message will be
7201 logged if an autovacuum action is skipped due to a conflicting lock or a
7202 concurrently dropped relation. The default is
<literal>10min
</literal>.
7203 Enabling this parameter can be helpful in tracking autovacuum activity.
7204 This parameter can only be set in the
<filename>postgresql.conf
</filename>
7205 file or on the server command line; but the setting can be overridden for
7206 individual tables by changing table storage parameters.
7211 <varlistentry id=
"guc-log-checkpoints" xreflabel=
"log_checkpoints">
7212 <term><varname>log_checkpoints
</varname> (
<type>boolean
</type>)
7214 <primary><varname>log_checkpoints
</varname> configuration parameter
</primary>
7219 Causes checkpoints and restartpoints to be logged in the server log.
7220 Some statistics are included in the log messages, including the number
7221 of buffers written and the time spent writing them.
7222 This parameter can only be set in the
<filename>postgresql.conf
</filename>
7223 file or on the server command line. The default is on.
7228 <varlistentry id=
"guc-log-connections" xreflabel=
"log_connections">
7229 <term><varname>log_connections
</varname> (
<type>boolean
</type>)
7231 <primary><varname>log_connections
</varname> configuration parameter
</primary>
7236 Causes each attempted connection to the server to be logged,
7237 as well as successful completion of both client authentication (if
7238 necessary) and authorization.
7239 Only superusers and users with the appropriate
<literal>SET
</literal>
7240 privilege can change this parameter at session start,
7241 and it cannot be changed at all within a session.
7242 The default is
<literal>off
</literal>.
7247 Some client programs, like
<application>psql
</application>, attempt
7248 to connect twice while determining if a password is required, so
7249 duplicate
<quote>connection received
</quote> messages do not
7250 necessarily indicate a problem.
7256 <varlistentry id=
"guc-log-disconnections" xreflabel=
"log_disconnections">
7257 <term><varname>log_disconnections
</varname> (
<type>boolean
</type>)
7259 <primary><varname>log_disconnections
</varname> configuration parameter
</primary>
7264 Causes session terminations to be logged. The log output
7265 provides information similar to
<varname>log_connections
</varname>,
7266 plus the duration of the session.
7267 Only superusers and users with the appropriate
<literal>SET
</literal>
7268 privilege can change this parameter at session start,
7269 and it cannot be changed at all within a session.
7270 The default is
<literal>off
</literal>.
7276 <varlistentry id=
"guc-log-duration" xreflabel=
"log_duration">
7277 <term><varname>log_duration
</varname> (
<type>boolean
</type>)
7279 <primary><varname>log_duration
</varname> configuration parameter
</primary>
7284 Causes the duration of every completed statement to be logged.
7285 The default is
<literal>off
</literal>.
7286 Only superusers and users with the appropriate
<literal>SET
</literal>
7287 privilege can change this setting.
7291 For clients using extended query protocol, durations of the Parse,
7292 Bind, and Execute steps are logged independently.
7297 The difference between enabling
<varname>log_duration
</varname> and setting
7298 <xref linkend=
"guc-log-min-duration-statement"/> to zero is that
7299 exceeding
<varname>log_min_duration_statement
</varname> forces the text of
7300 the query to be logged, but this option doesn't. Thus, if
7301 <varname>log_duration
</varname> is
<literal>on
</literal> and
7302 <varname>log_min_duration_statement
</varname> has a positive value, all
7303 durations are logged but the query text is included only for
7304 statements exceeding the threshold. This behavior can be useful for
7305 gathering statistics in high-load installations.
7311 <varlistentry id=
"guc-log-error-verbosity" xreflabel=
"log_error_verbosity">
7312 <term><varname>log_error_verbosity
</varname> (
<type>enum
</type>)
7314 <primary><varname>log_error_verbosity
</varname> configuration parameter
</primary>
7319 Controls the amount of detail written in the server log for each
7320 message that is logged. Valid values are
<literal>TERSE
</literal>,
7321 <literal>DEFAULT
</literal>, and
<literal>VERBOSE
</literal>, each adding more
7322 fields to displayed messages.
<literal>TERSE
</literal> excludes
7323 the logging of
<literal>DETAIL
</literal>,
<literal>HINT
</literal>,
7324 <literal>QUERY
</literal>, and
<literal>CONTEXT
</literal> error information.
7325 <literal>VERBOSE
</literal> output includes the
<symbol>SQLSTATE
</symbol> error
7326 code (see also
<xref linkend=
"errcodes-appendix"/>) and the source code file name, function name,
7327 and line number that generated the error.
7328 Only superusers and users with the appropriate
<literal>SET
</literal>
7329 privilege can change this setting.
7334 <varlistentry id=
"guc-log-hostname" xreflabel=
"log_hostname">
7335 <term><varname>log_hostname
</varname> (
<type>boolean
</type>)
7337 <primary><varname>log_hostname
</varname> configuration parameter
</primary>
7342 By default, connection log messages only show the IP address of the
7343 connecting host. Turning this parameter on causes logging of the
7344 host name as well. Note that depending on your host name resolution
7345 setup this might impose a non-negligible performance penalty.
7346 This parameter can only be set in the
<filename>postgresql.conf
</filename>
7347 file or on the server command line.
7352 <varlistentry id=
"guc-log-line-prefix" xreflabel=
"log_line_prefix">
7353 <term><varname>log_line_prefix
</varname> (
<type>string
</type>)
7355 <primary><varname>log_line_prefix
</varname> configuration parameter
</primary>
7360 This is a
<function>printf
</function>-style string that is output at the
7361 beginning of each log line.
7362 <literal>%
</literal> characters begin
<quote>escape sequences
</quote>
7363 that are replaced with status information as outlined below.
7364 Unrecognized escapes are ignored. Other
7365 characters are copied straight to the log line. Some escapes are
7366 only recognized by session processes, and will be treated as empty by
7367 background processes such as the main server process. Status
7368 information may be aligned either left or right by specifying a
7369 numeric literal after the % and before the option. A negative
7370 value will cause the status information to be padded on the
7371 right with spaces to give it a minimum width, whereas a positive
7372 value will pad on the left. Padding can be useful to aid human
7373 readability in log files.
7377 This parameter can only be set in the
<filename>postgresql.conf
</filename>
7378 file or on the server command line. The default is
7379 <literal>'%m [%p] '
</literal> which logs a time stamp and the process ID.
7386 <entry>Escape
</entry>
7387 <entry>Effect
</entry>
7388 <entry>Session only
</entry>
7393 <entry><literal>%a
</literal></entry>
7394 <entry>Application name
</entry>
7398 <entry><literal>%u
</literal></entry>
7399 <entry>User name
</entry>
7403 <entry><literal>%d
</literal></entry>
7404 <entry>Database name
</entry>
7408 <entry><literal>%r
</literal></entry>
7409 <entry>Remote host name or IP address, and remote port
</entry>
7413 <entry><literal>%h
</literal></entry>
7414 <entry>Remote host name or IP address
</entry>
7418 <entry><literal>%b
</literal></entry>
7419 <entry>Backend type
</entry>
7423 <entry><literal>%p
</literal></entry>
7424 <entry>Process ID
</entry>
7428 <entry><literal>%P
</literal></entry>
7429 <entry>Process ID of the parallel group leader, if this process
7430 is a parallel query worker
</entry>
7434 <entry><literal>%t
</literal></entry>
7435 <entry>Time stamp without milliseconds
</entry>
7439 <entry><literal>%m
</literal></entry>
7440 <entry>Time stamp with milliseconds
</entry>
7444 <entry><literal>%n
</literal></entry>
7445 <entry>Time stamp with milliseconds (as a Unix epoch)
</entry>
7449 <entry><literal>%i
</literal></entry>
7450 <entry>Command tag: type of session's current command
</entry>
7454 <entry><literal>%e
</literal></entry>
7455 <entry>SQLSTATE error code
</entry>
7459 <entry><literal>%c
</literal></entry>
7460 <entry>Session ID: see below
</entry>
7464 <entry><literal>%l
</literal></entry>
7465 <entry>Number of the log line for each session or process, starting at
1</entry>
7469 <entry><literal>%s
</literal></entry>
7470 <entry>Process start time stamp
</entry>
7474 <entry><literal>%v
</literal></entry>
7475 <entry>Virtual transaction ID (procNumber/localXID); see
7476 <xref linkend=
"transaction-id"/></entry>
7480 <entry><literal>%x
</literal></entry>
7481 <entry>Transaction ID (
0 if none is assigned); see
7482 <xref linkend=
"transaction-id"/></entry>
7486 <entry><literal>%q
</literal></entry>
7487 <entry>Produces no output, but tells non-session
7488 processes to stop at this point in the string; ignored by
7489 session processes
</entry>
7493 <entry><literal>%Q
</literal></entry>
7494 <entry>Query identifier of the current query. Query
7495 identifiers are not computed by default, so this field
7496 will be zero unless
<xref linkend=
"guc-compute-query-id"/>
7497 parameter is enabled or a third-party module that computes
7498 query identifiers is configured.
</entry>
7502 <entry><literal>%%
</literal></entry>
7503 <entry>Literal
<literal>%
</literal></entry>
7511 The backend type corresponds to the column
7512 <structfield>backend_type
</structfield> in the view
7513 <link linkend=
"monitoring-pg-stat-activity-view">
7514 <structname>pg_stat_activity
</structname></link>,
7515 but additional types can appear
7516 in the log that don't show in that view.
7520 The
<literal>%c
</literal> escape prints a quasi-unique session identifier,
7521 consisting of two
4-byte hexadecimal numbers (without leading zeros)
7522 separated by a dot. The numbers are the process start time and the
7523 process ID, so
<literal>%c
</literal> can also be used as a space saving way
7524 of printing those items. For example, to generate the session
7525 identifier from
<literal>pg_stat_activity
</literal>, use this query:
7527 SELECT to_hex(trunc(EXTRACT(EPOCH FROM backend_start))::integer) || '.' ||
7529 FROM pg_stat_activity;
7536 If you set a nonempty value for
<varname>log_line_prefix
</varname>,
7537 you should usually make its last character be a space, to provide
7538 visual separation from the rest of the log line. A punctuation
7539 character can be used too.
7545 <application>Syslog
</application> produces its own
7546 time stamp and process ID information, so you probably do not want to
7547 include those escapes if you are logging to
<application>syslog
</application>.
7553 The
<literal>%q
</literal> escape is useful when including information that is
7554 only available in session (backend) context like user or database
7557 log_line_prefix = '%m [%p] %q%u@%d/%a '
7564 The
<literal>%Q
</literal> escape always reports a zero identifier
7565 for lines output by
<xref linkend=
"guc-log-statement"/> because
7566 <varname>log_statement
</varname> generates output before an
7567 identifier can be calculated, including invalid statements for
7568 which an identifier cannot be calculated.
7574 <varlistentry id=
"guc-log-lock-waits" xreflabel=
"log_lock_waits">
7575 <term><varname>log_lock_waits
</varname> (
<type>boolean
</type>)
7577 <primary><varname>log_lock_waits
</varname> configuration parameter
</primary>
7582 Controls whether a log message is produced when a session waits
7583 longer than
<xref linkend=
"guc-deadlock-timeout"/> to acquire a
7584 lock. This is useful in determining if lock waits are causing
7585 poor performance. The default is
<literal>off
</literal>.
7586 Only superusers and users with the appropriate
<literal>SET
</literal>
7587 privilege can change this setting.
7592 <varlistentry id=
"guc-log-recovery-conflict-waits" xreflabel=
"log_recovery_conflict_waits">
7593 <term><varname>log_recovery_conflict_waits
</varname> (
<type>boolean
</type>)
7595 <primary><varname>log_recovery_conflict_waits
</varname> configuration parameter
</primary>
7600 Controls whether a log message is produced when the startup process
7601 waits longer than
<varname>deadlock_timeout
</varname>
7602 for recovery conflicts. This is useful in determining if recovery
7603 conflicts prevent the recovery from applying WAL.
7607 The default is
<literal>off
</literal>. This parameter can only be set
7608 in the
<filename>postgresql.conf
</filename> file or on the server
7614 <varlistentry id=
"guc-log-parameter-max-length" xreflabel=
"log_parameter_max_length">
7615 <term><varname>log_parameter_max_length
</varname> (
<type>integer
</type>)
7617 <primary><varname>log_parameter_max_length
</varname> configuration parameter
</primary>
7622 If greater than zero, each bind parameter value logged with a
7623 non-error statement-logging message is trimmed to this many bytes.
7624 Zero disables logging of bind parameters for non-error statement logs.
7625 <literal>-
1</literal> (the default) allows bind parameters to be
7627 If this value is specified without units, it is taken as bytes.
7628 Only superusers and users with the appropriate
<literal>SET
</literal>
7629 privilege can change this setting.
7633 This setting only affects log messages printed as a result of
7634 <xref linkend=
"guc-log-statement"/>,
7635 <xref linkend=
"guc-log-duration"/>, and related settings. Non-zero
7636 values of this setting add some overhead, particularly if parameters
7637 are sent in binary form, since then conversion to text is required.
7642 <varlistentry id=
"guc-log-parameter-max-length-on-error" xreflabel=
"log_parameter_max_length_on_error">
7643 <term><varname>log_parameter_max_length_on_error
</varname> (
<type>integer
</type>)
7645 <primary><varname>log_parameter_max_length_on_error
</varname> configuration parameter
</primary>
7650 If greater than zero, each bind parameter value reported in error
7651 messages is trimmed to this many bytes.
7652 Zero (the default) disables including bind parameters in error
7654 <literal>-
1</literal> allows bind parameters to be printed in full.
7655 If this value is specified without units, it is taken as bytes.
7659 Non-zero values of this setting add overhead, as
7660 <productname>PostgreSQL
</productname> will need to store textual
7661 representations of parameter values in memory at the start of each
7662 statement, whether or not an error eventually occurs. The overhead
7663 is greater when bind parameters are sent in binary form than when
7664 they are sent as text, since the former case requires data
7665 conversion while the latter only requires copying the string.
7670 <varlistentry id=
"guc-log-statement" xreflabel=
"log_statement">
7671 <term><varname>log_statement
</varname> (
<type>enum
</type>)
7673 <primary><varname>log_statement
</varname> configuration parameter
</primary>
7678 Controls which SQL statements are logged. Valid values are
7679 <literal>none
</literal> (off),
<literal>ddl
</literal>,
<literal>mod
</literal>, and
7680 <literal>all
</literal> (all statements).
<literal>ddl
</literal> logs all data definition
7681 statements, such as
<command>CREATE
</command>,
<command>ALTER
</command>, and
7682 <command>DROP
</command> statements.
<literal>mod
</literal> logs all
7683 <literal>ddl
</literal> statements, plus data-modifying statements
7684 such as
<command>INSERT
</command>,
7685 <command>UPDATE
</command>,
<command>DELETE
</command>,
<command>TRUNCATE
</command>,
7686 and
<command>COPY FROM
</command>.
7687 <command>PREPARE
</command>,
<command>EXECUTE
</command>, and
7688 <command>EXPLAIN ANALYZE
</command> statements are also logged if their
7689 contained command is of an appropriate type. For clients using
7690 extended query protocol, logging occurs when an Execute message
7691 is received, and values of the Bind parameters are included
7692 (with any embedded single-quote marks doubled).
7696 The default is
<literal>none
</literal>.
7697 Only superusers and users with the appropriate
<literal>SET
</literal>
7698 privilege can change this setting.
7703 Statements that contain simple syntax errors are not logged
7704 even by the
<varname>log_statement
</varname> =
<literal>all
</literal> setting,
7705 because the log message is emitted only after basic parsing has
7706 been done to determine the statement type. In the case of extended
7707 query protocol, this setting likewise does not log statements that
7708 fail before the Execute phase (i.e., during parse analysis or
7709 planning). Set
<varname>log_min_error_statement
</varname> to
7710 <literal>ERROR
</literal> (or lower) to log such statements.
7713 Logged statements might reveal sensitive data and even contain
7714 plaintext passwords.
7720 <varlistentry id=
"guc-log-replication-commands" xreflabel=
"log_replication_commands">
7721 <term><varname>log_replication_commands
</varname> (
<type>boolean
</type>)
7723 <primary><varname>log_replication_commands
</varname> configuration parameter
</primary>
7728 Causes each replication command and
<literal>walsender
</literal>
7729 process's replication slot acquisition/release to be logged in the
7730 server log. See
<xref linkend=
"protocol-replication"/> for more
7731 information about replication command. The default value is
7732 <literal>off
</literal>. Only superusers and users with the appropriate
7733 <literal>SET
</literal> privilege can change this setting.
7738 <varlistentry id=
"guc-log-temp-files" xreflabel=
"log_temp_files">
7739 <term><varname>log_temp_files
</varname> (
<type>integer
</type>)
7741 <primary><varname>log_temp_files
</varname> configuration parameter
</primary>
7746 Controls logging of temporary file names and sizes.
7747 Temporary files can be
7748 created for sorts, hashes, and temporary query results.
7749 If enabled by this setting, a log entry is emitted for each
7750 temporary file, with the file size specified in bytes, when it is deleted.
7751 A value of zero logs all temporary file information, while positive
7752 values log only files whose size is greater than or equal to
7753 the specified amount of data.
7754 If this value is specified without units, it is taken as kilobytes.
7755 The default setting is -
1, which disables such logging.
7756 Only superusers and users with the appropriate
<literal>SET
</literal>
7757 privilege can change this setting.
7762 <varlistentry id=
"guc-log-timezone" xreflabel=
"log_timezone">
7763 <term><varname>log_timezone
</varname> (
<type>string
</type>)
7765 <primary><varname>log_timezone
</varname> configuration parameter
</primary>
7770 Sets the time zone used for timestamps written in the server log.
7771 Unlike
<xref linkend=
"guc-timezone"/>, this value is cluster-wide,
7772 so that all sessions will report timestamps consistently.
7773 The built-in default is
<literal>GMT
</literal>, but that is typically
7774 overridden in
<filename>postgresql.conf
</filename>;
<application>initdb
</application>
7775 will install a setting there corresponding to its system environment.
7776 See
<xref linkend=
"datatype-timezones"/> for more information.
7777 This parameter can only be set in the
<filename>postgresql.conf
</filename>
7778 file or on the server command line.
7783 <varlistentry id=
"guc-md5-password-warnings" xreflabel=
"md5_password_warnings">
7784 <term><varname>md5_password_warnings
</varname> (
<type>boolean
</type>)
7786 <primary><varname>md5_password_warnings
</varname> configuration parameter
</primary>
7791 Controls whether a
<literal>WARNING
</literal> about MD5 password
7792 deprecation is produced when a
<command>CREATE ROLE
</command> or
7793 <command>ALTER ROLE
</command> statement sets an MD5-encrypted password.
7794 The default value is
<literal>on
</literal>.
7801 <sect2 id=
"runtime-config-logging-csvlog">
7802 <title>Using CSV-Format Log Output
</title>
7805 Including
<literal>csvlog
</literal> in the
<varname>log_destination
</varname> list
7806 provides a convenient way to import log files into a database table.
7807 This option emits log lines in comma-separated-values
7808 (
<acronym>CSV
</acronym>) format,
7810 time stamp with milliseconds,
7814 client host:port number,
7816 per-session line number,
7819 virtual transaction ID,
7820 regular transaction ID,
7824 error message detail,
7826 internal query that led to the error (if any),
7827 character count of the error position therein,
7829 user query that led to the error (if any and enabled by
7830 <varname>log_min_error_statement
</varname>),
7831 character count of the error position therein,
7832 location of the error in the PostgreSQL source code
7833 (if
<varname>log_error_verbosity
</varname> is set to
<literal>verbose
</literal>),
7834 application name, backend type, process ID of parallel group leader,
7836 Here is a sample table definition for storing CSV-format log output:
7839 CREATE TABLE postgres_log
7841 log_time timestamp(
3) with time zone,
7845 connection_from text,
7847 session_line_num bigint,
7849 session_start_time timestamp with time zone,
7850 virtual_transaction_id text,
7851 transaction_id bigint,
7852 error_severity text,
7853 sql_state_code text,
7857 internal_query text,
7858 internal_query_pos integer,
7863 application_name text,
7867 PRIMARY KEY (session_id, session_line_num)
7873 To import a log file into this table, use the
<command>COPY FROM
</command>
7877 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
7879 It is also possible to access the file as a foreign table, using
7880 the supplied
<xref linkend=
"file-fdw"/> module.
7884 There are a few things you need to do to simplify importing CSV log
7890 Set
<varname>log_filename
</varname> and
7891 <varname>log_rotation_age
</varname> to provide a consistent,
7892 predictable naming scheme for your log files. This lets you
7893 predict what the file name will be and know when an individual log
7894 file is complete and therefore ready to be imported.
7900 Set
<varname>log_rotation_size
</varname> to
0 to disable
7901 size-based log rotation, as it makes the log file name difficult
7908 Set
<varname>log_truncate_on_rotation
</varname> to
<literal>on
</literal> so
7909 that old log data isn't mixed with the new in the same file.
7915 The table definition above includes a primary key specification.
7916 This is useful to protect against accidentally importing the same
7917 information twice. The
<command>COPY
</command> command commits all of the
7918 data it imports at one time, so any error will cause the entire
7919 import to fail. If you import a partial log file and later import
7920 the file again when it is complete, the primary key violation will
7921 cause the import to fail. Wait until the log is complete and
7922 closed before importing. This procedure will also protect against
7923 accidentally importing a partial line that hasn't been completely
7924 written, which would also cause
<command>COPY
</command> to fail.
7930 <sect2 id=
"runtime-config-logging-jsonlog">
7931 <title>Using JSON-Format Log Output
</title>
7934 Including
<literal>jsonlog
</literal> in the
7935 <varname>log_destination
</varname> list provides a convenient way to
7936 import log files into many different programs. This option emits log
7937 lines in
<acronym>JSON
</acronym> format.
7941 String fields with null values are excluded from output.
7942 Additional fields may be added in the future. User applications that
7943 process
<literal>jsonlog
</literal> output should ignore unknown fields.
7947 Each log line is serialized as a JSON object with the set of keys and
7948 their associated values shown in
<xref
7949 linkend=
"runtime-config-logging-jsonlog-keys-values"/>.
7952 <table id=
"runtime-config-logging-jsonlog-keys-values">
7953 <title>Keys and Values of JSON Log Entries
</title>
7957 <entry>Key name
</entry>
7959 <entry>Description
</entry>
7964 <entry><literal>timestamp
</literal></entry>
7965 <entry>string
</entry>
7966 <entry>Time stamp with milliseconds
</entry>
7969 <entry><literal>user
</literal></entry>
7970 <entry>string
</entry>
7971 <entry>User name
</entry>
7974 <entry><literal>dbname
</literal></entry>
7975 <entry>string
</entry>
7976 <entry>Database name
</entry>
7979 <entry><literal>pid
</literal></entry>
7980 <entry>number
</entry>
7981 <entry>Process ID
</entry>
7984 <entry><literal>remote_host
</literal></entry>
7985 <entry>string
</entry>
7986 <entry>Client host
</entry>
7989 <entry><literal>remote_port
</literal></entry>
7990 <entry>number
</entry>
7991 <entry>Client port
</entry>
7994 <entry><literal>session_id
</literal></entry>
7995 <entry>string
</entry>
7996 <entry>Session ID
</entry>
7999 <entry><literal>line_num
</literal></entry>
8000 <entry>number
</entry>
8001 <entry>Per-session line number
</entry>
8004 <entry><literal>ps
</literal></entry>
8005 <entry>string
</entry>
8006 <entry>Current ps display
</entry>
8009 <entry><literal>session_start
</literal></entry>
8010 <entry>string
</entry>
8011 <entry>Session start time
</entry>
8014 <entry><literal>vxid
</literal></entry>
8015 <entry>string
</entry>
8016 <entry>Virtual transaction ID
</entry>
8019 <entry><literal>txid
</literal></entry>
8020 <entry>string
</entry>
8021 <entry>Regular transaction ID
</entry>
8024 <entry><literal>error_severity
</literal></entry>
8025 <entry>string
</entry>
8026 <entry>Error severity
</entry>
8029 <entry><literal>state_code
</literal></entry>
8030 <entry>string
</entry>
8031 <entry>SQLSTATE code
</entry>
8034 <entry><literal>message
</literal></entry>
8035 <entry>string
</entry>
8036 <entry>Error message
</entry>
8039 <entry><literal>detail
</literal></entry>
8040 <entry>string
</entry>
8041 <entry>Error message detail
</entry>
8044 <entry><literal>hint
</literal></entry>
8045 <entry>string
</entry>
8046 <entry>Error message hint
</entry>
8049 <entry><literal>internal_query
</literal></entry>
8050 <entry>string
</entry>
8051 <entry>Internal query that led to the error
</entry>
8054 <entry><literal>internal_position
</literal></entry>
8055 <entry>number
</entry>
8056 <entry>Cursor index into internal query
</entry>
8059 <entry><literal>context
</literal></entry>
8060 <entry>string
</entry>
8061 <entry>Error context
</entry>
8064 <entry><literal>statement
</literal></entry>
8065 <entry>string
</entry>
8066 <entry>Client-supplied query string
</entry>
8069 <entry><literal>cursor_position
</literal></entry>
8070 <entry>number
</entry>
8071 <entry>Cursor index into query string
</entry>
8074 <entry><literal>func_name
</literal></entry>
8075 <entry>string
</entry>
8076 <entry>Error location function name
</entry>
8079 <entry><literal>file_name
</literal></entry>
8080 <entry>string
</entry>
8081 <entry>File name of error location
</entry>
8084 <entry><literal>file_line_num
</literal></entry>
8085 <entry>number
</entry>
8086 <entry>File line number of the error location
</entry>
8089 <entry><literal>application_name
</literal></entry>
8090 <entry>string
</entry>
8091 <entry>Client application name
</entry>
8094 <entry><literal>backend_type
</literal></entry>
8095 <entry>string
</entry>
8096 <entry>Type of backend
</entry>
8099 <entry><literal>leader_pid
</literal></entry>
8100 <entry>number
</entry>
8101 <entry>Process ID of leader for active parallel workers
</entry>
8104 <entry><literal>query_id
</literal></entry>
8105 <entry>number
</entry>
8106 <entry>Query ID
</entry>
8113 <sect2 id=
"runtime-config-logging-proc-title">
8114 <title>Process Title
</title>
8117 These settings control how process titles of server processes are
8118 modified. Process titles are typically viewed using programs like
8119 <application>ps
</application> or, on Windows,
<application>Process Explorer
</application>.
8120 See
<xref linkend=
"monitoring-ps"/> for details.
8124 <varlistentry id=
"guc-cluster-name" xreflabel=
"cluster_name">
8125 <term><varname>cluster_name
</varname> (
<type>string
</type>)
8127 <primary><varname>cluster_name
</varname> configuration parameter
</primary>
8132 Sets a name that identifies this database cluster (instance) for
8133 various purposes. The cluster name appears in the process title for
8134 all server processes in this cluster. Moreover, it is the default
8135 application name for a standby connection (see
<xref
8136 linkend=
"guc-synchronous-standby-names"/>.)
8140 The name can be any string of less
8141 than
<symbol>NAMEDATALEN
</symbol> characters (
64 characters in a standard
8142 build). Only printable ASCII characters may be used in the
8143 <varname>cluster_name
</varname> value.
8144 Other characters are replaced with
<link
8145 linkend=
"sql-syntax-strings-escape">C-style hexadecimal escapes
</link>.
8146 No name is shown if this parameter is set to the empty string
8147 <literal>''
</literal> (which is the default).
8148 This parameter can only be set at server start.
8153 <varlistentry id=
"guc-update-process-title" xreflabel=
"update_process_title">
8154 <term><varname>update_process_title
</varname> (
<type>boolean
</type>)
8156 <primary><varname>update_process_title
</varname> configuration parameter
</primary>
8161 Enables updating of the process title every time a new SQL command
8162 is received by the server.
8163 This setting defaults to
<literal>on
</literal> on most platforms, but it
8164 defaults to
<literal>off
</literal> on Windows due to that platform's larger
8165 overhead for updating the process title.
8166 Only superusers and users with the appropriate
<literal>SET
</literal>
8167 privilege can change this setting.
8175 <sect1 id=
"runtime-config-statistics">
8176 <title>Run-time Statistics
</title>
8178 <sect2 id=
"runtime-config-cumulative-statistics">
8179 <title>Cumulative Query and Index Statistics
</title>
8182 These parameters control the server-wide cumulative statistics system.
8183 When enabled, the data that is collected can be accessed via the
8184 <structname>pg_stat
</structname> and
<structname>pg_statio
</structname>
8185 family of system views. Refer to
<xref linkend=
"monitoring"/> for more
8191 <varlistentry id=
"guc-track-activities" xreflabel=
"track_activities">
8192 <term><varname>track_activities
</varname> (
<type>boolean
</type>)
8194 <primary><varname>track_activities
</varname> configuration parameter
</primary>
8199 Enables the collection of information on the currently
8200 executing command of each session, along with its identifier and the
8201 time when that command began execution. This parameter is on by
8202 default. Note that even when enabled, this information is only
8203 visible to superusers, roles with privileges of the
8204 <literal>pg_read_all_stats
</literal> role and the user owning the
8205 sessions being reported on (including sessions belonging to a role they
8206 have the privileges of), so it should not represent a security risk.
8207 Only superusers and users with the appropriate
<literal>SET
</literal>
8208 privilege can change this setting.
8213 <varlistentry id=
"guc-track-activity-query-size" xreflabel=
"track_activity_query_size">
8214 <term><varname>track_activity_query_size
</varname> (
<type>integer
</type>)
8216 <primary><varname>track_activity_query_size
</varname> configuration parameter
</primary>
8221 Specifies the amount of memory reserved to store the text of the
8222 currently executing command for each active session, for the
8223 <structname>pg_stat_activity
</structname>.
<structfield>query
</structfield> field.
8224 If this value is specified without units, it is taken as bytes.
8225 The default value is
1024 bytes.
8226 This parameter can only be set at server start.
8231 <varlistentry id=
"guc-track-counts" xreflabel=
"track_counts">
8232 <term><varname>track_counts
</varname> (
<type>boolean
</type>)
8234 <primary><varname>track_counts
</varname> configuration parameter
</primary>
8239 Enables collection of statistics on database activity.
8240 This parameter is on by default, because the autovacuum
8241 daemon needs the collected information.
8242 Only superusers and users with the appropriate
<literal>SET
</literal>
8243 privilege can change this setting.
8248 <varlistentry id=
"guc-track-io-timing" xreflabel=
"track_io_timing">
8249 <term><varname>track_io_timing
</varname> (
<type>boolean
</type>)
8251 <primary><varname>track_io_timing
</varname> configuration parameter
</primary>
8256 Enables timing of database I/O calls. This parameter is off by
8257 default, as it will repeatedly query the operating system for
8258 the current time, which may cause significant overhead on some
8259 platforms. You can use the
<xref linkend=
"pgtesttiming"/> tool to
8260 measure the overhead of timing on your system.
8261 I/O timing information is
8262 displayed in
<link linkend=
"monitoring-pg-stat-database-view">
8263 <structname>pg_stat_database
</structname></link>,
8264 <link linkend=
"monitoring-pg-stat-io-view">
8265 <structname>pg_stat_io
</structname></link>, in the output of the
8266 <link linkend=
"pg-stat-get-backend-io">
8267 <function>pg_stat_get_backend_io()
</function></link> function, in the
8268 output of
<xref linkend=
"sql-explain"/> when the
<literal>BUFFERS
</literal>
8269 option is used, in the output of
<xref linkend=
"sql-vacuum"/> when
8270 the
<literal>VERBOSE
</literal> option is used, by autovacuum
8271 for auto-vacuums and auto-analyzes, when
<xref
8272 linkend=
"guc-log-autovacuum-min-duration"/> is set and by
8273 <xref linkend=
"pgstatstatements"/>.
8274 Only superusers and users with the appropriate
<literal>SET
</literal>
8275 privilege can change this setting.
8280 <varlistentry id=
"guc-track-wal-io-timing" xreflabel=
"track_wal_io_timing">
8281 <term><varname>track_wal_io_timing
</varname> (
<type>boolean
</type>)
8283 <primary><varname>track_wal_io_timing
</varname> configuration parameter
</primary>
8288 Enables timing of WAL I/O calls. This parameter is off by default,
8289 as it will repeatedly query the operating system for the current time,
8290 which may cause significant overhead on some platforms.
8291 You can use the
<application>pg_test_timing
</application> tool to
8292 measure the overhead of timing on your system.
8293 I/O timing information is
8294 displayed in
<link linkend=
"monitoring-pg-stat-wal-view">
8295 <structname>pg_stat_wal
</structname></link>.
8296 Only superusers and users with the appropriate
<literal>SET
</literal>
8297 privilege can change this setting.
8302 <varlistentry id=
"guc-track-functions" xreflabel=
"track_functions">
8303 <term><varname>track_functions
</varname> (
<type>enum
</type>)
8305 <primary><varname>track_functions
</varname> configuration parameter
</primary>
8310 Enables tracking of function call counts and time used. Specify
8311 <literal>pl
</literal> to track only procedural-language functions,
8312 <literal>all
</literal> to also track SQL and C language functions.
8313 The default is
<literal>none
</literal>, which disables function
8314 statistics tracking.
8315 Only superusers and users with the appropriate
<literal>SET
</literal>
8316 privilege can change this setting.
8321 SQL-language functions that are simple enough to be
<quote>inlined
</quote>
8322 into the calling query will not be tracked, regardless of this
8329 <varlistentry id=
"guc-stats-fetch-consistency" xreflabel=
"stats_fetch_consistency">
8330 <term><varname>stats_fetch_consistency
</varname> (
<type>enum
</type>)
8332 <primary><varname>stats_fetch_consistency
</varname> configuration parameter
</primary>
8337 Determines the behavior when cumulative statistics are accessed
8338 multiple times within a transaction. When set to
8339 <literal>none
</literal>, each access re-fetches counters from shared
8340 memory. When set to
<literal>cache
</literal>, the first access to
8341 statistics for an object caches those statistics until the end of the
8342 transaction unless
<function>pg_stat_clear_snapshot()
</function> is
8343 called. When set to
<literal>snapshot
</literal>, the first statistics
8344 access caches all statistics accessible in the current database, until
8345 the end of the transaction unless
8346 <function>pg_stat_clear_snapshot()
</function> is called. Changing this
8347 parameter in a transaction discards the statistics snapshot.
8348 The default is
<literal>cache
</literal>.
8352 <literal>none
</literal> is most suitable for monitoring systems. If
8353 values are only accessed once, it is the most
8354 efficient.
<literal>cache
</literal> ensures repeat accesses yield the
8355 same values, which is important for queries involving
8356 e.g. self-joins.
<literal>snapshot
</literal> can be useful when
8357 interactively inspecting statistics, but has higher overhead,
8358 particularly if many database objects exist.
8367 <sect2 id=
"runtime-config-statistics-monitor">
8368 <title>Statistics Monitoring
</title>
8371 <varlistentry id=
"guc-compute-query-id" xreflabel=
"compute_query_id">
8372 <term><varname>compute_query_id
</varname> (
<type>enum
</type>)
8374 <primary><varname>compute_query_id
</varname> configuration parameter
</primary>
8379 Enables in-core computation of a query identifier.
8380 Query identifiers can be displayed in the
<link
8381 linkend=
"monitoring-pg-stat-activity-view"><structname>pg_stat_activity
</structname></link>
8382 view, using
<command>EXPLAIN
</command>, or emitted in the log if
8383 configured via the
<xref linkend=
"guc-log-line-prefix"/> parameter.
8384 The
<xref linkend=
"pgstatstatements"/> extension also requires a query
8385 identifier to be computed. Note that an external module can
8386 alternatively be used if the in-core query identifier computation
8387 method is not acceptable. In this case, in-core computation
8388 must be always disabled.
8389 Valid values are
<literal>off
</literal> (always disabled),
8390 <literal>on
</literal> (always enabled),
<literal>auto
</literal>,
8391 which lets modules such as
<xref linkend=
"pgstatstatements"/>
8392 automatically enable it, and
<literal>regress
</literal> which
8393 has the same effect as
<literal>auto
</literal>, except that the
8394 query identifier is not shown in the
<literal>EXPLAIN
</literal> output
8395 in order to facilitate automated regression testing.
8396 The default is
<literal>auto
</literal>.
8400 To ensure that only one query identifier is calculated and
8401 displayed, extensions that calculate query identifiers should
8402 throw an error if a query identifier has already been computed.
8408 <varlistentry id=
"guc-log-statement-stats">
8409 <term><varname>log_statement_stats
</varname> (
<type>boolean
</type>)
8411 <primary><varname>log_statement_stats
</varname> configuration parameter
</primary>
8414 <term><varname>log_parser_stats
</varname> (
<type>boolean
</type>)
8416 <primary><varname>log_parser_stats
</varname> configuration parameter
</primary>
8419 <term><varname>log_planner_stats
</varname> (
<type>boolean
</type>)
8421 <primary><varname>log_planner_stats
</varname> configuration parameter
</primary>
8424 <term><varname>log_executor_stats
</varname> (
<type>boolean
</type>)
8426 <primary><varname>log_executor_stats
</varname> configuration parameter
</primary>
8431 For each query, output performance statistics of the respective
8432 module to the server log. This is a crude profiling
8433 instrument, similar to the Unix
<function>getrusage()
</function> operating
8434 system facility.
<varname>log_statement_stats
</varname> reports total
8435 statement statistics, while the others report per-module statistics.
8436 <varname>log_statement_stats
</varname> cannot be enabled together with
8437 any of the per-module options. All of these options are disabled by
8439 Only superusers and users with the appropriate
<literal>SET
</literal>
8440 privilege can change these settings.
8450 <sect1 id=
"runtime-config-vacuum">
8451 <title>Vacuuming
</title>
8454 <primary>vacuum
</primary>
8455 <secondary>configuration parameters
</secondary>
8459 These parameters control vacuuming behavior. For more information on the
8460 purpose and responsibilities of vacuum, see
<xref linkend=
"routine-vacuuming"/>.
8463 <sect2 id=
"runtime-config-autovacuum">
8464 <title>Automatic Vacuuming
</title>
8467 These settings control the behavior of the
<firstterm>autovacuum
</firstterm>
8468 feature. Refer to
<xref linkend=
"autovacuum"/> for more information.
8469 Note that many of these settings can be overridden on a per-table
8470 basis; see
<xref linkend=
"sql-createtable-storage-parameters"/>.
8475 <varlistentry id=
"guc-autovacuum" xreflabel=
"autovacuum">
8476 <term><varname>autovacuum
</varname> (
<type>boolean
</type>)
8478 <primary><varname>autovacuum
</varname> configuration parameter
</primary>
8483 Controls whether the server should run the
8484 autovacuum launcher daemon. This is on by default; however,
8485 <xref linkend=
"guc-track-counts"/> must also be enabled for
8487 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8488 file or on the server command line; however, autovacuuming can be
8489 disabled for individual tables by changing table storage parameters.
8492 Note that even when this parameter is disabled, the system
8493 will launch autovacuum processes if necessary to
8494 prevent transaction ID wraparound. See
<xref
8495 linkend=
"vacuum-for-wraparound"/> for more information.
8500 <varlistentry id=
"guc-autovacuum-worker-slots" xreflabel=
"autovacuum_worker_slots">
8501 <term><varname>autovacuum_worker_slots
</varname> (
<type>integer
</type>)
8503 <primary><varname>autovacuum_worker_slots
</varname> configuration parameter
</primary>
8508 Specifies the number of backend slots to reserve for autovacuum worker
8509 processes. The default is typically
16 slots, but might be less if
8510 your kernel settings will not support it (as determined during initdb).
8511 This parameter can only be set at server start.
8514 When changing this value, consider also adjusting
8515 <xref linkend=
"guc-autovacuum-max-workers"/>.
8520 <varlistentry id=
"guc-autovacuum-max-workers" xreflabel=
"autovacuum_max_workers">
8521 <term><varname>autovacuum_max_workers
</varname> (
<type>integer
</type>)
8523 <primary><varname>autovacuum_max_workers
</varname> configuration parameter
</primary>
8528 Specifies the maximum number of autovacuum processes (other than the
8529 autovacuum launcher) that may be running at any one time. The default
8530 is
<literal>3</literal>. This parameter can only be set in the
8531 <filename>postgresql.conf
</filename> file or on the server command line.
8534 Note that a setting for this value which is higher than
8535 <xref linkend=
"guc-autovacuum-worker-slots"/> will have no effect,
8536 since autovacuum workers are taken from the pool of slots established
8542 <varlistentry id=
"guc-autovacuum-naptime" xreflabel=
"autovacuum_naptime">
8543 <term><varname>autovacuum_naptime
</varname> (
<type>integer
</type>)
8545 <primary><varname>autovacuum_naptime
</varname> configuration parameter
</primary>
8550 Specifies the minimum delay between autovacuum runs on any given
8551 database. In each round the daemon examines the
8552 database and issues
<command>VACUUM
</command> and
<command>ANALYZE
</command> commands
8553 as needed for tables in that database.
8554 If this value is specified without units, it is taken as seconds.
8555 The default is one minute (
<literal>1min
</literal>).
8556 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8557 file or on the server command line.
8562 <varlistentry id=
"guc-autovacuum-vacuum-threshold" xreflabel=
"autovacuum_vacuum_threshold">
8563 <term><varname>autovacuum_vacuum_threshold
</varname> (
<type>integer
</type>)
8565 <primary><varname>autovacuum_vacuum_threshold
</varname></primary>
8566 <secondary>configuration parameter
</secondary>
8571 Specifies the minimum number of updated or deleted tuples needed
8572 to trigger a
<command>VACUUM
</command> in any one table.
8573 The default is
50 tuples.
8574 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8575 file or on the server command line;
8576 but the setting can be overridden for individual tables by
8577 changing table storage parameters.
8582 <varlistentry id=
"guc-autovacuum-vacuum-insert-threshold" xreflabel=
"autovacuum_vacuum_insert_threshold">
8583 <term><varname>autovacuum_vacuum_insert_threshold
</varname> (
<type>integer
</type>)
8585 <primary><varname>autovacuum_vacuum_insert_threshold
</varname></primary>
8586 <secondary>configuration parameter
</secondary>
8591 Specifies the number of inserted tuples needed to trigger a
8592 <command>VACUUM
</command> in any one table.
8593 The default is
1000 tuples. If -
1 is specified, autovacuum will not
8594 trigger a
<command>VACUUM
</command> operation on any tables based on
8595 the number of inserts.
8596 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8597 file or on the server command line;
8598 but the setting can be overridden for individual tables by
8599 changing table storage parameters.
8604 <varlistentry id=
"guc-autovacuum-analyze-threshold" xreflabel=
"autovacuum_analyze_threshold">
8605 <term><varname>autovacuum_analyze_threshold
</varname> (
<type>integer
</type>)
8607 <primary><varname>autovacuum_analyze_threshold
</varname></primary>
8608 <secondary>configuration parameter
</secondary>
8613 Specifies the minimum number of inserted, updated or deleted tuples
8614 needed to trigger an
<command>ANALYZE
</command> in any one table.
8615 The default is
50 tuples.
8616 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8617 file or on the server command line;
8618 but the setting can be overridden for individual tables by
8619 changing table storage parameters.
8624 <varlistentry id=
"guc-autovacuum-vacuum-scale-factor" xreflabel=
"autovacuum_vacuum_scale_factor">
8625 <term><varname>autovacuum_vacuum_scale_factor
</varname> (
<type>floating point
</type>)
8627 <primary><varname>autovacuum_vacuum_scale_factor
</varname></primary>
8628 <secondary>configuration parameter
</secondary>
8633 Specifies a fraction of the table size to add to
8634 <varname>autovacuum_vacuum_threshold
</varname>
8635 when deciding whether to trigger a
<command>VACUUM
</command>.
8636 The default is
<literal>0.2</literal> (
20% of table size).
8637 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8638 file or on the server command line;
8639 but the setting can be overridden for individual tables by
8640 changing table storage parameters.
8645 <varlistentry id=
"guc-autovacuum-vacuum-insert-scale-factor" xreflabel=
"autovacuum_vacuum_insert_scale_factor">
8646 <term><varname>autovacuum_vacuum_insert_scale_factor
</varname> (
<type>floating point
</type>)
8648 <primary><varname>autovacuum_vacuum_insert_scale_factor
</varname></primary>
8649 <secondary>configuration parameter
</secondary>
8654 Specifies a fraction of the table size to add to
8655 <varname>autovacuum_vacuum_insert_threshold
</varname>
8656 when deciding whether to trigger a
<command>VACUUM
</command>.
8657 The default is
<literal>0.2</literal> (
20% of table size).
8658 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8659 file or on the server command line;
8660 but the setting can be overridden for individual tables by
8661 changing table storage parameters.
8666 <varlistentry id=
"guc-autovacuum-analyze-scale-factor" xreflabel=
"autovacuum_analyze_scale_factor">
8667 <term><varname>autovacuum_analyze_scale_factor
</varname> (
<type>floating point
</type>)
8669 <primary><varname>autovacuum_analyze_scale_factor
</varname></primary>
8670 <secondary>configuration parameter
</secondary>
8675 Specifies a fraction of the table size to add to
8676 <varname>autovacuum_analyze_threshold
</varname>
8677 when deciding whether to trigger an
<command>ANALYZE
</command>.
8678 The default is
<literal>0.1</literal> (
10% of table size).
8679 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8680 file or on the server command line;
8681 but the setting can be overridden for individual tables by
8682 changing table storage parameters.
8687 <varlistentry id=
"guc-autovacuum-freeze-max-age" xreflabel=
"autovacuum_freeze_max_age">
8688 <term><varname>autovacuum_freeze_max_age
</varname> (
<type>integer
</type>)
8690 <primary><varname>autovacuum_freeze_max_age
</varname></primary>
8691 <secondary>configuration parameter
</secondary>
8696 Specifies the maximum age (in transactions) that a table's
8697 <structname>pg_class
</structname>.
<structfield>relfrozenxid
</structfield> field can
8698 attain before a
<command>VACUUM
</command> operation is forced
8699 to prevent transaction ID wraparound within the table.
8700 Note that the system will launch autovacuum processes to
8701 prevent wraparound even when autovacuum is otherwise disabled.
8705 Vacuum also allows removal of old files from the
8706 <filename>pg_xact
</filename> subdirectory, which is why the default
8707 is a relatively low
200 million transactions.
8708 This parameter can only be set at server start, but the setting
8709 can be reduced for individual tables by
8710 changing table storage parameters.
8711 For more information see
<xref linkend=
"vacuum-for-wraparound"/>.
8716 <varlistentry id=
"guc-autovacuum-multixact-freeze-max-age" xreflabel=
"autovacuum_multixact_freeze_max_age">
8717 <term><varname>autovacuum_multixact_freeze_max_age
</varname> (
<type>integer
</type>)
8719 <primary><varname>autovacuum_multixact_freeze_max_age
</varname></primary>
8720 <secondary>configuration parameter
</secondary>
8725 Specifies the maximum age (in multixacts) that a table's
8726 <structname>pg_class
</structname>.
<structfield>relminmxid
</structfield> field can
8727 attain before a
<command>VACUUM
</command> operation is forced to
8728 prevent multixact ID wraparound within the table.
8729 Note that the system will launch autovacuum processes to
8730 prevent wraparound even when autovacuum is otherwise disabled.
8734 Vacuuming multixacts also allows removal of old files from the
8735 <filename>pg_multixact/members
</filename> and
<filename>pg_multixact/offsets
</filename>
8736 subdirectories, which is why the default is a relatively low
8737 400 million multixacts.
8738 This parameter can only be set at server start, but the setting can
8739 be reduced for individual tables by changing table storage parameters.
8740 For more information see
<xref linkend=
"vacuum-for-multixact-wraparound"/>.
8745 <varlistentry id=
"guc-autovacuum-vacuum-cost-delay" xreflabel=
"autovacuum_vacuum_cost_delay">
8746 <term><varname>autovacuum_vacuum_cost_delay
</varname> (
<type>floating point
</type>)
8748 <primary><varname>autovacuum_vacuum_cost_delay
</varname></primary>
8749 <secondary>configuration parameter
</secondary>
8754 Specifies the cost delay value that will be used in automatic
8755 <command>VACUUM
</command> operations. If -
1 is specified, the regular
8756 <xref linkend=
"guc-vacuum-cost-delay"/> value will be used.
8757 If this value is specified without units, it is taken as milliseconds.
8758 The default value is
2 milliseconds.
8759 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8760 file or on the server command line;
8761 but the setting can be overridden for individual tables by
8762 changing table storage parameters.
8767 <varlistentry id=
"guc-autovacuum-vacuum-cost-limit" xreflabel=
"autovacuum_vacuum_cost_limit">
8768 <term><varname>autovacuum_vacuum_cost_limit
</varname> (
<type>integer
</type>)
8770 <primary><varname>autovacuum_vacuum_cost_limit
</varname></primary>
8771 <secondary>configuration parameter
</secondary>
8776 Specifies the cost limit value that will be used in automatic
8777 <command>VACUUM
</command> operations. If
<literal>-
1</literal>
8778 is specified (which is the default), the regular
8779 <xref linkend=
"guc-vacuum-cost-limit"/> value will be used. Note that
8780 the value is distributed proportionally among the running autovacuum
8781 workers, if there is more than one, so that the sum of the limits for
8782 each worker does not exceed the value of this variable.
8783 This parameter can only be set in the
<filename>postgresql.conf
</filename>
8784 file or on the server command line;
8785 but the setting can be overridden for individual tables by
8786 changing table storage parameters.
8794 <sect2 id=
"runtime-config-resource-vacuum-cost">
8795 <title>Cost-based Vacuum Delay
</title>
8798 During the execution of
<xref linkend=
"sql-vacuum"/>
8799 and
<xref linkend=
"sql-analyze"/>
8800 commands, the system maintains an
8801 internal counter that keeps track of the estimated cost of the
8802 various I/O operations that are performed. When the accumulated
8803 cost reaches a limit (specified by
8804 <varname>vacuum_cost_limit
</varname>), the process performing
8805 the operation will sleep for a short period of time, as specified by
8806 <varname>vacuum_cost_delay
</varname>. Then it will reset the
8807 counter and continue execution.
8811 The intent of this feature is to allow administrators to reduce
8812 the I/O impact of these commands on concurrent database
8813 activity. There are many situations where it is not
8814 important that maintenance commands like
8815 <command>VACUUM
</command> and
<command>ANALYZE
</command> finish
8816 quickly; however, it is usually very important that these
8817 commands do not significantly interfere with the ability of the
8818 system to perform other database operations. Cost-based vacuum
8819 delay provides a way for administrators to achieve this.
8823 This feature is disabled by default for manually issued
8824 <command>VACUUM
</command> commands. To enable it, set the
8825 <varname>vacuum_cost_delay
</varname> variable to a nonzero
8830 <varlistentry id=
"guc-vacuum-cost-delay" xreflabel=
"vacuum_cost_delay">
8831 <term><varname>vacuum_cost_delay
</varname> (
<type>floating point
</type>)
8833 <primary><varname>vacuum_cost_delay
</varname> configuration parameter
</primary>
8838 The amount of time that the process will sleep when the cost
8839 limit has been exceeded. If this value is specified without
8840 units, it is taken as milliseconds. The default value is
8841 <literal>0</literal>, which disables the cost-based vacuum delay
8842 feature. Positive values enable cost-based vacuuming.
8846 When using cost-based vacuuming, appropriate values for
8847 <varname>vacuum_cost_delay
</varname> are usually quite small, perhaps
8848 less than
1 millisecond. While
<varname>vacuum_cost_delay
</varname>
8849 can be set to fractional-millisecond values, such delays may not be
8850 measured accurately on older platforms. On such platforms,
8851 increasing
<command>VACUUM
</command>'s throttled resource consumption
8852 above what you get at
1ms will require changing the other vacuum cost
8853 parameters. You should, nonetheless,
8854 keep
<varname>vacuum_cost_delay
</varname> as small as your platform
8855 will consistently measure; large delays are not helpful.
8860 <varlistentry id=
"guc-vacuum-cost-page-hit" xreflabel=
"vacuum_cost_page_hit">
8861 <term><varname>vacuum_cost_page_hit
</varname> (
<type>integer
</type>)
8863 <primary><varname>vacuum_cost_page_hit
</varname> configuration parameter
</primary>
8868 The estimated cost for vacuuming a buffer found in the shared
8869 buffer cache. It represents the cost to lock the buffer pool,
8870 lookup the shared hash table and scan the content of the page.
8871 The default value is
<literal>1</literal>.
8876 <varlistentry id=
"guc-vacuum-cost-page-miss" xreflabel=
"vacuum_cost_page_miss">
8877 <term><varname>vacuum_cost_page_miss
</varname> (
<type>integer
</type>)
8879 <primary><varname>vacuum_cost_page_miss
</varname> configuration parameter
</primary>
8884 The estimated cost for vacuuming a buffer that has to be read from
8885 disk. This represents the effort to lock the buffer pool,
8886 lookup the shared hash table, read the desired block in from
8887 the disk and scan its content. The default value is
8888 <literal>2</literal>.
8893 <varlistentry id=
"guc-vacuum-cost-page-dirty" xreflabel=
"vacuum_cost_page_dirty">
8894 <term><varname>vacuum_cost_page_dirty
</varname> (
<type>integer
</type>)
8896 <primary><varname>vacuum_cost_page_dirty
</varname> configuration parameter
</primary>
8901 The estimated cost charged when vacuum modifies a block that was
8902 previously clean. It represents the extra I/O required to
8903 flush the dirty block out to disk again. The default value is
8904 <literal>20</literal>.
8909 <varlistentry id=
"guc-vacuum-cost-limit" xreflabel=
"vacuum_cost_limit">
8910 <term><varname>vacuum_cost_limit
</varname> (
<type>integer
</type>)
8912 <primary><varname>vacuum_cost_limit
</varname> configuration parameter
</primary>
8917 This is the accumulated cost that will cause the vacuuming
8918 process to sleep for
<varname>vacuum_cost_delay
</varname>. The
8919 default is
<literal>200</literal>.
8927 There are certain operations that hold critical locks and should
8928 therefore complete as quickly as possible. Cost-based vacuum
8929 delays do not occur during such operations. Therefore it is
8930 possible that the cost accumulates far higher than the specified
8931 limit. To avoid uselessly long delays in such cases, the actual
8932 delay is calculated as
<varname>vacuum_cost_delay
</varname> *
8933 <varname>accumulated_balance
</varname> /
8934 <varname>vacuum_cost_limit
</varname> with a maximum of
8935 <varname>vacuum_cost_delay
</varname> *
4.
8940 <sect2 id=
"runtime-config-vacuum-freezing">
8941 <title>Freezing
</title>
8944 To maintain correctness even after transaction IDs wrap around,
8945 <productname>PostgreSQL
</productname> marks rows that are sufficiently
8946 old as
<emphasis>frozen
</emphasis>. These rows are visible to everyone;
8947 other transactions do not need to examine their inserting XID to
8948 determine visibility.
<command>VACUUM
</command> is responsible for
8949 marking rows as frozen. The following settings control
8950 <command>VACUUM
</command>'s freezing behavior and should be tuned based
8951 on the XID consumption rate of the system and data access patterns of the
8952 dominant workloads. See
<xref linkend=
"vacuum-for-wraparound"/> for more
8953 information on transaction ID wraparound and tuning these parameters.
8957 <varlistentry id=
"guc-vacuum-freeze-table-age" xreflabel=
"vacuum_freeze_table_age">
8958 <term><varname>vacuum_freeze_table_age
</varname> (
<type>integer
</type>)
8960 <primary><varname>vacuum_freeze_table_age
</varname> configuration parameter
</primary>
8965 <command>VACUUM
</command> performs an aggressive scan if the table's
8966 <structname>pg_class
</structname>.
<structfield>relfrozenxid
</structfield> field has reached
8967 the age specified by this setting. An aggressive scan differs from
8968 a regular
<command>VACUUM
</command> in that it visits every page that might
8969 contain unfrozen XIDs or MXIDs, not just those that might contain dead
8970 tuples. The default is
150 million transactions. Although users can
8971 set this value anywhere from zero to two billion,
<command>VACUUM
</command>
8972 will silently limit the effective value to
95% of
8973 <xref linkend=
"guc-autovacuum-freeze-max-age"/>, so that a
8974 periodic manual
<command>VACUUM
</command> has a chance to run before an
8975 anti-wraparound autovacuum is launched for the table. For more
8977 <xref linkend=
"vacuum-for-wraparound"/>.
8982 <varlistentry id=
"guc-vacuum-freeze-min-age" xreflabel=
"vacuum_freeze_min_age">
8983 <term><varname>vacuum_freeze_min_age
</varname> (
<type>integer
</type>)
8985 <primary><varname>vacuum_freeze_min_age
</varname> configuration parameter
</primary>
8990 Specifies the cutoff age (in transactions) that
8991 <command>VACUUM
</command> should use to decide whether to
8992 trigger freezing of pages that have an older XID.
8993 The default is
50 million transactions. Although
8994 users can set this value anywhere from zero to one billion,
8995 <command>VACUUM
</command> will silently limit the effective value to half
8996 the value of
<xref linkend=
"guc-autovacuum-freeze-max-age"/>, so
8997 that there is not an unreasonably short time between forced
8998 autovacuums. For more information see
<xref
8999 linkend=
"vacuum-for-wraparound"/>.
9004 <varlistentry id=
"guc-vacuum-failsafe-age" xreflabel=
"vacuum_failsafe_age">
9005 <term><varname>vacuum_failsafe_age
</varname> (
<type>integer
</type>)
9007 <primary><varname>vacuum_failsafe_age
</varname> configuration parameter
</primary>
9012 Specifies the maximum age (in transactions) that a table's
9013 <structname>pg_class
</structname>.
<structfield>relfrozenxid
</structfield>
9014 field can attain before
<command>VACUUM
</command> takes
9015 extraordinary measures to avoid system-wide transaction ID
9016 wraparound failure. This is
<command>VACUUM
</command>'s
9017 strategy of last resort. The failsafe typically triggers
9018 when an autovacuum to prevent transaction ID wraparound has
9019 already been running for some time, though it's possible for
9020 the failsafe to trigger during any
<command>VACUUM
</command>.
9023 When the failsafe is triggered, any cost-based delay that is
9024 in effect will no longer be applied, further non-essential
9025 maintenance tasks (such as index vacuuming) are bypassed, and any
9026 <glossterm linkend=
"glossary-buffer-access-strategy">Buffer Access Strategy
</glossterm>
9027 in use will be disabled resulting in
<command>VACUUM
</command> being
9028 free to make use of all of
9029 <glossterm linkend=
"glossary-shared-memory">shared buffers
</glossterm>.
9032 The default is
1.6 billion transactions. Although users can
9033 set this value anywhere from zero to
2.1 billion,
9034 <command>VACUUM
</command> will silently adjust the effective
9035 value to no less than
105% of
<xref
9036 linkend=
"guc-autovacuum-freeze-max-age"/>.
9041 <varlistentry id=
"guc-vacuum-multixact-freeze-table-age" xreflabel=
"vacuum_multixact_freeze_table_age">
9042 <term><varname>vacuum_multixact_freeze_table_age
</varname> (
<type>integer
</type>)
9044 <primary><varname>vacuum_multixact_freeze_table_age
</varname> configuration parameter
</primary>
9049 <command>VACUUM
</command> performs an aggressive scan if the table's
9050 <structname>pg_class
</structname>.
<structfield>relminmxid
</structfield> field has reached
9051 the age specified by this setting. An aggressive scan differs from
9052 a regular
<command>VACUUM
</command> in that it visits every page that might
9053 contain unfrozen XIDs or MXIDs, not just those that might contain dead
9054 tuples. The default is
150 million multixacts.
9055 Although users can set this value anywhere from zero to two billion,
9056 <command>VACUUM
</command> will silently limit the effective value to
95% of
9057 <xref linkend=
"guc-autovacuum-multixact-freeze-max-age"/>, so that a
9058 periodic manual
<command>VACUUM
</command> has a chance to run before an
9059 anti-wraparound is launched for the table.
9060 For more information see
<xref linkend=
"vacuum-for-multixact-wraparound"/>.
9065 <varlistentry id=
"guc-vacuum-multixact-freeze-min-age" xreflabel=
"vacuum_multixact_freeze_min_age">
9066 <term><varname>vacuum_multixact_freeze_min_age
</varname> (
<type>integer
</type>)
9068 <primary><varname>vacuum_multixact_freeze_min_age
</varname> configuration parameter
</primary>
9073 Specifies the cutoff age (in multixacts) that
<command>VACUUM
</command>
9074 should use to decide whether to trigger freezing of pages with
9075 an older multixact ID. The default is
5 million multixacts.
9076 Although users can set this value anywhere from zero to one billion,
9077 <command>VACUUM
</command> will silently limit the effective value to half
9078 the value of
<xref linkend=
"guc-autovacuum-multixact-freeze-max-age"/>,
9079 so that there is not an unreasonably short time between forced
9081 For more information see
<xref linkend=
"vacuum-for-multixact-wraparound"/>.
9086 <varlistentry id=
"guc-vacuum-multixact-failsafe-age" xreflabel=
"vacuum_multixact_failsafe_age">
9087 <term><varname>vacuum_multixact_failsafe_age
</varname> (
<type>integer
</type>)
9089 <primary><varname>vacuum_multixact_failsafe_age
</varname> configuration parameter
</primary>
9094 Specifies the maximum age (in multixacts) that a table's
9095 <structname>pg_class
</structname>.
<structfield>relminmxid
</structfield>
9096 field can attain before
<command>VACUUM
</command> takes
9097 extraordinary measures to avoid system-wide multixact ID
9098 wraparound failure. This is
<command>VACUUM
</command>'s
9099 strategy of last resort. The failsafe typically triggers when
9100 an autovacuum to prevent transaction ID wraparound has already
9101 been running for some time, though it's possible for the
9102 failsafe to trigger during any
<command>VACUUM
</command>.
9105 When the failsafe is triggered, any cost-based delay that is
9106 in effect will no longer be applied, and further non-essential
9107 maintenance tasks (such as index vacuuming) are bypassed.
9110 The default is
1.6 billion multixacts. Although users can set
9111 this value anywhere from zero to
2.1 billion,
9112 <command>VACUUM
</command> will silently adjust the effective
9113 value to no less than
105% of
<xref
9114 linkend=
"guc-autovacuum-multixact-freeze-max-age"/>.
9123 <sect1 id=
"runtime-config-client">
9124 <title>Client Connection Defaults
</title>
9126 <sect2 id=
"runtime-config-client-statement">
9127 <title>Statement Behavior
</title>
9130 <varlistentry id=
"guc-client-min-messages" xreflabel=
"client_min_messages">
9131 <term><varname>client_min_messages
</varname> (
<type>enum
</type>)
9133 <primary><varname>client_min_messages
</varname> configuration parameter
</primary>
9139 <link linkend=
"runtime-config-severity-levels">message levels
</link>
9140 are sent to the client.
9141 Valid values are
<literal>DEBUG5
</literal>,
9142 <literal>DEBUG4
</literal>,
<literal>DEBUG3
</literal>,
<literal>DEBUG2
</literal>,
9143 <literal>DEBUG1
</literal>,
<literal>LOG
</literal>,
<literal>NOTICE
</literal>,
9144 <literal>WARNING
</literal>, and
<literal>ERROR
</literal>.
9145 Each level includes all the levels that follow it. The later the level,
9146 the fewer messages are sent. The default is
9147 <literal>NOTICE
</literal>. Note that
<literal>LOG
</literal> has a different
9148 rank here than in
<xref linkend=
"guc-log-min-messages"/>.
9151 <literal>INFO
</literal> level messages are always sent to the client.
9156 <varlistentry id=
"guc-search-path" xreflabel=
"search_path">
9157 <term><varname>search_path
</varname> (
<type>string
</type>)
9159 <primary><varname>search_path
</varname> configuration parameter
</primary>
9161 <indexterm><primary>path
</primary><secondary>for schemas
</secondary></indexterm>
9165 This variable specifies the order in which schemas are searched
9166 when an object (table, data type, function, etc.) is referenced by a
9167 simple name with no schema specified. When there are objects of
9168 identical names in different schemas, the one found first
9169 in the search path is used. An object that is not in any of the
9170 schemas in the search path can only be referenced by specifying
9171 its containing schema with a qualified (dotted) name.
9175 The value for
<varname>search_path
</varname> must be a comma-separated
9176 list of schema names. Any name that is not an existing schema, or is
9177 a schema for which the user does not have
<literal>USAGE
</literal>
9178 permission, is silently ignored.
9182 If one of the list items is the special name
9183 <literal>$user
</literal>, then the schema having the name returned by
9184 <function>CURRENT_USER
</function> is substituted, if there is such a schema
9185 and the user has
<literal>USAGE
</literal> permission for it.
9186 (If not,
<literal>$user
</literal> is ignored.)
9190 The system catalog schema,
<literal>pg_catalog
</literal>, is always
9191 searched, whether it is mentioned in the path or not. If it is
9192 mentioned in the path then it will be searched in the specified
9193 order. If
<literal>pg_catalog
</literal> is not in the path then it will
9194 be searched
<emphasis>before
</emphasis> searching any of the path items.
9197 <!-- To further split hairs, funcname('foo') does not use the temporary
9198 schema, even when it considers typname='funcname'. This paragraph
9199 refers to function names in a loose sense, "pg_proc.proname or
9200 func_name grammar production". -->
9202 Likewise, the current session's temporary-table schema,
9203 <literal>pg_temp_
<replaceable>nnn
</replaceable></literal>, is always searched if it
9204 exists. It can be explicitly listed in the path by using the
9205 alias
<literal>pg_temp
</literal><indexterm><primary>pg_temp
</primary></indexterm>. If it is not listed in the path then
9206 it is searched first (even before
<literal>pg_catalog
</literal>). However,
9207 the temporary schema is only searched for relation (table, view,
9208 sequence, etc.) and data type names. It is never searched for
9209 function or operator names.
9213 When objects are created without specifying a particular target
9214 schema, they will be placed in the first valid schema named in
9215 <varname>search_path
</varname>. An error is reported if the search
9220 The default value for this parameter is
9221 <literal>"$user", public
</literal>.
9222 This setting supports shared use of a database (where no users
9223 have private schemas, and all share use of
<literal>public
</literal>),
9224 private per-user schemas, and combinations of these. Other
9225 effects can be obtained by altering the default search path
9226 setting, either globally or per-user.
9230 For more information on schema handling, see
9231 <xref linkend=
"ddl-schemas"/>. In particular, the default
9232 configuration is suitable only when the database has a single user or
9233 a few mutually-trusting users.
9237 The current effective value of the search path can be examined
9238 via the
<acronym>SQL
</acronym> function
9239 <function>current_schemas
</function>
9240 (see
<xref linkend=
"functions-info"/>).
9241 This is not quite the same as
9242 examining the value of
<varname>search_path
</varname>, since
9243 <function>current_schemas
</function> shows how the items
9244 appearing in
<varname>search_path
</varname> were resolved.
9250 <varlistentry id=
"guc-row-security" xreflabel=
"row_security">
9251 <term><varname>row_security
</varname> (
<type>boolean
</type>)
9253 <primary><varname>row_security
</varname> configuration parameter
</primary>
9258 This variable controls whether to raise an error in lieu of applying a
9259 row security policy. When set to
<literal>on
</literal>, policies apply
9260 normally. When set to
<literal>off
</literal>, queries fail which would
9261 otherwise apply at least one policy. The default is
<literal>on
</literal>.
9262 Change to
<literal>off
</literal> where limited row visibility could cause
9263 incorrect results; for example,
<application>pg_dump
</application> makes that
9264 change by default. This variable has no effect on roles which bypass
9265 every row security policy, to wit, superusers and roles with
9266 the
<literal>BYPASSRLS
</literal> attribute.
9270 For more information on row security policies,
9271 see
<xref linkend=
"sql-createpolicy"/>.
9276 <varlistentry id=
"guc-default-table-access-method" xreflabel=
"default_table_access_method">
9277 <term><varname>default_table_access_method
</varname> (
<type>string
</type>)
9279 <primary><varname>default_table_access_method
</varname> configuration parameter
</primary>
9284 This parameter specifies the default table access method to use when
9285 creating tables or materialized views if the
<command>CREATE
</command>
9286 command does not explicitly specify an access method, or when
9287 <command>SELECT ... INTO
</command> is used, which does not allow
9288 specifying a table access method. The default is
<literal>heap
</literal>.
9293 <varlistentry id=
"guc-default-tablespace" xreflabel=
"default_tablespace">
9294 <term><varname>default_tablespace
</varname> (
<type>string
</type>)
9296 <primary><varname>default_tablespace
</varname> configuration parameter
</primary>
9298 <indexterm><primary>tablespace
</primary><secondary>default
</secondary></indexterm>
9302 This variable specifies the default tablespace in which to create
9303 objects (tables and indexes) when a
<command>CREATE
</command> command does
9304 not explicitly specify a tablespace.
9308 The value is either the name of a tablespace, or an empty string
9309 to specify using the default tablespace of the current database.
9310 If the value does not match the name of any existing tablespace,
9311 <productname>PostgreSQL
</productname> will automatically use the default
9312 tablespace of the current database. If a nondefault tablespace
9313 is specified, the user must have
<literal>CREATE
</literal> privilege
9314 for it, or creation attempts will fail.
9318 This variable is not used for temporary tables; for them,
9319 <xref linkend=
"guc-temp-tablespaces"/> is consulted instead.
9323 This variable is also not used when creating databases.
9324 By default, a new database inherits its tablespace setting from
9325 the template database it is copied from.
9329 If this parameter is set to a value other than the empty string
9330 when a partitioned table is created, the partitioned table's
9331 tablespace will be set to that value, which will be used as
9332 the default tablespace for partitions created in the future,
9333 even if
<varname>default_tablespace
</varname> has changed since then.
9337 For more information on tablespaces,
9338 see
<xref linkend=
"manage-ag-tablespaces"/>.
9343 <varlistentry id=
"guc-default-toast-compression" xreflabel=
"default_toast_compression">
9344 <term><varname>default_toast_compression
</varname> (
<type>enum
</type>)
9346 <primary><varname>default_toast_compression
</varname> configuration parameter
</primary>
9351 This variable sets the default
9352 <link linkend=
"storage-toast">TOAST
</link>
9353 compression method for values of compressible columns.
9354 (This can be overridden for individual columns by setting
9355 the
<literal>COMPRESSION
</literal> column option in
9356 <command>CREATE TABLE
</command> or
9357 <command>ALTER TABLE
</command>.)
9358 The supported compression methods are
<literal>pglz
</literal> and
9359 (if
<productname>PostgreSQL
</productname> was compiled with
9360 <option>--with-lz4
</option>)
<literal>lz4
</literal>.
9361 The default is
<literal>pglz
</literal>.
9366 <varlistentry id=
"guc-temp-tablespaces" xreflabel=
"temp_tablespaces">
9367 <term><varname>temp_tablespaces
</varname> (
<type>string
</type>)
9369 <primary><varname>temp_tablespaces
</varname> configuration parameter
</primary>
9371 <indexterm><primary>tablespace
</primary><secondary>temporary
</secondary></indexterm>
9375 This variable specifies tablespaces in which to create temporary
9376 objects (temp tables and indexes on temp tables) when a
9377 <command>CREATE
</command> command does not explicitly specify a tablespace.
9378 Temporary files for purposes such as sorting large data sets
9379 are also created in these tablespaces.
9383 The value is a list of names of tablespaces. When there is more than
9384 one name in the list,
<productname>PostgreSQL
</productname> chooses a random
9385 member of the list each time a temporary object is to be created;
9386 except that within a transaction, successively created temporary
9387 objects are placed in successive tablespaces from the list.
9388 If the selected element of the list is an empty string,
9389 <productname>PostgreSQL
</productname> will automatically use the default
9390 tablespace of the current database instead.
9394 When
<varname>temp_tablespaces
</varname> is set interactively, specifying a
9395 nonexistent tablespace is an error, as is specifying a tablespace for
9396 which the user does not have
<literal>CREATE
</literal> privilege. However,
9397 when using a previously set value, nonexistent tablespaces are
9398 ignored, as are tablespaces for which the user lacks
9399 <literal>CREATE
</literal> privilege. In particular, this rule applies when
9400 using a value set in
<filename>postgresql.conf
</filename>.
9404 The default value is an empty string, which results in all temporary
9405 objects being created in the default tablespace of the current
9410 See also
<xref linkend=
"guc-default-tablespace"/>.
9415 <varlistentry id=
"guc-check-function-bodies" xreflabel=
"check_function_bodies">
9416 <term><varname>check_function_bodies
</varname> (
<type>boolean
</type>)
9418 <primary><varname>check_function_bodies
</varname> configuration parameter
</primary>
9423 This parameter is normally on. When set to
<literal>off
</literal>, it
9424 disables validation of the routine body string during
<xref
9425 linkend=
"sql-createfunction"/> and
<xref
9426 linkend=
"sql-createprocedure"/>. Disabling validation avoids side
9427 effects of the validation process, in particular preventing false
9428 positives due to problems such as forward references.
9430 to
<literal>off
</literal> before loading functions on behalf of other
9431 users;
<application>pg_dump
</application> does so automatically.
9436 <varlistentry id=
"guc-default-transaction-isolation" xreflabel=
"default_transaction_isolation">
9437 <term><varname>default_transaction_isolation
</varname> (
<type>enum
</type>)
9439 <primary>transaction isolation level
</primary>
9440 <secondary>setting default
</secondary>
9443 <primary><varname>default_transaction_isolation
</varname> configuration parameter
</primary>
9448 Each SQL transaction has an isolation level, which can be
9449 either
<quote>read uncommitted
</quote>,
<quote>read
9450 committed
</quote>,
<quote>repeatable read
</quote>, or
9451 <quote>serializable
</quote>. This parameter controls the
9452 default isolation level of each new transaction. The default
9453 is
<quote>read committed
</quote>.
9457 Consult
<xref linkend=
"mvcc"/> and
<xref
9458 linkend=
"sql-set-transaction"/> for more information.
9463 <varlistentry id=
"guc-default-transaction-read-only" xreflabel=
"default_transaction_read_only">
9464 <term><varname>default_transaction_read_only
</varname> (
<type>boolean
</type>)
9466 <primary>read-only transaction
</primary>
9467 <secondary>setting default
</secondary>
9470 <primary><varname>default_transaction_read_only
</varname> configuration parameter
</primary>
9475 A read-only SQL transaction cannot alter non-temporary tables.
9476 This parameter controls the default read-only status of each new
9477 transaction. The default is
<literal>off
</literal> (read/write).
9481 Consult
<xref linkend=
"sql-set-transaction"/> for more information.
9486 <varlistentry id=
"guc-default-transaction-deferrable" xreflabel=
"default_transaction_deferrable">
9487 <term><varname>default_transaction_deferrable
</varname> (
<type>boolean
</type>)
9489 <primary>deferrable transaction
</primary>
9490 <secondary>setting default
</secondary>
9493 <primary><varname>default_transaction_deferrable
</varname> configuration parameter
</primary>
9498 When running at the
<literal>serializable
</literal> isolation level,
9499 a deferrable read-only SQL transaction may be delayed before
9500 it is allowed to proceed. However, once it begins executing
9501 it does not incur any of the overhead required to ensure
9502 serializability; so serialization code will have no reason to
9503 force it to abort because of concurrent updates, making this
9504 option suitable for long-running read-only transactions.
9508 This parameter controls the default deferrable status of each
9509 new transaction. It currently has no effect on read-write
9510 transactions or those operating at isolation levels lower
9511 than
<literal>serializable
</literal>. The default is
<literal>off
</literal>.
9515 Consult
<xref linkend=
"sql-set-transaction"/> for more information.
9520 <varlistentry id=
"guc-transaction-isolation" xreflabel=
"transaction_isolation">
9521 <term><varname>transaction_isolation
</varname> (
<type>enum
</type>)
9523 <primary>transaction isolation level
</primary>
9526 <primary><varname>transaction_isolation
</varname> configuration parameter
</primary>
9531 This parameter reflects the current transaction's isolation level.
9532 At the beginning of each transaction, it is set to the current value
9533 of
<xref linkend=
"guc-default-transaction-isolation"/>.
9534 Any subsequent attempt to change it is equivalent to a
<xref
9535 linkend=
"sql-set-transaction"/> command.
9540 <varlistentry id=
"guc-transaction-read-only" xreflabel=
"transaction_read_only">
9541 <term><varname>transaction_read_only
</varname> (
<type>boolean
</type>)
9543 <primary>read-only transaction
</primary>
9546 <primary><varname>transaction_read_only
</varname> configuration parameter
</primary>
9551 This parameter reflects the current transaction's read-only status.
9552 At the beginning of each transaction, it is set to the current value
9553 of
<xref linkend=
"guc-default-transaction-read-only"/>.
9554 Any subsequent attempt to change it is equivalent to a
<xref
9555 linkend=
"sql-set-transaction"/> command.
9560 <varlistentry id=
"guc-transaction-deferrable" xreflabel=
"transaction_deferrable">
9561 <term><varname>transaction_deferrable
</varname> (
<type>boolean
</type>)
9563 <primary>deferrable transaction
</primary>
9566 <primary><varname>transaction_deferrable
</varname> configuration parameter
</primary>
9571 This parameter reflects the current transaction's deferrability status.
9572 At the beginning of each transaction, it is set to the current value
9573 of
<xref linkend=
"guc-default-transaction-deferrable"/>.
9574 Any subsequent attempt to change it is equivalent to a
<xref
9575 linkend=
"sql-set-transaction"/> command.
9581 <varlistentry id=
"guc-session-replication-role" xreflabel=
"session_replication_role">
9582 <term><varname>session_replication_role
</varname> (
<type>enum
</type>)
9584 <primary><varname>session_replication_role
</varname> configuration parameter
</primary>
9589 Controls firing of replication-related triggers and rules for the
9591 Possible values are
<literal>origin
</literal> (the default),
9592 <literal>replica
</literal> and
<literal>local
</literal>.
9593 Setting this parameter results in discarding any previously cached
9595 Only superusers and users with the appropriate
<literal>SET
</literal>
9596 privilege can change this setting.
9600 The intended use of this setting is that logical replication systems
9601 set it to
<literal>replica
</literal> when they are applying replicated
9602 changes. The effect of that will be that triggers and rules (that
9603 have not been altered from their default configuration) will not fire
9604 on the replica. See the
<link linkend=
"sql-altertable"><command>ALTER TABLE
</command></link> clauses
9605 <literal>ENABLE TRIGGER
</literal> and
<literal>ENABLE RULE
</literal>
9606 for more information.
9610 PostgreSQL treats the settings
<literal>origin
</literal> and
9611 <literal>local
</literal> the same internally. Third-party replication
9612 systems may use these two values for their internal purposes, for
9613 example using
<literal>local
</literal> to designate a session whose
9614 changes should not be replicated.
9618 Since foreign keys are implemented as triggers, setting this parameter
9619 to
<literal>replica
</literal> also disables all foreign key checks,
9620 which can leave data in an inconsistent state if improperly used.
9625 <varlistentry id=
"guc-statement-timeout" xreflabel=
"statement_timeout">
9626 <term><varname>statement_timeout
</varname> (
<type>integer
</type>)
9628 <primary><varname>statement_timeout
</varname> configuration parameter
</primary>
9633 Abort any statement that takes more than the specified amount of time.
9634 If
<varname>log_min_error_statement
</varname> is set
9635 to
<literal>ERROR
</literal> or lower, the statement that timed out
9636 will also be logged.
9637 If this value is specified without units, it is taken as milliseconds.
9638 A value of zero (the default) disables the timeout.
9642 The timeout is measured from the time a command arrives at the
9643 server until it is completed by the server. If multiple SQL
9644 statements appear in a single simple-query message, the timeout
9645 is applied to each statement separately.
9646 (
<productname>PostgreSQL
</productname> versions before
13 usually
9647 treated the timeout as applying to the whole query string.)
9648 In extended query protocol, the timeout starts running when any
9649 query-related message (Parse, Bind, Execute, Describe) arrives, and
9650 it is canceled by completion of an Execute or Sync message.
9654 Setting
<varname>statement_timeout
</varname> in
9655 <filename>postgresql.conf
</filename> is not recommended because it would
9656 affect all sessions.
9661 <varlistentry id=
"guc-transaction-timeout" xreflabel=
"transaction_timeout">
9662 <term><varname>transaction_timeout
</varname> (
<type>integer
</type>)
9664 <primary><varname>transaction_timeout
</varname> configuration parameter
</primary>
9669 Terminate any session that spans longer than the specified amount of
9670 time in a transaction. The limit applies both to explicit transactions
9671 (started with
<command>BEGIN
</command>) and to an implicitly started
9672 transaction corresponding to a single statement.
9673 If this value is specified without units, it is taken as milliseconds.
9674 A value of zero (the default) disables the timeout.
9678 If
<varname>transaction_timeout
</varname> is shorter or equal to
9679 <varname>idle_in_transaction_session_timeout
</varname> or
<varname>statement_timeout
</varname>
9680 then the longer timeout is ignored.
9684 Setting
<varname>transaction_timeout
</varname> in
9685 <filename>postgresql.conf
</filename> is not recommended because it would
9686 affect all sessions.
9691 Prepared transactions are not subject to this timeout.
9697 <varlistentry id=
"guc-lock-timeout" xreflabel=
"lock_timeout">
9698 <term><varname>lock_timeout
</varname> (
<type>integer
</type>)
9700 <primary><varname>lock_timeout
</varname> configuration parameter
</primary>
9705 Abort any statement that waits longer than the specified amount of
9706 time while attempting to acquire a lock on a table, index,
9707 row, or other database object. The time limit applies separately to
9708 each lock acquisition attempt. The limit applies both to explicit
9709 locking requests (such as
<command>LOCK TABLE
</command>, or
<command>SELECT
9710 FOR UPDATE
</command> without
<literal>NOWAIT
</literal>) and to implicitly-acquired
9712 If this value is specified without units, it is taken as milliseconds.
9713 A value of zero (the default) disables the timeout.
9717 Unlike
<varname>statement_timeout
</varname>, this timeout can only occur
9718 while waiting for locks. Note that if
<varname>statement_timeout
</varname>
9719 is nonzero, it is rather pointless to set
<varname>lock_timeout
</varname> to
9720 the same or larger value, since the statement timeout would always
9721 trigger first. If
<varname>log_min_error_statement
</varname> is set to
9722 <literal>ERROR
</literal> or lower, the statement that timed out will be
9727 Setting
<varname>lock_timeout
</varname> in
9728 <filename>postgresql.conf
</filename> is not recommended because it would
9729 affect all sessions.
9734 <varlistentry id=
"guc-idle-in-transaction-session-timeout" xreflabel=
"idle_in_transaction_session_timeout">
9735 <term><varname>idle_in_transaction_session_timeout
</varname> (
<type>integer
</type>)
9737 <primary><varname>idle_in_transaction_session_timeout
</varname> configuration parameter
</primary>
9742 Terminate any session that has been idle (that is, waiting for a
9743 client query) within an open transaction for longer than the
9744 specified amount of time.
9745 If this value is specified without units, it is taken as milliseconds.
9746 A value of zero (the default) disables the timeout.
9750 This option can be used to ensure that idle sessions do not hold
9751 locks for an unreasonable amount of time. Even when no significant
9752 locks are held, an open transaction prevents vacuuming away
9753 recently-dead tuples that may be visible only to this transaction;
9754 so remaining idle for a long time can contribute to table bloat.
9755 See
<xref linkend=
"routine-vacuuming"/> for more details.
9760 <varlistentry id=
"guc-idle-session-timeout" xreflabel=
"idle_session_timeout">
9761 <term><varname>idle_session_timeout
</varname> (
<type>integer
</type>)
9763 <primary><varname>idle_session_timeout
</varname> configuration parameter
</primary>
9768 Terminate any session that has been idle (that is, waiting for a
9769 client query), but not within an open transaction, for longer than
9770 the specified amount of time.
9771 If this value is specified without units, it is taken as milliseconds.
9772 A value of zero (the default) disables the timeout.
9776 Unlike the case with an open transaction, an idle session without a
9777 transaction imposes no large costs on the server, so there is less
9778 need to enable this timeout
9779 than
<varname>idle_in_transaction_session_timeout
</varname>.
9783 Be wary of enforcing this timeout on connections made through
9784 connection-pooling software or other middleware, as such a layer
9785 may not react well to unexpected connection closure. It may be
9786 helpful to enable this timeout only for interactive sessions,
9787 perhaps by applying it only to particular users.
9792 <varlistentry id=
"guc-bytea-output" xreflabel=
"bytea_output">
9793 <term><varname>bytea_output
</varname> (
<type>enum
</type>)
9795 <primary><varname>bytea_output
</varname> configuration parameter
</primary>
9800 Sets the output format for values of type
<type>bytea
</type>.
9801 Valid values are
<literal>hex
</literal> (the default)
9802 and
<literal>escape
</literal> (the traditional PostgreSQL
9803 format). See
<xref linkend=
"datatype-binary"/> for more
9804 information. The
<type>bytea
</type> type always
9805 accepts both formats on input, regardless of this setting.
9810 <varlistentry id=
"guc-xmlbinary" xreflabel=
"xmlbinary">
9811 <term><varname>xmlbinary
</varname> (
<type>enum
</type>)
9813 <primary><varname>xmlbinary
</varname> configuration parameter
</primary>
9818 Sets how binary values are to be encoded in XML. This applies
9819 for example when
<type>bytea
</type> values are converted to
9820 XML by the functions
<function>xmlelement
</function> or
9821 <function>xmlforest
</function>. Possible values are
9822 <literal>base64
</literal> and
<literal>hex
</literal>, which
9823 are both defined in the XML Schema standard. The default is
9824 <literal>base64
</literal>. For further information about
9825 XML-related functions, see
<xref linkend=
"functions-xml"/>.
9829 The actual choice here is mostly a matter of taste,
9830 constrained only by possible restrictions in client
9831 applications. Both methods support all possible values,
9832 although the hex encoding will be somewhat larger than the
9838 <varlistentry id=
"guc-xmloption" xreflabel=
"xmloption">
9839 <term><varname>xmloption
</varname> (
<type>enum
</type>)
9841 <primary><varname>xmloption
</varname> configuration parameter
</primary>
9844 <primary><varname>SET XML OPTION
</varname></primary>
9847 <primary>XML option
</primary>
9852 Sets whether
<literal>DOCUMENT
</literal> or
9853 <literal>CONTENT
</literal> is implicit when converting between
9854 XML and character string values. See
<xref
9855 linkend=
"datatype-xml"/> for a description of this. Valid
9856 values are
<literal>DOCUMENT
</literal> and
9857 <literal>CONTENT
</literal>. The default is
9858 <literal>CONTENT
</literal>.
9862 According to the SQL standard, the command to set this option is
9864 SET XML OPTION { DOCUMENT | CONTENT };
9866 This syntax is also available in PostgreSQL.
9871 <varlistentry id=
"guc-gin-pending-list-limit" xreflabel=
"gin_pending_list_limit">
9872 <term><varname>gin_pending_list_limit
</varname> (
<type>integer
</type>)
9874 <primary><varname>gin_pending_list_limit
</varname></primary>
9875 <secondary>configuration parameter
</secondary>
9880 Sets the maximum size of a GIN index's pending list, which is used
9881 when
<literal>fastupdate
</literal> is enabled. If the list grows
9882 larger than this maximum size, it is cleaned up by moving
9883 the entries in it to the index's main GIN data structure in bulk.
9884 If this value is specified without units, it is taken as kilobytes.
9885 The default is four megabytes (
<literal>4MB
</literal>). This setting
9886 can be overridden for individual GIN indexes by changing
9887 index storage parameters.
9888 See
<xref linkend=
"gin-fast-update"/> and
<xref linkend=
"gin-tips"/>
9889 for more information.
9894 <varlistentry id=
"guc-createrole-self-grant" xreflabel=
"createrole_self_grant">
9895 <term><varname>createrole_self_grant
</varname> (
<type>string
</type>)
9897 <primary><varname>createrole_self_grant
</varname></primary>
9898 <secondary>configuration parameter
</secondary>
9903 If a user who has
<literal>CREATEROLE
</literal> but not
9904 <literal>SUPERUSER
</literal> creates a role, and if this
9905 is set to a non-empty value, the newly-created role will be granted
9906 to the creating user with the options specified. The value must be
9907 <literal>set
</literal>,
<literal>inherit
</literal>, or a
9908 comma-separated list of these. The default value is an empty string,
9909 which disables the feature.
9912 The purpose of this option is to allow a
<literal>CREATEROLE
</literal>
9913 user who is not a superuser to automatically inherit, or automatically
9914 gain the ability to
<literal>SET ROLE
</literal> to, any created users.
9915 Since a
<literal>CREATEROLE
</literal> user is always implicitly granted
9916 <literal>ADMIN OPTION
</literal> on created roles, that user could
9917 always execute a
<literal>GRANT
</literal> statement that would achieve
9918 the same effect as this setting. However, it can be convenient for
9919 usability reasons if the grant happens automatically. A superuser
9920 automatically inherits the privileges of every role and can always
9921 <literal>SET ROLE
</literal> to any role, and this setting can be used
9922 to produce a similar behavior for
<literal>CREATEROLE
</literal> users
9923 for users which they create.
9928 <varlistentry id=
"guc-event-triggers" xreflabel=
"event_triggers">
9929 <term><varname>event_triggers
</varname> (
<type>boolean
</type>)
9931 <primary><varname>event_triggers
</varname></primary>
9932 <secondary>configuration parameter
</secondary>
9937 Allow temporarily disabling execution of event triggers in order to
9938 troubleshoot and repair faulty event triggers. All event triggers will
9939 be disabled by setting it to
<literal>false
</literal>. Setting the value
9940 to
<literal>true
</literal> allows all event triggers to fire, this
9941 is the default value. Only superusers and users with the appropriate
9942 <literal>SET
</literal> privilege can change this setting.
9947 <varlistentry id=
"guc-restrict-nonsystem-relation-kind" xreflabel=
"restrict_nonsystem_relation_kind">
9948 <term><varname>restrict_nonsystem_relation_kind
</varname> (
<type>string
</type>)
9950 <primary><varname>restrict_nonsystem_relation_kind
</varname></primary>
9951 <secondary>configuration parameter
</secondary>
9956 Set relation kinds for which access to non-system relations is prohibited.
9957 The value takes the form of a comma-separated list of relation kinds.
9958 Currently, the supported relation kinds are
<literal>view
</literal> and
9959 <literal>foreign-table
</literal>.
9966 <sect2 id=
"runtime-config-client-format">
9967 <title>Locale and Formatting
</title>
9971 <varlistentry id=
"guc-datestyle" xreflabel=
"DateStyle">
9972 <term><varname>DateStyle
</varname> (
<type>string
</type>)
9974 <primary><varname>DateStyle
</varname> configuration parameter
</primary>
9979 Sets the display format for date and time values, as well as the
9980 rules for interpreting ambiguous date input values. For
9981 historical reasons, this variable contains two independent
9982 components: the output format specification (
<literal>ISO
</literal>,
9983 <literal>Postgres
</literal>,
<literal>SQL
</literal>, or
<literal>German
</literal>)
9984 and the input/output specification for year/month/day ordering
9985 (
<literal>DMY
</literal>,
<literal>MDY
</literal>, or
<literal>YMD
</literal>). These
9986 can be set separately or together. The keywords
<literal>Euro
</literal>
9987 and
<literal>European
</literal> are synonyms for
<literal>DMY
</literal>; the
9988 keywords
<literal>US
</literal>,
<literal>NonEuro
</literal>, and
9989 <literal>NonEuropean
</literal> are synonyms for
<literal>MDY
</literal>. See
9990 <xref linkend=
"datatype-datetime"/> for more information. The
9991 built-in default is
<literal>ISO, MDY
</literal>, but
9992 <application>initdb
</application> will initialize the
9993 configuration file with a setting that corresponds to the
9994 behavior of the chosen
<varname>lc_time
</varname> locale.
9999 <varlistentry id=
"guc-intervalstyle" xreflabel=
"IntervalStyle">
10000 <term><varname>IntervalStyle
</varname> (
<type>enum
</type>)
10002 <primary><varname>IntervalStyle
</varname> configuration parameter
</primary>
10007 Sets the display format for interval values.
10008 The value
<literal>sql_standard
</literal> will produce
10009 output matching
<acronym>SQL
</acronym> standard interval literals.
10010 The value
<literal>postgres
</literal> (which is the default) will produce
10011 output matching
<productname>PostgreSQL
</productname> releases prior to
8.4
10012 when the
<xref linkend=
"guc-datestyle"/>
10013 parameter was set to
<literal>ISO
</literal>.
10014 The value
<literal>postgres_verbose
</literal> will produce output
10015 matching
<productname>PostgreSQL
</productname> releases prior to
8.4
10016 when the
<varname>DateStyle
</varname>
10017 parameter was set to non-
<literal>ISO
</literal> output.
10018 The value
<literal>iso_8601
</literal> will produce output matching the time
10019 interval
<quote>format with designators
</quote> defined in section
10020 4.4.3.2 of ISO
8601.
10023 The
<varname>IntervalStyle
</varname> parameter also affects the
10024 interpretation of ambiguous interval input. See
10025 <xref linkend=
"datatype-interval-input"/> for more information.
10030 <varlistentry id=
"guc-timezone" xreflabel=
"TimeZone">
10031 <term><varname>TimeZone
</varname> (
<type>string
</type>)
10033 <primary><varname>TimeZone
</varname> configuration parameter
</primary>
10035 <indexterm><primary>time zone
</primary></indexterm>
10039 Sets the time zone for displaying and interpreting time stamps.
10040 The built-in default is
<literal>GMT
</literal>, but that is typically
10041 overridden in
<filename>postgresql.conf
</filename>;
<application>initdb
</application>
10042 will install a setting there corresponding to its system environment.
10043 See
<xref linkend=
"datatype-timezones"/> for more information.
10048 <varlistentry id=
"guc-timezone-abbreviations" xreflabel=
"timezone_abbreviations">
10049 <term><varname>timezone_abbreviations
</varname> (
<type>string
</type>)
10051 <primary><varname>timezone_abbreviations
</varname> configuration parameter
</primary>
10053 <indexterm><primary>time zone names
</primary></indexterm>
10057 Sets the collection of time zone abbreviations that will be accepted
10058 by the server for datetime input. The default is
<literal>'Default'
</literal>,
10059 which is a collection that works in most of the world; there are
10060 also
<literal>'Australia'
</literal> and
<literal>'India'
</literal>,
10061 and other collections can be defined for a particular installation.
10062 See
<xref linkend=
"datetime-config-files"/> for more information.
10067 <varlistentry id=
"guc-extra-float-digits" xreflabel=
"extra_float_digits">
10068 <term><varname>extra_float_digits
</varname> (
<type>integer
</type>)
10070 <primary>significant digits
</primary>
10073 <primary>floating-point
</primary>
10074 <secondary>display
</secondary>
10077 <primary><varname>extra_float_digits
</varname> configuration parameter
</primary>
10082 This parameter adjusts the number of digits used for textual output of
10083 floating-point values, including
<type>float4
</type>,
<type>float8
</type>,
10084 and geometric data types.
10087 If the value is
1 (the default) or above, float values are output in
10088 shortest-precise format; see
<xref linkend=
"datatype-float"/>. The
10089 actual number of digits generated depends only on the value being
10090 output, not on the value of this parameter. At most
17 digits are
10091 required for
<type>float8
</type> values, and
9 for
<type>float4
</type>
10092 values. This format is both fast and precise, preserving the original
10093 binary float value exactly when correctly read. For historical
10094 compatibility, values up to
3 are permitted.
10097 If the value is zero or negative, then the output is rounded to a
10098 given decimal precision. The precision used is the standard number of
10099 digits for the type (
<literal>FLT_DIG
</literal>
10100 or
<literal>DBL_DIG
</literal> as appropriate) reduced according to the
10101 value of this parameter. (For example, specifying -
1 will cause
10102 <type>float4
</type> values to be output rounded to
5 significant
10103 digits, and
<type>float8
</type> values
10104 rounded to
14 digits.) This format is slower and does not preserve all
10105 the bits of the binary float value, but may be more human-readable.
10109 The meaning of this parameter, and its default value, changed
10110 in
<productname>PostgreSQL
</productname> 12;
10111 see
<xref linkend=
"datatype-float"/> for further discussion.
10117 <varlistentry id=
"guc-client-encoding" xreflabel=
"client_encoding">
10118 <term><varname>client_encoding
</varname> (
<type>string
</type>)
10120 <primary><varname>client_encoding
</varname> configuration parameter
</primary>
10122 <indexterm><primary>character set
</primary></indexterm>
10126 Sets the client-side encoding (character set).
10127 The default is to use the database encoding.
10128 The character sets supported by the
<productname>PostgreSQL
</productname>
10129 server are described in
<xref linkend=
"multibyte-charset-supported"/>.
10134 <varlistentry id=
"guc-lc-messages" xreflabel=
"lc_messages">
10135 <term><varname>lc_messages
</varname> (
<type>string
</type>)
10137 <primary><varname>lc_messages
</varname> configuration parameter
</primary>
10142 Sets the language in which messages are displayed. Acceptable
10143 values are system-dependent; see
<xref linkend=
"locale"/> for
10144 more information. If this variable is set to the empty string
10145 (which is the default) then the value is inherited from the
10146 execution environment of the server in a system-dependent way.
10150 On some systems, this locale category does not exist. Setting
10151 this variable will still work, but there will be no effect.
10152 Also, there is a chance that no translated messages for the
10153 desired language exist. In that case you will continue to see
10154 the English messages.
10158 Only superusers and users with the appropriate
<literal>SET
</literal>
10159 privilege can change this setting.
10164 <varlistentry id=
"guc-lc-monetary" xreflabel=
"lc_monetary">
10165 <term><varname>lc_monetary
</varname> (
<type>string
</type>)
10167 <primary><varname>lc_monetary
</varname> configuration parameter
</primary>
10172 Sets the locale to use for formatting monetary amounts, for
10173 example with the
<function>to_char
</function> family of
10174 functions. Acceptable values are system-dependent; see
<xref
10175 linkend=
"locale"/> for more information. If this variable is
10176 set to the empty string (which is the default) then the value
10177 is inherited from the execution environment of the server in a
10178 system-dependent way.
10183 <varlistentry id=
"guc-lc-numeric" xreflabel=
"lc_numeric">
10184 <term><varname>lc_numeric
</varname> (
<type>string
</type>)
10186 <primary><varname>lc_numeric
</varname> configuration parameter
</primary>
10191 Sets the locale to use for formatting numbers, for example
10192 with the
<function>to_char
</function> family of
10193 functions. Acceptable values are system-dependent; see
<xref
10194 linkend=
"locale"/> for more information. If this variable is
10195 set to the empty string (which is the default) then the value
10196 is inherited from the execution environment of the server in a
10197 system-dependent way.
10202 <varlistentry id=
"guc-lc-time" xreflabel=
"lc_time">
10203 <term><varname>lc_time
</varname> (
<type>string
</type>)
10205 <primary><varname>lc_time
</varname> configuration parameter
</primary>
10210 Sets the locale to use for formatting dates and times, for example
10211 with the
<function>to_char
</function> family of
10212 functions. Acceptable values are system-dependent; see
<xref
10213 linkend=
"locale"/> for more information. If this variable is
10214 set to the empty string (which is the default) then the value
10215 is inherited from the execution environment of the server in a
10216 system-dependent way.
10221 <varlistentry id=
"guc-icu-validation-level" xreflabel=
"icu_validation_level">
10222 <term><varname>icu_validation_level
</varname> (
<type>enum
</type>)
10224 <primary><varname>icu_validation_level
</varname> configuration parameter
</primary>
10229 When ICU locale validation problems are encountered, controls which
10230 <link linkend=
"runtime-config-severity-levels">message level
</link> is
10231 used to report the problem. Valid values are
10232 <literal>DISABLED
</literal>,
<literal>DEBUG5
</literal>,
10233 <literal>DEBUG4
</literal>,
<literal>DEBUG3
</literal>,
10234 <literal>DEBUG2
</literal>,
<literal>DEBUG1
</literal>,
10235 <literal>INFO
</literal>,
<literal>NOTICE
</literal>,
10236 <literal>WARNING
</literal>,
<literal>ERROR
</literal>, and
10237 <literal>LOG
</literal>.
10240 If set to
<literal>DISABLED
</literal>, does not report validation
10241 problems at all. Otherwise reports problems at the given message
10242 level. The default is
<literal>WARNING
</literal>.
10247 <varlistentry id=
"guc-default-text-search-config" xreflabel=
"default_text_search_config">
10248 <term><varname>default_text_search_config
</varname> (
<type>string
</type>)
10250 <primary><varname>default_text_search_config
</varname> configuration parameter
</primary>
10255 Selects the text search configuration that is used by those variants
10256 of the text search functions that do not have an explicit argument
10257 specifying the configuration.
10258 See
<xref linkend=
"textsearch"/> for further information.
10259 The built-in default is
<literal>pg_catalog.simple
</literal>, but
10260 <application>initdb
</application> will initialize the
10261 configuration file with a setting that corresponds to the
10262 chosen
<varname>lc_ctype
</varname> locale, if a configuration
10263 matching that locale can be identified.
10272 <sect2 id=
"runtime-config-client-preload">
10273 <title>Shared Library Preloading
</title>
10276 Several settings are available for preloading shared libraries into the
10277 server, in order to load additional functionality or achieve performance
10278 benefits. For example, a setting of
10279 <literal>'$libdir/mylib'
</literal> would cause
10280 <literal>mylib.so
</literal> (or on some platforms,
10281 <literal>mylib.sl
</literal>) to be preloaded from the installation's standard
10282 library directory. The differences between the settings are when they
10283 take effect and what privileges are required to change them.
10287 <productname>PostgreSQL
</productname> procedural language libraries can
10288 be preloaded in this way, typically by using the
10289 syntax
<literal>'$libdir/plXXX'
</literal> where
10290 <literal>XXX
</literal> is
<literal>pgsql
</literal>,
<literal>perl
</literal>,
10291 <literal>tcl
</literal>, or
<literal>python
</literal>.
10295 Only shared libraries specifically intended to be used with PostgreSQL
10296 can be loaded this way. Every PostgreSQL-supported library has
10297 a
<quote>magic block
</quote> that is checked to guarantee compatibility. For
10298 this reason, non-PostgreSQL libraries cannot be loaded in this way. You
10299 might be able to use operating-system facilities such
10300 as
<envar>LD_PRELOAD
</envar> for that.
10304 In general, refer to the documentation of a specific module for the
10305 recommended way to load that module.
10309 <varlistentry id=
"guc-local-preload-libraries" xreflabel=
"local_preload_libraries">
10310 <term><varname>local_preload_libraries
</varname> (
<type>string
</type>)
10312 <primary><varname>local_preload_libraries
</varname> configuration parameter
</primary>
10315 <primary><filename>$libdir/plugins
</filename></primary>
10320 This variable specifies one or more shared libraries that are to be
10321 preloaded at connection start.
10322 It contains a comma-separated list of library names, where each name
10323 is interpreted as for the
<link linkend=
"sql-load"><command>LOAD
</command></link> command.
10324 Whitespace between entries is ignored; surround a library name with
10325 double quotes if you need to include whitespace or commas in the name.
10326 The parameter value only takes effect at the start of the connection.
10327 Subsequent changes have no effect. If a specified library is not
10328 found, the connection attempt will fail.
10332 This option can be set by any user. Because of that, the libraries
10333 that can be loaded are restricted to those appearing in the
10334 <filename>plugins
</filename> subdirectory of the installation's
10335 standard library directory. (It is the database administrator's
10336 responsibility to ensure that only
<quote>safe
</quote> libraries
10337 are installed there.) Entries in
<varname>local_preload_libraries
</varname>
10338 can specify this directory explicitly, for example
10339 <literal>$libdir/plugins/mylib
</literal>, or just specify
10340 the library name
— <literal>mylib
</literal> would have
10341 the same effect as
<literal>$libdir/plugins/mylib
</literal>.
10345 The intent of this feature is to allow unprivileged users to load
10346 debugging or performance-measurement libraries into specific sessions
10347 without requiring an explicit
<command>LOAD
</command> command. To that end,
10348 it would be typical to set this parameter using
10349 the
<envar>PGOPTIONS
</envar> environment variable on the client or by
10351 <command>ALTER ROLE SET
</command>.
10355 However, unless a module is specifically designed to be used in this way by
10356 non-superusers, this is usually not the right setting to use. Look
10357 at
<xref linkend=
"guc-session-preload-libraries"/> instead.
10363 <varlistentry id=
"guc-session-preload-libraries" xreflabel=
"session_preload_libraries">
10364 <term><varname>session_preload_libraries
</varname> (
<type>string
</type>)
10366 <primary><varname>session_preload_libraries
</varname> configuration parameter
</primary>
10371 This variable specifies one or more shared libraries that are to be
10372 preloaded at connection start.
10373 It contains a comma-separated list of library names, where each name
10374 is interpreted as for the
<link linkend=
"sql-load"><command>LOAD
</command></link> command.
10375 Whitespace between entries is ignored; surround a library name with
10376 double quotes if you need to include whitespace or commas in the name.
10377 The parameter value only takes effect at the start of the connection.
10378 Subsequent changes have no effect. If a specified library is not
10379 found, the connection attempt will fail.
10380 Only superusers and users with the appropriate
<literal>SET
</literal>
10381 privilege can change this setting.
10385 The intent of this feature is to allow debugging or
10386 performance-measurement libraries to be loaded into specific sessions
10387 without an explicit
10388 <command>LOAD
</command> command being given. For
10389 example,
<xref linkend=
"auto-explain"/> could be enabled for all
10390 sessions under a given user name by setting this parameter
10391 with
<command>ALTER ROLE SET
</command>. Also, this parameter can be changed
10392 without restarting the server (but changes only take effect when a new
10393 session is started), so it is easier to add new modules this way, even
10394 if they should apply to all sessions.
10398 Unlike
<xref linkend=
"guc-shared-preload-libraries"/>, there is no large
10399 performance advantage to loading a library at session start rather than
10400 when it is first used. There is some advantage, however, when
10401 connection pooling is used.
10406 <varlistentry id=
"guc-shared-preload-libraries" xreflabel=
"shared_preload_libraries">
10407 <term><varname>shared_preload_libraries
</varname> (
<type>string
</type>)
10409 <primary><varname>shared_preload_libraries
</varname> configuration parameter
</primary>
10414 This variable specifies one or more shared libraries to be preloaded at
10416 It contains a comma-separated list of library names, where each name
10417 is interpreted as for the
<link linkend=
"sql-load"><command>LOAD
</command></link> command.
10418 Whitespace between entries is ignored; surround a library name with
10419 double quotes if you need to include whitespace or commas in the name.
10420 This parameter can only be set at server start. If a specified
10421 library is not found, the server will fail to start.
10425 Some libraries need to perform certain operations that can only take
10426 place at postmaster start, such as allocating shared memory, reserving
10427 light-weight locks, or starting background workers. Those libraries
10428 must be loaded at server start through this parameter. See the
10429 documentation of each library for details.
10433 Other libraries can also be preloaded. By preloading a shared library,
10434 the library startup time is avoided when the library is first used.
10435 However, the time to start each new server process might increase
10436 slightly, even if that process never uses the library. So this
10437 parameter is recommended only for libraries that will be used in most
10438 sessions. Also, changing this parameter requires a server restart, so
10439 this is not the right setting to use for short-term debugging tasks,
10440 say. Use
<xref linkend=
"guc-session-preload-libraries"/> for that
10446 On Windows hosts, preloading a library at server start will not reduce
10447 the time required to start each new server process; each server process
10448 will re-load all preload libraries. However,
<varname>shared_preload_libraries
10449 </varname> is still useful on Windows hosts for libraries that need to
10450 perform operations at postmaster start time.
10456 <varlistentry id=
"guc-jit-provider" xreflabel=
"jit_provider">
10457 <term><varname>jit_provider
</varname> (
<type>string
</type>)
10459 <primary><varname>jit_provider
</varname> configuration parameter
</primary>
10464 This variable is the name of the JIT provider library to be used
10465 (see
<xref linkend=
"jit-pluggable"/>).
10466 The default is
<literal>llvmjit
</literal>.
10467 This parameter can only be set at server start.
10471 If set to a non-existent library,
<acronym>JIT
</acronym> will not be
10472 available, but no error will be raised. This allows JIT support to be
10473 installed separately from the main
10474 <productname>PostgreSQL
</productname> package.
10482 <sect2 id=
"runtime-config-client-other">
10483 <title>Other Defaults
</title>
10487 <varlistentry id=
"guc-dynamic-library-path" xreflabel=
"dynamic_library_path">
10488 <term><varname>dynamic_library_path
</varname> (
<type>string
</type>)
10490 <primary><varname>dynamic_library_path
</varname> configuration parameter
</primary>
10492 <indexterm><primary>dynamic loading
</primary></indexterm>
10496 If a dynamically loadable module needs to be opened and the
10497 file name specified in the
<command>CREATE FUNCTION
</command> or
10498 <command>LOAD
</command> command
10499 does not have a directory component (i.e., the
10500 name does not contain a slash), the system will search this
10501 path for the required file.
10505 The value for
<varname>dynamic_library_path
</varname> must be a
10506 list of absolute directory paths separated by colons (or semi-colons
10507 on Windows). If a list element starts
10508 with the special string
<literal>$libdir
</literal>, the
10509 compiled-in
<productname>PostgreSQL
</productname> package
10510 library directory is substituted for
<literal>$libdir
</literal>; this
10511 is where the modules provided by the standard
10512 <productname>PostgreSQL
</productname> distribution are installed.
10513 (Use
<literal>pg_config --pkglibdir
</literal> to find out the name of
10514 this directory.) For example:
10516 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
10518 or, in a Windows environment:
10520 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
10525 The default value for this parameter is
10526 <literal>'$libdir'
</literal>. If the value is set to an empty
10527 string, the automatic path search is turned off.
10531 This parameter can be changed at run time by superusers and users
10532 with the appropriate
<literal>SET
</literal> privilege, but a
10533 setting done that way will only persist until the end of the
10534 client connection, so this method should be reserved for
10535 development purposes. The recommended way to set this parameter
10536 is in the
<filename>postgresql.conf
</filename> configuration
10542 <varlistentry id=
"guc-gin-fuzzy-search-limit" xreflabel=
"gin_fuzzy_search_limit">
10543 <term><varname>gin_fuzzy_search_limit
</varname> (
<type>integer
</type>)
10545 <primary><varname>gin_fuzzy_search_limit
</varname> configuration parameter
</primary>
10550 Soft upper limit of the size of the set returned by GIN index scans. For more
10551 information see
<xref linkend=
"gin-tips"/>.
10560 <sect1 id=
"runtime-config-locks">
10561 <title>Lock Management
</title>
10565 <varlistentry id=
"guc-deadlock-timeout" xreflabel=
"deadlock_timeout">
10566 <term><varname>deadlock_timeout
</varname> (
<type>integer
</type>)
10568 <primary>deadlock
</primary>
10569 <secondary>timeout during
</secondary>
10572 <primary>timeout
</primary>
10573 <secondary>deadlock
</secondary>
10576 <primary><varname>deadlock_timeout
</varname> configuration parameter
</primary>
10581 This is the amount of time to wait on a lock
10582 before checking to see if there is a deadlock condition. The
10583 check for deadlock is relatively expensive, so the server doesn't run
10584 it every time it waits for a lock. We optimistically assume
10585 that deadlocks are not common in production applications and
10586 just wait on the lock for a while before checking for a
10587 deadlock. Increasing this value reduces the amount of time
10588 wasted in needless deadlock checks, but slows down reporting of
10589 real deadlock errors.
10590 If this value is specified without units, it is taken as milliseconds.
10591 The default is one second (
<literal>1s
</literal>),
10592 which is probably about the smallest value you would want in
10593 practice. On a heavily loaded server you might want to raise it.
10594 Ideally the setting should exceed your typical transaction time,
10595 so as to improve the odds that a lock will be released before
10596 the waiter decides to check for deadlock.
10597 Only superusers and users with the appropriate
<literal>SET
</literal>
10598 privilege can change this setting.
10602 When
<xref linkend=
"guc-log-lock-waits"/> is set,
10603 this parameter also determines the amount of time to wait before
10604 a log message is issued about the lock wait. If you are trying
10605 to investigate locking delays you might want to set a shorter than
10606 normal
<varname>deadlock_timeout
</varname>.
10611 <varlistentry id=
"guc-max-locks-per-transaction" xreflabel=
"max_locks_per_transaction">
10612 <term><varname>max_locks_per_transaction
</varname> (
<type>integer
</type>)
10614 <primary><varname>max_locks_per_transaction
</varname> configuration parameter
</primary>
10619 The shared lock table has space for
10620 <varname>max_locks_per_transaction
</varname> objects
10621 (e.g., tables) per server process or prepared transaction;
10622 hence, no more than this many distinct objects can be locked at
10623 any one time. This parameter limits the average number of object
10624 locks used by each transaction; individual transactions
10625 can lock more objects as long as the locks of all transactions
10626 fit in the lock table. This is
<emphasis>not
</emphasis> the number of
10627 rows that can be locked; that value is unlimited. The default,
10628 64, has historically proven sufficient, but you might need to
10629 raise this value if you have queries that touch many different
10630 tables in a single transaction, e.g., query of a parent table with
10631 many children. This parameter can only be set at server start.
10635 When running a standby server, you must set this parameter to have the
10636 same or higher value as on the primary server. Otherwise, queries
10637 will not be allowed in the standby server.
10642 <varlistentry id=
"guc-max-pred-locks-per-transaction" xreflabel=
"max_pred_locks_per_transaction">
10643 <term><varname>max_pred_locks_per_transaction
</varname> (
<type>integer
</type>)
10645 <primary><varname>max_pred_locks_per_transaction
</varname> configuration parameter
</primary>
10650 The shared predicate lock table has space for
10651 <varname>max_pred_locks_per_transaction
</varname> objects
10652 (e.g., tables) per server process or prepared transaction;
10653 hence, no more than this many distinct objects can be locked at
10654 any one time. This parameter limits the average number of object
10655 locks used by each transaction; individual transactions
10656 can lock more objects as long as the locks of all transactions
10657 fit in the lock table. This is
<emphasis>not
</emphasis> the number of
10658 rows that can be locked; that value is unlimited. The default,
10659 64, has historically proven sufficient, but you might need to
10660 raise this value if you have clients that touch many different
10661 tables in a single serializable transaction. This parameter can
10662 only be set at server start.
10667 <varlistentry id=
"guc-max-pred-locks-per-relation" xreflabel=
"max_pred_locks_per_relation">
10668 <term><varname>max_pred_locks_per_relation
</varname> (
<type>integer
</type>)
10670 <primary><varname>max_pred_locks_per_relation
</varname> configuration parameter
</primary>
10675 This controls how many pages or tuples of a single relation can be
10676 predicate-locked before the lock is promoted to covering the whole
10677 relation. Values greater than or equal to zero mean an absolute
10678 limit, while negative values
10679 mean
<xref linkend=
"guc-max-pred-locks-per-transaction"/> divided by
10680 the absolute value of this setting. The default is -
2, which keeps
10681 the behavior from previous versions of
<productname>PostgreSQL
</productname>.
10682 This parameter can only be set in the
<filename>postgresql.conf
</filename>
10683 file or on the server command line.
10688 <varlistentry id=
"guc-max-pred-locks-per-page" xreflabel=
"max_pred_locks_per_page">
10689 <term><varname>max_pred_locks_per_page
</varname> (
<type>integer
</type>)
10691 <primary><varname>max_pred_locks_per_page
</varname> configuration parameter
</primary>
10696 This controls how many rows on a single page can be predicate-locked
10697 before the lock is promoted to covering the whole page. The default
10698 is
2. This parameter can only be set in
10699 the
<filename>postgresql.conf
</filename> file or on the server command line.
10707 <sect1 id=
"runtime-config-compatible">
10708 <title>Version and Platform Compatibility
</title>
10710 <sect2 id=
"runtime-config-compatible-version">
10711 <title>Previous PostgreSQL Versions
</title>
10715 <varlistentry id=
"guc-array-nulls" xreflabel=
"array_nulls">
10716 <term><varname>array_nulls
</varname> (
<type>boolean
</type>)
10718 <primary><varname>array_nulls
</varname> configuration parameter
</primary>
10723 This controls whether the array input parser recognizes
10724 unquoted
<literal>NULL
</literal> as specifying a null array element.
10725 By default, this is
<literal>on
</literal>, allowing array values containing
10726 null values to be entered. However,
<productname>PostgreSQL
</productname> versions
10727 before
8.2 did not support null values in arrays, and therefore would
10728 treat
<literal>NULL
</literal> as specifying a normal array element with
10729 the string value
<quote>NULL
</quote>. For backward compatibility with
10730 applications that require the old behavior, this variable can be
10731 turned
<literal>off
</literal>.
10735 Note that it is possible to create array values containing null values
10736 even when this variable is
<literal>off
</literal>.
10741 <varlistentry id=
"guc-backslash-quote" xreflabel=
"backslash_quote">
10742 <term><varname>backslash_quote
</varname> (
<type>enum
</type>)
10743 <indexterm><primary>strings
</primary><secondary>backslash quotes
</secondary></indexterm>
10745 <primary><varname>backslash_quote
</varname> configuration parameter
</primary>
10750 This controls whether a quote mark can be represented by
10751 <literal>\'
</literal> in a string literal. The preferred, SQL-standard way
10752 to represent a quote mark is by doubling it (
<literal>''
</literal>) but
10753 <productname>PostgreSQL
</productname> has historically also accepted
10754 <literal>\'
</literal>. However, use of
<literal>\'
</literal> creates security risks
10755 because in some client character set encodings, there are multibyte
10756 characters in which the last byte is numerically equivalent to ASCII
10757 <literal>\
</literal>. If client-side code does escaping incorrectly then an
10758 SQL-injection attack is possible. This risk can be prevented by
10759 making the server reject queries in which a quote mark appears to be
10760 escaped by a backslash.
10761 The allowed values of
<varname>backslash_quote
</varname> are
10762 <literal>on
</literal> (allow
<literal>\'
</literal> always),
10763 <literal>off
</literal> (reject always), and
10764 <literal>safe_encoding
</literal> (allow only if client encoding does not
10765 allow ASCII
<literal>\
</literal> within a multibyte character).
10766 <literal>safe_encoding
</literal> is the default setting.
10770 Note that in a standard-conforming string literal,
<literal>\
</literal> just
10771 means
<literal>\
</literal> anyway. This parameter only affects the handling of
10772 non-standard-conforming literals, including
10773 escape string syntax (
<literal>E'...'
</literal>).
10778 <varlistentry id=
"guc-escape-string-warning" xreflabel=
"escape_string_warning">
10779 <term><varname>escape_string_warning
</varname> (
<type>boolean
</type>)
10780 <indexterm><primary>strings
</primary><secondary>escape warning
</secondary></indexterm>
10782 <primary><varname>escape_string_warning
</varname> configuration parameter
</primary>
10787 When on, a warning is issued if a backslash (
<literal>\
</literal>)
10788 appears in an ordinary string literal (
<literal>'...'
</literal>
10789 syntax) and
<varname>standard_conforming_strings
</varname> is off.
10790 The default is
<literal>on
</literal>.
10793 Applications that wish to use backslash as escape should be
10794 modified to use escape string syntax (
<literal>E'...'
</literal>),
10795 because the default behavior of ordinary strings is now to treat
10796 backslash as an ordinary character, per SQL standard. This variable
10797 can be enabled to help locate code that needs to be changed.
10802 <varlistentry id=
"guc-lo-compat-privileges" xreflabel=
"lo_compat_privileges">
10803 <term><varname>lo_compat_privileges
</varname> (
<type>boolean
</type>)
10805 <primary><varname>lo_compat_privileges
</varname> configuration parameter
</primary>
10810 In
<productname>PostgreSQL
</productname> releases prior to
9.0, large objects
10811 did not have access privileges and were, therefore, always readable
10812 and writable by all users. Setting this variable to
<literal>on
</literal>
10813 disables the new privilege checks, for compatibility with prior
10814 releases. The default is
<literal>off
</literal>.
10815 Only superusers and users with the appropriate
<literal>SET
</literal>
10816 privilege can change this setting.
10819 Setting this variable does not disable all security checks related to
10820 large objects
— only those for which the default behavior has
10821 changed in
<productname>PostgreSQL
</productname> 9.0.
10826 <varlistentry id=
"guc-quote-all-identifiers" xreflabel=
"quote-all-identifiers">
10827 <term><varname>quote_all_identifiers
</varname> (
<type>boolean
</type>)
10829 <primary><varname>quote_all_identifiers
</varname> configuration parameter
</primary>
10834 When the database generates SQL, force all identifiers to be quoted,
10835 even if they are not (currently) keywords. This will affect the
10836 output of
<command>EXPLAIN
</command> as well as the results of functions
10837 like
<function>pg_get_viewdef
</function>. See also the
10838 <option>--quote-all-identifiers
</option> option of
10839 <xref linkend=
"app-pgdump"/> and
<xref linkend=
"app-pg-dumpall"/>.
10844 <varlistentry id=
"guc-standard-conforming-strings" xreflabel=
"standard_conforming_strings">
10845 <term><varname>standard_conforming_strings
</varname> (
<type>boolean
</type>)
10846 <indexterm><primary>strings
</primary><secondary>standard conforming
</secondary></indexterm>
10848 <primary><varname>standard_conforming_strings
</varname> configuration parameter
</primary>
10853 This controls whether ordinary string literals
10854 (
<literal>'...'
</literal>) treat backslashes literally, as specified in
10856 Beginning in
<productname>PostgreSQL
</productname> 9.1, the default is
10857 <literal>on
</literal> (prior releases defaulted to
<literal>off
</literal>).
10858 Applications can check this
10859 parameter to determine how string literals will be processed.
10860 The presence of this parameter can also be taken as an indication
10861 that the escape string syntax (
<literal>E'...'
</literal>) is supported.
10862 Escape string syntax (
<xref linkend=
"sql-syntax-strings-escape"/>)
10863 should be used if an application desires
10864 backslashes to be treated as escape characters.
10869 <varlistentry id=
"guc-synchronize-seqscans" xreflabel=
"synchronize_seqscans">
10870 <term><varname>synchronize_seqscans
</varname> (
<type>boolean
</type>)
10872 <primary><varname>synchronize_seqscans
</varname> configuration parameter
</primary>
10877 This allows sequential scans of large tables to synchronize with each
10878 other, so that concurrent scans read the same block at about the
10879 same time and hence share the I/O workload. When this is enabled,
10880 a scan might start in the middle of the table and then
<quote>wrap
10881 around
</quote> the end to cover all rows, so as to synchronize with the
10882 activity of scans already in progress. This can result in
10883 unpredictable changes in the row ordering returned by queries that
10884 have no
<literal>ORDER BY
</literal> clause. Setting this parameter to
10885 <literal>off
</literal> ensures the pre-
8.3 behavior in which a sequential
10886 scan always starts from the beginning of the table. The default
10887 is
<literal>on
</literal>.
10895 <sect2 id=
"runtime-config-compatible-clients">
10896 <title>Platform and Client Compatibility
</title>
10899 <varlistentry id=
"guc-transform-null-equals" xreflabel=
"transform_null_equals">
10900 <term><varname>transform_null_equals
</varname> (
<type>boolean
</type>)
10901 <indexterm><primary>IS NULL
</primary></indexterm>
10903 <primary><varname>transform_null_equals
</varname> configuration parameter
</primary>
10908 When on, expressions of the form
<literal><replaceable>expr
</replaceable> =
10909 NULL
</literal> (or
<literal>NULL =
10910 <replaceable>expr
</replaceable></literal>) are treated as
10911 <literal><replaceable>expr
</replaceable> IS NULL
</literal>, that is, they
10912 return true if
<replaceable>expr
</replaceable> evaluates to the null value,
10913 and false otherwise. The correct SQL-spec-compliant behavior of
10914 <literal><replaceable>expr
</replaceable> = NULL
</literal> is to always
10915 return null (unknown). Therefore this parameter defaults to
10916 <literal>off
</literal>.
10920 However, filtered forms in
<productname>Microsoft
10921 Access
</productname> generate queries that appear to use
10922 <literal><replaceable>expr
</replaceable> = NULL
</literal> to test for
10923 null values, so if you use that interface to access the database you
10924 might want to turn this option on. Since expressions of the
10925 form
<literal><replaceable>expr
</replaceable> = NULL
</literal> always
10926 return the null value (using the SQL standard interpretation), they are not
10927 very useful and do not appear often in normal applications so
10928 this option does little harm in practice. But new users are
10929 frequently confused about the semantics of expressions
10930 involving null values, so this option is off by default.
10934 Note that this option only affects the exact form
<literal>= NULL
</literal>,
10935 not other comparison operators or other expressions
10936 that are computationally equivalent to some expression
10937 involving the equals operator (such as
<literal>IN
</literal>).
10938 Thus, this option is not a general fix for bad programming.
10942 Refer to
<xref linkend=
"functions-comparison"/> for related information.
10947 <varlistentry id=
"guc-allow-alter-system" xreflabel=
"allow_alter_system">
10948 <term><varname>allow_alter_system
</varname> (
<type>boolean
</type>)
10950 <primary><varname>allow_alter_system
</varname> configuration parameter
</primary>
10955 When
<literal>allow_alter_system
</literal> is set to
10956 <literal>off
</literal>, an error is returned if the
<command>ALTER
10957 SYSTEM
</command> command is executed. This parameter can only be set in
10958 the
<filename>postgresql.conf
</filename> file or on the server command
10959 line. The default value is
<literal>on
</literal>.
10963 Note that this setting must not be regarded as a security feature. It
10964 only disables the
<literal>ALTER SYSTEM
</literal> command. It does not
10965 prevent a superuser from changing the configuration using other SQL
10966 commands. A superuser has many ways of executing shell commands at
10967 the operating system level, and can therefore modify
10968 <literal>postgresql.auto.conf
</literal> regardless of the value of
10973 Turning this setting off is intended for environments where the
10974 configuration of
<productname>PostgreSQL
</productname> is managed by
10975 some external tool.
10976 In such environments, a well-intentioned superuser might
10977 <emphasis>mistakenly
</emphasis> use
<command>ALTER SYSTEM
</command>
10978 to change the configuration instead of using the external tool.
10979 This might result in unintended behavior, such as the external tool
10980 overwriting the change at some later point in time when it updates the
10982 Setting this parameter to
<literal>off
</literal> can
10983 help avoid such mistakes.
10987 This parameter only controls the use of
<command>ALTER SYSTEM
</command>.
10988 The settings stored in
<filename>postgresql.auto.conf
</filename>
10989 take effect even if
<literal>allow_alter_system
</literal> is set to
10990 <literal>off
</literal>.
10999 <sect1 id=
"runtime-config-error-handling">
11000 <title>Error Handling
</title>
11004 <varlistentry id=
"guc-exit-on-error" xreflabel=
"exit_on_error">
11005 <term><varname>exit_on_error
</varname> (
<type>boolean
</type>)
11007 <primary><varname>exit_on_error
</varname> configuration parameter
</primary>
11012 If on, any error will terminate the current session. By default,
11013 this is set to off, so that only FATAL errors will terminate the
11019 <varlistentry id=
"guc-restart-after-crash" xreflabel=
"restart_after_crash">
11020 <term><varname>restart_after_crash
</varname> (
<type>boolean
</type>)
11022 <primary><varname>restart_after_crash
</varname> configuration parameter
</primary>
11027 When set to on, which is the default,
<productname>PostgreSQL
</productname>
11028 will automatically reinitialize after a backend crash. Leaving this
11029 value set to on is normally the best way to maximize the availability
11030 of the database. However, in some circumstances, such as when
11031 <productname>PostgreSQL
</productname> is being invoked by clusterware, it may be
11032 useful to disable the restart so that the clusterware can gain
11033 control and take any actions it deems appropriate.
11037 This parameter can only be set in the
<filename>postgresql.conf
</filename>
11038 file or on the server command line.
11043 <varlistentry id=
"guc-data-sync-retry" xreflabel=
"data_sync_retry">
11044 <term><varname>data_sync_retry
</varname> (
<type>boolean
</type>)
11046 <primary><varname>data_sync_retry
</varname> configuration parameter
</primary>
11051 When set to off, which is the default,
<productname>PostgreSQL
</productname>
11052 will raise a PANIC-level error on failure to flush modified data files
11053 to the file system. This causes the database server to crash. This
11054 parameter can only be set at server start.
11057 On some operating systems, the status of data in the kernel's page
11058 cache is unknown after a write-back failure. In some cases it might
11059 have been entirely forgotten, making it unsafe to retry; the second
11060 attempt may be reported as successful, when in fact the data has been
11061 lost. In these circumstances, the only way to avoid data loss is to
11062 recover from the WAL after any failure is reported, preferably
11063 after investigating the root cause of the failure and replacing any
11067 If set to on,
<productname>PostgreSQL
</productname> will instead
11068 report an error but continue to run so that the data flushing
11069 operation can be retried in a later checkpoint. Only set it to on
11070 after investigating the operating system's treatment of buffered data
11071 in case of write-back failure.
11076 <varlistentry id=
"guc-recovery-init-sync-method" xreflabel=
"recovery_init_sync_method">
11077 <term><varname>recovery_init_sync_method
</varname> (
<type>enum
</type>)
11079 <primary><varname>recovery_init_sync_method
</varname> configuration parameter
</primary>
11084 When set to
<literal>fsync
</literal>, which is the default,
11085 <productname>PostgreSQL
</productname> will recursively open and
11086 synchronize all files in the data directory before crash recovery
11087 begins. The search for files will follow symbolic links for the WAL
11088 directory and each configured tablespace (but not any other symbolic
11089 links). This is intended to make sure that all WAL and data files are
11090 durably stored on disk before replaying changes. This applies whenever
11091 starting a database cluster that did not shut down cleanly, including
11092 copies created with
<application>pg_basebackup
</application>.
11095 On Linux,
<literal>syncfs
</literal> may be used instead, to ask the
11096 operating system to synchronize the file systems that contain the
11097 data directory, the WAL files and each tablespace (but not any other
11098 file systems that may be reachable through symbolic links). This may
11099 be a lot faster than the
<literal>fsync
</literal> setting, because it
11100 doesn't need to open each file one by one. On the other hand, it may
11101 be slower if a file system is shared by other applications that
11102 modify a lot of files, since those files will also be written to disk.
11103 Furthermore, on versions of Linux before
5.8, I/O errors encountered
11104 while writing data to disk may not be reported to
11105 <productname>PostgreSQL
</productname>, and relevant error messages may
11106 appear only in kernel logs.
11109 This parameter can only be set in the
11110 <filename>postgresql.conf
</filename> file or on the server command line.
11119 <sect1 id=
"runtime-config-preset">
11120 <title>Preset Options
</title>
11123 The following
<quote>parameters
</quote> are read-only.
11124 As such, they have been excluded from the sample
11125 <filename>postgresql.conf
</filename> file. These options report
11126 various aspects of
<productname>PostgreSQL
</productname> behavior
11127 that might be of interest to certain applications, particularly
11128 administrative front-ends.
11129 Most of them are determined when
<productname>PostgreSQL
</productname>
11130 is compiled or when it is installed.
11135 <varlistentry id=
"guc-block-size" xreflabel=
"block_size">
11136 <term><varname>block_size
</varname> (
<type>integer
</type>)
11138 <primary><varname>block_size
</varname> configuration parameter
</primary>
11143 Reports the size of a disk block. It is determined by the value
11144 of
<literal>BLCKSZ
</literal> when building the server. The default
11145 value is
8192 bytes. The meaning of some configuration
11146 variables (such as
<xref linkend=
"guc-shared-buffers"/>) is
11147 influenced by
<varname>block_size
</varname>. See
<xref
11148 linkend=
"runtime-config-resource"/> for information.
11153 <varlistentry id=
"guc-data-checksums" xreflabel=
"data_checksums">
11154 <term><varname>data_checksums
</varname> (
<type>boolean
</type>)
11156 <primary><varname>data_checksums
</varname> configuration parameter
</primary>
11161 Reports whether data checksums are enabled for this cluster.
11162 See
<xref linkend=
"app-initdb-data-checksums"/> for more information.
11167 <varlistentry id=
"guc-data-directory-mode" xreflabel=
"data_directory_mode">
11168 <term><varname>data_directory_mode
</varname> (
<type>integer
</type>)
11170 <primary><varname>data_directory_mode
</varname> configuration parameter
</primary>
11175 On Unix systems this parameter reports the permissions the data
11176 directory (defined by
<xref linkend=
"guc-data-directory"/>)
11177 had at server startup.
11178 (On Microsoft Windows this parameter will always display
11179 <literal>0700</literal>.) See
11180 <link linkend=
"app-initdb-allow-group-access">the
11181 <application>initdb
</application> <option>-g
</option> option
</link>
11182 for more information.
11187 <varlistentry id=
"guc-debug-assertions" xreflabel=
"debug_assertions">
11188 <term><varname>debug_assertions
</varname> (
<type>boolean
</type>)
11190 <primary><varname>debug_assertions
</varname> configuration parameter
</primary>
11195 Reports whether
<productname>PostgreSQL
</productname> has been built
11196 with assertions enabled. That is the case if the
11197 macro
<symbol>USE_ASSERT_CHECKING
</symbol> is defined
11198 when
<productname>PostgreSQL
</productname> is built (accomplished
11199 e.g., by the
<command>configure
</command> option
11200 <option>--enable-cassert
</option>). By
11201 default
<productname>PostgreSQL
</productname> is built without
11207 <varlistentry id=
"guc-huge-pages-status" xreflabel=
"huge_pages_status">
11208 <term><varname>huge_pages_status
</varname> (
<type>enum
</type>)
11210 <primary><varname>huge_pages_status
</varname> configuration parameter
</primary>
11215 Reports the state of huge pages in the current instance:
11216 <literal>on
</literal>,
<literal>off
</literal>, or
11217 <literal>unknown
</literal> (if displayed with
11218 <literal>postgres -C
</literal>).
11219 This parameter is useful to determine whether allocation of huge pages
11220 was successful under
<literal>huge_pages=try
</literal>.
11221 See
<xref linkend=
"guc-huge-pages"/> for more information.
11226 <varlistentry id=
"guc-integer-datetimes" xreflabel=
"integer_datetimes">
11227 <term><varname>integer_datetimes
</varname> (
<type>boolean
</type>)
11229 <primary><varname>integer_datetimes
</varname> configuration parameter
</primary>
11234 Reports whether
<productname>PostgreSQL
</productname> was built with support for
11235 64-bit-integer dates and times. As of
<productname>PostgreSQL
</productname> 10,
11236 this is always
<literal>on
</literal>.
11241 <varlistentry id=
"guc-in-hot-standby" xreflabel=
"in_hot_standby">
11242 <term><varname>in_hot_standby
</varname> (
<type>boolean
</type>)
11244 <primary><varname>in_hot_standby
</varname> configuration parameter
</primary>
11249 Reports whether the server is currently in hot standby mode. When
11250 this is
<literal>on
</literal>, all transactions are forced to be
11251 read-only. Within a session, this can change only if the server is
11252 promoted to be primary. See
<xref linkend=
"hot-standby"/> for more
11258 <varlistentry id=
"guc-max-function-args" xreflabel=
"max_function_args">
11259 <term><varname>max_function_args
</varname> (
<type>integer
</type>)
11261 <primary><varname>max_function_args
</varname> configuration parameter
</primary>
11266 Reports the maximum number of function arguments. It is determined by
11267 the value of
<literal>FUNC_MAX_ARGS
</literal> when building the server. The
11268 default value is
100 arguments.
11273 <varlistentry id=
"guc-max-identifier-length" xreflabel=
"max_identifier_length">
11274 <term><varname>max_identifier_length
</varname> (
<type>integer
</type>)
11276 <primary><varname>max_identifier_length
</varname> configuration parameter
</primary>
11281 Reports the maximum identifier length. It is determined as one
11282 less than the value of
<literal>NAMEDATALEN
</literal> when building
11283 the server. The default value of
<literal>NAMEDATALEN
</literal> is
11284 64; therefore the default
11285 <varname>max_identifier_length
</varname> is
63 bytes, which
11286 can be less than
63 characters when using multibyte encodings.
11291 <varlistentry id=
"guc-max-index-keys" xreflabel=
"max_index_keys">
11292 <term><varname>max_index_keys
</varname> (
<type>integer
</type>)
11294 <primary><varname>max_index_keys
</varname> configuration parameter
</primary>
11299 Reports the maximum number of index keys. It is determined by
11300 the value of
<literal>INDEX_MAX_KEYS
</literal> when building the server. The
11301 default value is
32 keys.
11306 <varlistentry id=
"guc-num-os-semaphores" xreflabel=
"num_os_semaphores">
11307 <term><varname>num_os_semaphores
</varname> (
<type>integer
</type>)
11309 <primary><varname>num_os_semaphores
</varname> configuration parameter
</primary>
11314 Reports the number of semaphores that are needed for the server based
11315 on the configured number of allowed connections
11316 (
<xref linkend=
"guc-max-connections"/>), allowed autovacuum worker
11317 processes (
<xref linkend=
"guc-autovacuum-max-workers"/>), allowed WAL
11318 sender processes (
<xref linkend=
"guc-max-wal-senders"/>), allowed
11319 background processes (
<xref linkend=
"guc-max-worker-processes"/>), etc.
11324 <varlistentry id=
"guc-segment-size" xreflabel=
"segment_size">
11325 <term><varname>segment_size
</varname> (
<type>integer
</type>)
11327 <primary><varname>segment_size
</varname> configuration parameter
</primary>
11332 Reports the number of blocks (pages) that can be stored within a file
11333 segment. It is determined by the value of
<literal>RELSEG_SIZE
</literal>
11334 when building the server. The maximum size of a segment file in bytes
11335 is equal to
<varname>segment_size
</varname> multiplied by
11336 <varname>block_size
</varname>; by default this is
1GB.
11341 <varlistentry id=
"guc-server-encoding" xreflabel=
"server_encoding">
11342 <term><varname>server_encoding
</varname> (
<type>string
</type>)
11344 <primary><varname>server_encoding
</varname> configuration parameter
</primary>
11346 <indexterm><primary>character set
</primary></indexterm>
11350 Reports the database encoding (character set).
11351 It is determined when the database is created. Ordinarily,
11352 clients need only be concerned with the value of
<xref
11353 linkend=
"guc-client-encoding"/>.
11358 <varlistentry id=
"guc-server-version" xreflabel=
"server_version">
11359 <term><varname>server_version
</varname> (
<type>string
</type>)
11361 <primary><varname>server_version
</varname> configuration parameter
</primary>
11366 Reports the version number of the server. It is determined by the
11367 value of
<literal>PG_VERSION
</literal> when building the server.
11372 <varlistentry id=
"guc-server-version-num" xreflabel=
"server_version_num">
11373 <term><varname>server_version_num
</varname> (
<type>integer
</type>)
11375 <primary><varname>server_version_num
</varname> configuration parameter
</primary>
11380 Reports the version number of the server as an integer. It is determined
11381 by the value of
<literal>PG_VERSION_NUM
</literal> when building the server.
11386 <varlistentry id=
"guc-shared-memory-size" xreflabel=
"shared_memory_size">
11387 <term><varname>shared_memory_size
</varname> (
<type>integer
</type>)
11389 <primary><varname>shared_memory_size
</varname> configuration parameter
</primary>
11394 Reports the size of the main shared memory area, rounded up to the
11400 <varlistentry id=
"guc-shared-memory-size-in-huge-pages" xreflabel=
"shared_memory_size_in_huge_pages">
11401 <term><varname>shared_memory_size_in_huge_pages
</varname> (
<type>integer
</type>)
11403 <primary><varname>shared_memory_size_in_huge_pages
</varname> configuration parameter
</primary>
11408 Reports the number of huge pages that are needed for the main shared
11409 memory area based on the specified
<xref linkend=
"guc-huge-page-size"/>.
11410 If huge pages are not supported, this will be
<literal>-
1</literal>.
11413 This setting is supported only on
<productname>Linux
</productname>. It
11414 is always set to
<literal>-
1</literal> on other platforms. For more
11415 details about using huge pages on
<productname>Linux
</productname>, see
11416 <xref linkend=
"linux-huge-pages"/>.
11421 <varlistentry id=
"guc-ssl-library" xreflabel=
"ssl_library">
11422 <term><varname>ssl_library
</varname> (
<type>string
</type>)
11424 <primary><varname>ssl_library
</varname> configuration parameter
</primary>
11429 Reports the name of the SSL library that this
11430 <productname>PostgreSQL
</productname> server was built with (even if
11431 SSL is not currently configured or in use on this instance), for
11432 example
<literal>OpenSSL
</literal>, or an empty string if none.
11437 <varlistentry id=
"guc-wal-block-size" xreflabel=
"wal_block_size">
11438 <term><varname>wal_block_size
</varname> (
<type>integer
</type>)
11440 <primary><varname>wal_block_size
</varname> configuration parameter
</primary>
11445 Reports the size of a WAL disk block. It is determined by the value
11446 of
<literal>XLOG_BLCKSZ
</literal> when building the server. The default value
11452 <varlistentry id=
"guc-wal-segment-size" xreflabel=
"wal_segment_size">
11453 <term><varname>wal_segment_size
</varname> (
<type>integer
</type>)
11455 <primary><varname>wal_segment_size
</varname> configuration parameter
</primary>
11460 Reports the size of write ahead log segments. The default value is
11461 16MB. See
<xref linkend=
"wal-configuration"/> for more information.
11469 <sect1 id=
"runtime-config-custom">
11470 <title>Customized Options
</title>
11473 This feature was designed to allow parameters not normally known to
11474 <productname>PostgreSQL
</productname> to be added by add-on modules
11475 (such as procedural languages). This allows extension modules to be
11476 configured in the standard ways.
11480 Custom options have two-part names: an extension name, then a dot, then
11481 the parameter name proper, much like qualified names in SQL. An example
11482 is
<literal>plpgsql.variable_conflict
</literal>.
11486 Because custom options may need to be set in processes that have not
11487 loaded the relevant extension module,
<productname>PostgreSQL
</productname>
11488 will accept a setting for any two-part parameter name. Such variables
11489 are treated as placeholders and have no function until the module that
11490 defines them is loaded. When an extension module is loaded, it will add
11491 its variable definitions and convert any placeholder values according to
11492 those definitions. If there are any unrecognized placeholders
11493 that begin with its extension name, warnings are issued and those
11494 placeholders are removed.
11498 <sect1 id=
"runtime-config-developer">
11499 <title>Developer Options
</title>
11502 The following parameters are intended for developer testing, and
11503 should never be used on a production database. However, some of
11504 them can be used to assist with the recovery of severely damaged
11505 databases. As such, they have been excluded from the sample
11506 <filename>postgresql.conf
</filename> file. Note that many of these
11507 parameters require special source compilation flags to work at all.
11511 <varlistentry id=
"guc-allow-in-place-tablespaces" xreflabel=
"allow_in_place_tablespaces">
11512 <term><varname>allow_in_place_tablespaces
</varname> (
<type>boolean
</type>)
11514 <primary><varname>allow_in_place_tablespaces
</varname> configuration parameter
</primary>
11519 Allows tablespaces to be created as directories inside
11520 <filename>pg_tblspc
</filename>, when an empty location string
11521 is provided to the
<command>CREATE TABLESPACE
</command> command. This
11522 is intended to allow testing replication scenarios where primary and
11523 standby servers are running on the same machine. Such directories
11524 are likely to confuse backup tools that expect to find only symbolic
11525 links in that location.
11526 Only superusers and users with the appropriate
<literal>SET
</literal>
11527 privilege can change this setting.
11532 <varlistentry id=
"guc-allow-system-table-mods" xreflabel=
"allow_system_table_mods">
11533 <term><varname>allow_system_table_mods
</varname> (
<type>boolean
</type>)
11535 <primary><varname>allow_system_table_mods
</varname> configuration parameter
</primary>
11540 Allows modification of the structure of system tables as well as
11541 certain other risky actions on system tables. This is otherwise not
11542 allowed even for superusers. Ill-advised use of this setting can
11543 cause irretrievable data loss or seriously corrupt the database
11545 Only superusers and users with the appropriate
<literal>SET
</literal>
11546 privilege can change this setting.
11551 <varlistentry id=
"guc-backtrace-functions" xreflabel=
"backtrace_functions">
11552 <term><varname>backtrace_functions
</varname> (
<type>string
</type>)
11554 <primary><varname>backtrace_functions
</varname> configuration parameter
</primary>
11559 This parameter contains a comma-separated list of C function names.
11560 If an error is raised and the name of the internal C function where
11561 the error happens matches a value in the list, then a backtrace is
11562 written to the server log together with the error message. This can
11563 be used to debug specific areas of the source code.
11567 Backtrace support is not available on all platforms, and the quality
11568 of the backtraces depends on compilation options.
11572 Only superusers and users with the appropriate
<literal>SET
</literal>
11573 privilege can change this setting.
11578 <varlistentry id=
"guc-debug-copy-parse-plan-trees" xreflabel=
"debug_copy_parse_plan_trees">
11579 <term><varname>debug_copy_parse_plan_trees
</varname> (
<type>boolean
</type>)
11581 <primary><varname>debug_copy_parse_plan_trees
</varname> configuration parameter
</primary>
11586 Enabling this forces all parse and plan trees to be passed through
11587 <function>copyObject()
</function>, to facilitate catching errors and
11588 omissions in
<function>copyObject()
</function>. The default is off.
11592 This parameter is only available when
11593 <symbol>DEBUG_NODE_TESTS_ENABLED
</symbol> was defined at compile time
11594 (which happens automatically when using the
11595 <application>configure
</application> option
11596 <option>--enable-cassert
</option>).
11601 <varlistentry id=
"guc-debug-discard-caches" xreflabel=
"debug_discard_caches">
11602 <term><varname>debug_discard_caches
</varname> (
<type>integer
</type>)
11604 <primary><varname>debug_discard_caches
</varname> configuration parameter
</primary>
11609 When set to
<literal>1</literal>, each system catalog cache entry is
11610 invalidated at the first possible opportunity, whether or not
11611 anything that would render it invalid really occurred. Caching of
11612 system catalogs is effectively disabled as a result, so the server
11613 will run extremely slowly. Higher values run the cache invalidation
11614 recursively, which is even slower and only useful for testing
11615 the caching logic itself. The default value of
<literal>0</literal>
11616 selects normal catalog caching behavior.
11620 This parameter can be very helpful when trying to trigger
11621 hard-to-reproduce bugs involving concurrent catalog changes, but it
11622 is otherwise rarely needed. See the source code files
11623 <filename>inval.c
</filename> and
11624 <filename>pg_config_manual.h
</filename> for details.
11628 This parameter is supported when
11629 <symbol>DISCARD_CACHES_ENABLED
</symbol> was defined at compile time
11630 (which happens automatically when using the
11631 <application>configure
</application> option
11632 <option>--enable-cassert
</option>). In production builds, its value
11633 will always be
<literal>0</literal> and attempts to set it to another
11634 value will raise an error.
11639 <varlistentry id=
"guc-debug-io-direct" xreflabel=
"debug_io_direct">
11640 <term><varname>debug_io_direct
</varname> (
<type>string
</type>)
11642 <primary><varname>debug_io_direct
</varname> configuration parameter
</primary>
11647 Ask the kernel to minimize caching effects for relation data and WAL
11648 files using
<literal>O_DIRECT
</literal> (most Unix-like systems),
11649 <literal>F_NOCACHE
</literal> (macOS) or
11650 <literal>FILE_FLAG_NO_BUFFERING
</literal> (Windows).
11653 May be set to an empty string (the default) to disable use of direct
11654 I/O, or a comma-separated list of operations that should use direct I/O.
11655 The valid options are
<literal>data
</literal> for
11656 main data files,
<literal>wal
</literal> for WAL files, and
11657 <literal>wal_init
</literal> for WAL files when being initially
11661 Some operating systems and file systems do not support direct I/O, so
11662 non-default settings may be rejected at startup or cause errors.
11665 Currently this feature reduces performance, and is intended for
11666 developer testing only.
11671 <varlistentry id=
"guc-debug-parallel-query" xreflabel=
"debug_parallel_query">
11672 <term><varname>debug_parallel_query
</varname> (
<type>enum
</type>)
11674 <primary><varname>debug_parallel_query
</varname> configuration parameter
</primary>
11679 Allows the use of parallel queries for testing purposes even in cases
11680 where no performance benefit is expected.
11681 The allowed values of
<varname>debug_parallel_query
</varname> are
11682 <literal>off
</literal> (use parallel mode only when it is expected to improve
11683 performance),
<literal>on
</literal> (force parallel query for all queries
11684 for which it is thought to be safe), and
<literal>regress
</literal> (like
11685 <literal>on
</literal>, but with additional behavior changes as explained
11690 More specifically, setting this value to
<literal>on
</literal> will add
11691 a
<literal>Gather
</literal> node to the top of any query plan for which this
11692 appears to be safe, so that the query runs inside of a parallel worker.
11693 Even when a parallel worker is not available or cannot be used,
11694 operations such as starting a subtransaction that would be prohibited
11695 in a parallel query context will be prohibited unless the planner
11696 believes that this will cause the query to fail. If failures or
11697 unexpected results occur when this option is set, some functions used
11698 by the query may need to be marked
<literal>PARALLEL UNSAFE
</literal>
11699 (or, possibly,
<literal>PARALLEL RESTRICTED
</literal>).
11703 Setting this value to
<literal>regress
</literal> has all of the same effects
11704 as setting it to
<literal>on
</literal> plus some additional effects that are
11705 intended to facilitate automated regression testing. Normally,
11706 messages from a parallel worker include a context line indicating that,
11707 but a setting of
<literal>regress
</literal> suppresses this line so that the
11708 output is the same as in non-parallel execution. Also,
11709 the
<literal>Gather
</literal> nodes added to plans by this setting are hidden
11710 in
<literal>EXPLAIN
</literal> output so that the output matches what
11711 would be obtained if this setting were turned
<literal>off
</literal>.
11716 <varlistentry id=
"guc-debug-raw-expression-coverage-test" xreflabel=
"debug_raw_expression_coverage_test">
11717 <term><varname>debug_raw_expression_coverage_test
</varname> (
<type>boolean
</type>)
11719 <primary><varname>debug_raw_expression_coverage_test
</varname> configuration parameter
</primary>
11724 Enabling this forces all raw parse trees for DML statements to be
11725 scanned by
<function>raw_expression_tree_walker()
</function>, to
11726 facilitate catching errors and omissions in that function. The
11731 This parameter is only available when
11732 <symbol>DEBUG_NODE_TESTS_ENABLED
</symbol> was defined at compile time
11733 (which happens automatically when using the
11734 <application>configure
</application> option
11735 <option>--enable-cassert
</option>).
11740 <varlistentry id=
"guc-debug-write-read-parse-plan-trees" xreflabel=
"debug_write_read_parse_plan_trees">
11741 <term><varname>debug_write_read_parse_plan_trees
</varname> (
<type>boolean
</type>)
11743 <primary><varname>debug_write_read_parse_plan_trees
</varname> configuration parameter
</primary>
11748 Enabling this forces all parse and plan trees to be passed through
11749 <filename>outfuncs.c
</filename>/
<filename>readfuncs.c
</filename>, to
11750 facilitate catching errors and omissions in those modules. The
11755 This parameter is only available when
11756 <symbol>DEBUG_NODE_TESTS_ENABLED
</symbol> was defined at compile time
11757 (which happens automatically when using the
11758 <application>configure
</application> option
11759 <option>--enable-cassert
</option>).
11764 <varlistentry id=
"guc-ignore-system-indexes" xreflabel=
"ignore_system_indexes">
11765 <term><varname>ignore_system_indexes
</varname> (
<type>boolean
</type>)
11767 <primary><varname>ignore_system_indexes
</varname> configuration parameter
</primary>
11772 Ignore system indexes when reading system tables (but still
11773 update the indexes when modifying the tables). This is useful
11774 when recovering from damaged system indexes.
11775 This parameter cannot be changed after session start.
11780 <varlistentry id=
"guc-post-auth-delay" xreflabel=
"post_auth_delay">
11781 <term><varname>post_auth_delay
</varname> (
<type>integer
</type>)
11783 <primary><varname>post_auth_delay
</varname> configuration parameter
</primary>
11788 The amount of time to delay when a new
11789 server process is started, after it conducts the
11790 authentication procedure. This is intended to give developers an
11791 opportunity to attach to the server process with a debugger.
11792 If this value is specified without units, it is taken as seconds.
11793 A value of zero (the default) disables the delay.
11794 This parameter cannot be changed after session start.
11799 <varlistentry id=
"guc-pre-auth-delay" xreflabel=
"pre_auth_delay">
11800 <term><varname>pre_auth_delay
</varname> (
<type>integer
</type>)
11802 <primary><varname>pre_auth_delay
</varname> configuration parameter
</primary>
11807 The amount of time to delay just after a
11808 new server process is forked, before it conducts the
11809 authentication procedure. This is intended to give developers an
11810 opportunity to attach to the server process with a debugger to
11811 trace down misbehavior in authentication.
11812 If this value is specified without units, it is taken as seconds.
11813 A value of zero (the default) disables the delay.
11814 This parameter can only be set in the
<filename>postgresql.conf
</filename>
11815 file or on the server command line.
11820 <varlistentry id=
"guc-trace-notify" xreflabel=
"trace_notify">
11821 <term><varname>trace_notify
</varname> (
<type>boolean
</type>)
11823 <primary><varname>trace_notify
</varname> configuration parameter
</primary>
11828 Generates a great amount of debugging output for the
11829 <command>LISTEN
</command> and
<command>NOTIFY
</command>
11830 commands.
<xref linkend=
"guc-client-min-messages"/> or
11831 <xref linkend=
"guc-log-min-messages"/> must be
11832 <literal>DEBUG1
</literal> or lower to send this output to the
11833 client or server logs, respectively.
11838 <varlistentry id=
"guc-trace-sort" xreflabel=
"trace_sort">
11839 <term><varname>trace_sort
</varname> (
<type>boolean
</type>)
11841 <primary><varname>trace_sort
</varname> configuration parameter
</primary>
11846 If on, emit information about resource usage during sort operations.
11851 <varlistentry id=
"guc-trace-locks" xreflabel=
"trace_locks">
11852 <term><varname>trace_locks
</varname> (
<type>boolean
</type>)
11854 <primary><varname>trace_locks
</varname> configuration parameter
</primary>
11859 If on, emit information about lock usage. Information dumped
11860 includes the type of lock operation, the type of lock and the unique
11861 identifier of the object being locked or unlocked. Also included
11862 are bit masks for the lock types already granted on this object as
11863 well as for the lock types awaited on this object. For each lock
11864 type a count of the number of granted locks and waiting locks is
11865 also dumped as well as the totals. An example of the log file output
11868 LOG: LockAcquire: new: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
11869 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
11870 wait(
0) type(AccessShareLock)
11871 LOG: GrantLock: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
11872 grantMask(
2) req(
1,
0,
0,
0,
0,
0,
0)=
1 grant(
1,
0,
0,
0,
0,
0,
0)=
1
11873 wait(
0) type(AccessShareLock)
11874 LOG: UnGrantLock: updated: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
11875 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
11876 wait(
0) type(AccessShareLock)
11877 LOG: CleanUpLock: deleting: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
11878 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
11879 wait(
0) type(INVALID)
11881 Details of the structure being dumped may be found in
11882 <filename>src/include/storage/lock.h
</filename>.
11885 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11886 macro was defined when
<productname>PostgreSQL
</productname> was
11892 <varlistentry id=
"guc-trace-lwlocks" xreflabel=
"trace_lwlocks">
11893 <term><varname>trace_lwlocks
</varname> (
<type>boolean
</type>)
11895 <primary><varname>trace_lwlocks
</varname> configuration parameter
</primary>
11900 If on, emit information about lightweight lock usage. Lightweight
11901 locks are intended primarily to provide mutual exclusion of access
11902 to shared-memory data structures.
11905 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11906 macro was defined when
<productname>PostgreSQL
</productname> was
11912 <varlistentry id=
"guc-trace-userlocks" xreflabel=
"trace_userlocks">
11913 <term><varname>trace_userlocks
</varname> (
<type>boolean
</type>)
11915 <primary><varname>trace_userlocks
</varname> configuration parameter
</primary>
11920 If on, emit information about user lock usage. Output is the same
11921 as for
<symbol>trace_locks
</symbol>, only for advisory locks.
11924 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11925 macro was defined when
<productname>PostgreSQL
</productname> was
11931 <varlistentry id=
"guc-trace-lock-oidmin" xreflabel=
"trace_lock_oidmin">
11932 <term><varname>trace_lock_oidmin
</varname> (
<type>integer
</type>)
11934 <primary><varname>trace_lock_oidmin
</varname> configuration parameter
</primary>
11939 If set, do not trace locks for tables below this OID (used to avoid
11940 output on system tables).
11943 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11944 macro was defined when
<productname>PostgreSQL
</productname> was
11950 <varlistentry id=
"guc-trace-lock-table" xreflabel=
"trace_lock_table">
11951 <term><varname>trace_lock_table
</varname> (
<type>integer
</type>)
11953 <primary><varname>trace_lock_table
</varname> configuration parameter
</primary>
11958 Unconditionally trace locks on this table (OID).
11961 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11962 macro was defined when
<productname>PostgreSQL
</productname> was
11968 <varlistentry id=
"guc-debug-deadlocks" xreflabel=
"debug_deadlocks">
11969 <term><varname>debug_deadlocks
</varname> (
<type>boolean
</type>)
11971 <primary><varname>debug_deadlocks
</varname> configuration parameter
</primary>
11976 If set, dumps information about all current locks when a
11977 deadlock timeout occurs.
11980 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
11981 macro was defined when
<productname>PostgreSQL
</productname> was
11987 <varlistentry id=
"guc-log-btree-build-stats" xreflabel=
"log_btree_build_stats">
11988 <term><varname>log_btree_build_stats
</varname> (
<type>boolean
</type>)
11990 <primary><varname>log_btree_build_stats
</varname> configuration parameter
</primary>
11995 If set, logs system resource usage statistics (memory and CPU) on
11996 various B-tree operations.
11999 This parameter is only available if the
<symbol>BTREE_BUILD_STATS
</symbol>
12000 macro was defined when
<productname>PostgreSQL
</productname> was
12006 <varlistentry id=
"guc-wal-consistency-checking" xreflabel=
"wal_consistency_checking">
12007 <term><varname>wal_consistency_checking
</varname> (
<type>string
</type>)
12009 <primary><varname>wal_consistency_checking
</varname> configuration parameter
</primary>
12014 This parameter is intended to be used to check for bugs in the WAL
12015 redo routines. When enabled, full-page images of any buffers modified
12016 in conjunction with the WAL record are added to the record.
12017 If the record is subsequently replayed, the system will first apply
12018 each record and then test whether the buffers modified by the record
12019 match the stored images. In certain cases (such as hint bits), minor
12020 variations are acceptable, and will be ignored. Any unexpected
12021 differences will result in a fatal error, terminating recovery.
12025 The default value of this setting is the empty string, which disables
12026 the feature. It can be set to
<literal>all
</literal> to check all
12027 records, or to a comma-separated list of resource managers to check
12028 only records originating from those resource managers. Currently,
12029 the supported resource managers are
<literal>heap
</literal>,
12030 <literal>heap2
</literal>,
<literal>btree
</literal>,
<literal>hash
</literal>,
12031 <literal>gin
</literal>,
<literal>gist
</literal>,
<literal>sequence
</literal>,
12032 <literal>spgist
</literal>,
<literal>brin
</literal>, and
<literal>generic
</literal>.
12033 Extensions may define additional resource managers. Only superusers and users with
12034 the appropriate
<literal>SET
</literal> privilege can change this setting.
12039 <varlistentry id=
"guc-wal-debug" xreflabel=
"wal_debug">
12040 <term><varname>wal_debug
</varname> (
<type>boolean
</type>)
12042 <primary><varname>wal_debug
</varname> configuration parameter
</primary>
12047 If on, emit WAL-related debugging output. This parameter is
12048 only available if the
<symbol>WAL_DEBUG
</symbol> macro was
12049 defined when
<productname>PostgreSQL
</productname> was
12055 <varlistentry id=
"guc-ignore-checksum-failure" xreflabel=
"ignore_checksum_failure">
12056 <term><varname>ignore_checksum_failure
</varname> (
<type>boolean
</type>)
12058 <primary><varname>ignore_checksum_failure
</varname> configuration parameter
</primary>
12063 Only has effect if
<xref linkend=
"app-initdb-data-checksums"/> are enabled.
12066 Detection of a checksum failure during a read normally causes
12067 <productname>PostgreSQL
</productname> to report an error, aborting the current
12068 transaction. Setting
<varname>ignore_checksum_failure
</varname> to on causes
12069 the system to ignore the failure (but still report a warning), and
12070 continue processing. This behavior may
<emphasis>cause crashes, propagate
12071 or hide corruption, or other serious problems
</emphasis>. However, it may allow
12072 you to get past the error and retrieve undamaged tuples that might still be
12073 present in the table if the block header is still sane. If the header is
12074 corrupt an error will be reported even if this option is enabled. The
12075 default setting is
<literal>off
</literal>.
12076 Only superusers and users with the appropriate
<literal>SET
</literal>
12077 privilege can change this setting.
12082 <varlistentry id=
"guc-zero-damaged-pages" xreflabel=
"zero_damaged_pages">
12083 <term><varname>zero_damaged_pages
</varname> (
<type>boolean
</type>)
12085 <primary><varname>zero_damaged_pages
</varname> configuration parameter
</primary>
12090 Detection of a damaged page header normally causes
12091 <productname>PostgreSQL
</productname> to report an error, aborting the current
12092 transaction. Setting
<varname>zero_damaged_pages
</varname> to on causes
12093 the system to instead report a warning, zero out the damaged
12094 page in memory, and continue processing. This behavior
<emphasis>will destroy data
</emphasis>,
12095 namely all the rows on the damaged page. However, it does allow you to get
12096 past the error and retrieve rows from any undamaged pages that might
12097 be present in the table. It is useful for recovering data if
12098 corruption has occurred due to a hardware or software error. You should
12099 generally not set this on until you have given up hope of recovering
12100 data from the damaged pages of a table. Zeroed-out pages are not
12101 forced to disk so it is recommended to recreate the table or
12102 the index before turning this parameter off again. The
12103 default setting is
<literal>off
</literal>.
12104 Only superusers and users with the appropriate
<literal>SET
</literal>
12105 privilege can change this setting.
12110 <varlistentry id=
"guc-ignore-invalid-pages" xreflabel=
"ignore_invalid_pages">
12111 <term><varname>ignore_invalid_pages
</varname> (
<type>boolean
</type>)
12113 <primary><varname>ignore_invalid_pages
</varname> configuration parameter
</primary>
12118 If set to
<literal>off
</literal> (the default), detection of
12119 WAL records having references to invalid pages during
12120 recovery causes
<productname>PostgreSQL
</productname> to
12121 raise a PANIC-level error, aborting the recovery. Setting
12122 <varname>ignore_invalid_pages
</varname> to
<literal>on
</literal>
12123 causes the system to ignore invalid page references in WAL records
12124 (but still report a warning), and continue the recovery.
12125 This behavior may
<emphasis>cause crashes, data loss,
12126 propagate or hide corruption, or other serious problems
</emphasis>.
12127 However, it may allow you to get past the PANIC-level error,
12128 to finish the recovery, and to cause the server to start up.
12129 The parameter can only be set at server start. It only has effect
12130 during recovery or in standby mode.
12135 <varlistentry id=
"guc-jit-debugging-support" xreflabel=
"jit_debugging_support">
12136 <term><varname>jit_debugging_support
</varname> (
<type>boolean
</type>)
12138 <primary><varname>jit_debugging_support
</varname> configuration parameter
</primary>
12143 If LLVM has the required functionality, register generated functions
12144 with
<productname>GDB
</productname>. This makes debugging easier.
12145 The default setting is
<literal>off
</literal>.
12146 This parameter can only be set at server start.
12151 <varlistentry id=
"guc-jit-dump-bitcode" xreflabel=
"jit_dump_bitcode">
12152 <term><varname>jit_dump_bitcode
</varname> (
<type>boolean
</type>)
12154 <primary><varname>jit_dump_bitcode
</varname> configuration parameter
</primary>
12159 Writes the generated
<productname>LLVM
</productname> IR out to the
12160 file system, inside
<xref linkend=
"guc-data-directory"/>. This is only
12161 useful for working on the internals of the JIT implementation.
12162 The default setting is
<literal>off
</literal>.
12163 Only superusers and users with the appropriate
<literal>SET
</literal>
12164 privilege can change this setting.
12169 <varlistentry id=
"guc-jit-expressions" xreflabel=
"jit_expressions">
12170 <term><varname>jit_expressions
</varname> (
<type>boolean
</type>)
12172 <primary><varname>jit_expressions
</varname> configuration parameter
</primary>
12177 Determines whether expressions are JIT compiled, when JIT compilation
12178 is activated (see
<xref linkend=
"jit-decision"/>). The default is
12179 <literal>on
</literal>.
12184 <varlistentry id=
"guc-jit-profiling-support" xreflabel=
"jit_profiling_support">
12185 <term><varname>jit_profiling_support
</varname> (
<type>boolean
</type>)
12187 <primary><varname>jit_profiling_support
</varname> configuration parameter
</primary>
12192 If LLVM has the required functionality, emit the data needed to allow
12193 <productname>perf
</productname> to profile functions generated by JIT.
12194 This writes out files to
<filename>~/.debug/jit/
</filename>; the
12195 user is responsible for performing cleanup when desired.
12196 The default setting is
<literal>off
</literal>.
12197 This parameter can only be set at server start.
12202 <varlistentry id=
"guc-jit-tuple-deforming" xreflabel=
"jit_tuple_deforming">
12203 <term><varname>jit_tuple_deforming
</varname> (
<type>boolean
</type>)
12205 <primary><varname>jit_tuple_deforming
</varname> configuration parameter
</primary>
12210 Determines whether tuple deforming is JIT compiled, when JIT
12211 compilation is activated (see
<xref linkend=
"jit-decision"/>).
12212 The default is
<literal>on
</literal>.
12217 <varlistentry id=
"guc-remove-temp-files-after-crash" xreflabel=
"remove_temp_files_after_crash">
12218 <term><varname>remove_temp_files_after_crash
</varname> (
<type>boolean
</type>)
12220 <primary><varname>remove_temp_files_after_crash
</varname> configuration parameter
</primary>
12225 When set to
<literal>on
</literal>, which is the default,
12226 <productname>PostgreSQL
</productname> will automatically remove
12227 temporary files after a backend crash. If disabled, the files will be
12228 retained and may be used for debugging, for example. Repeated crashes
12229 may however result in accumulation of useless files. This parameter
12230 can only be set in the
<filename>postgresql.conf
</filename> file or on
12231 the server command line.
12236 <varlistentry id=
"guc-send-abort-for-crash" xreflabel=
"send_abort_for_crash">
12237 <term><varname>send_abort_for_crash
</varname> (
<type>boolean
</type>)
12239 <primary><varname>send_abort_for_crash
</varname> configuration parameter
</primary>
12244 By default, after a backend crash the postmaster will stop remaining
12245 child processes by sending them
<systemitem>SIGQUIT
</systemitem>
12246 signals, which permits them to exit more-or-less gracefully. When
12247 this option is set to
<literal>on
</literal>,
12248 <systemitem>SIGABRT
</systemitem> is sent instead. That normally
12249 results in production of a core dump file for each such child
12251 This can be handy for investigating the states of other processes
12252 after a crash. It can also consume lots of disk space in the event
12253 of repeated crashes, so do not enable this on systems you are not
12254 monitoring carefully.
12255 Beware that no support exists for cleaning up the core file(s)
12257 This parameter can only be set in
12258 the
<filename>postgresql.conf
</filename> file or on the server
12264 <varlistentry id=
"guc-send-abort-for-kill" xreflabel=
"send_abort_for_kill">
12265 <term><varname>send_abort_for_kill
</varname> (
<type>boolean
</type>)
12267 <primary><varname>send_abort_for_kill
</varname> configuration parameter
</primary>
12272 By default, after attempting to stop a child process with
12273 <systemitem>SIGQUIT
</systemitem>, the postmaster will wait five
12274 seconds and then send
<systemitem>SIGKILL
</systemitem> to force
12275 immediate termination. When this option is set
12276 to
<literal>on
</literal>,
<systemitem>SIGABRT
</systemitem> is sent
12277 instead of
<systemitem>SIGKILL
</systemitem>. That normally results
12278 in production of a core dump file for each such child process.
12279 This can be handy for investigating the states
12280 of
<quote>stuck
</quote> child processes. It can also consume lots
12281 of disk space in the event of repeated crashes, so do not enable
12282 this on systems you are not monitoring carefully.
12283 Beware that no support exists for cleaning up the core file(s)
12285 This parameter can only be set in
12286 the
<filename>postgresql.conf
</filename> file or on the server
12292 <varlistentry id=
"guc-debug-logical-replication-streaming" xreflabel=
"debug_logical_replication_streaming">
12293 <term><varname>debug_logical_replication_streaming
</varname> (
<type>enum
</type>)
12295 <primary><varname>debug_logical_replication_streaming
</varname> configuration parameter
</primary>
12300 The allowed values are
<literal>buffered
</literal> and
12301 <literal>immediate
</literal>. The default is
<literal>buffered
</literal>.
12302 This parameter is intended to be used to test logical decoding and
12303 replication of large transactions. The effect of
12304 <varname>debug_logical_replication_streaming
</varname> is different for the
12305 publisher and subscriber:
12309 On the publisher side,
<varname>debug_logical_replication_streaming
</varname>
12310 allows streaming or serializing changes immediately in logical decoding.
12311 When set to
<literal>immediate
</literal>, stream each change if the
12312 <link linkend=
"sql-createsubscription-params-with-streaming"><literal>streaming
</literal></link>
12314 <link linkend=
"sql-createsubscription"><command>CREATE SUBSCRIPTION
</command></link>
12315 is enabled, otherwise, serialize each change. When set to
12316 <literal>buffered
</literal>, the decoding will stream or serialize
12317 changes when
<varname>logical_decoding_work_mem
</varname> is reached.
12321 On the subscriber side, if the
<literal>streaming
</literal> option is set to
12322 <literal>parallel
</literal>,
<varname>debug_logical_replication_streaming
</varname>
12323 can be used to direct the leader apply worker to send changes to the
12324 shared memory queue or to serialize all changes to the file. When set to
12325 <literal>buffered
</literal>, the leader sends changes to parallel apply
12326 workers via a shared memory queue. When set to
12327 <literal>immediate
</literal>, the leader serializes all changes to files
12328 and notifies the parallel apply workers to read and apply them at the
12329 end of the transaction.
12336 <sect1 id=
"runtime-config-short">
12337 <title>Short Options
</title>
12340 For convenience there are also single letter command-line option
12341 switches available for some parameters. They are described in
12342 <xref linkend=
"runtime-config-short-table"/>. Some of these
12343 options exist for historical reasons, and their presence as a
12344 single-letter option does not necessarily indicate an endorsement
12345 to use the option heavily.
12348 <table id=
"runtime-config-short-table">
12349 <title>Short Option Key
</title>
12351 <colspec colname=
"col1" colwidth=
"1*"/>
12352 <colspec colname=
"col2" colwidth=
"2*"/>
12355 <entry>Short Option
</entry>
12356 <entry>Equivalent
</entry>
12362 <entry><option>-B
<replaceable>x
</replaceable></option></entry>
12363 <entry><literal>shared_buffers =
<replaceable>x
</replaceable></literal></entry>
12366 <entry><option>-d
<replaceable>x
</replaceable></option></entry>
12367 <entry><literal>log_min_messages = DEBUG
<replaceable>x
</replaceable></literal></entry>
12370 <entry><option>-e
</option></entry>
12371 <entry><literal>datestyle = euro
</literal></entry>
12375 <option>-fb
</option>,
<option>-fh
</option>,
<option>-fi
</option>,
12376 <option>-fm
</option>,
<option>-fn
</option>,
<option>-fo
</option>,
12377 <option>-fs
</option>,
<option>-ft
</option>
12380 <literal>enable_bitmapscan = off
</literal>,
12381 <literal>enable_hashjoin = off
</literal>,
12382 <literal>enable_indexscan = off
</literal>,
12383 <literal>enable_mergejoin = off
</literal>,
12384 <literal>enable_nestloop = off
</literal>,
12385 <literal>enable_indexonlyscan = off
</literal>,
12386 <literal>enable_seqscan = off
</literal>,
12387 <literal>enable_tidscan = off
</literal>
12391 <entry><option>-F
</option></entry>
12392 <entry><literal>fsync = off
</literal></entry>
12395 <entry><option>-h
<replaceable>x
</replaceable></option></entry>
12396 <entry><literal>listen_addresses =
<replaceable>x
</replaceable></literal></entry>
12399 <entry><option>-i
</option></entry>
12400 <entry><literal>listen_addresses = '*'
</literal></entry>
12403 <entry><option>-k
<replaceable>x
</replaceable></option></entry>
12404 <entry><literal>unix_socket_directories =
<replaceable>x
</replaceable></literal></entry>
12407 <entry><option>-l
</option></entry>
12408 <entry><literal>ssl = on
</literal></entry>
12411 <entry><option>-N
<replaceable>x
</replaceable></option></entry>
12412 <entry><literal>max_connections =
<replaceable>x
</replaceable></literal></entry>
12415 <entry><option>-O
</option></entry>
12416 <entry><literal>allow_system_table_mods = on
</literal></entry>
12419 <entry><option>-p
<replaceable>x
</replaceable></option></entry>
12420 <entry><literal>port =
<replaceable>x
</replaceable></literal></entry>
12423 <entry><option>-P
</option></entry>
12424 <entry><literal>ignore_system_indexes = on
</literal></entry>
12427 <entry><option>-s
</option></entry>
12428 <entry><literal>log_statement_stats = on
</literal></entry>
12431 <entry><option>-S
<replaceable>x
</replaceable></option></entry>
12432 <entry><literal>work_mem =
<replaceable>x
</replaceable></literal></entry>
12435 <entry><option>-tpa
</option>,
<option>-tpl
</option>,
<option>-te
</option></entry>
12436 <entry><literal>log_parser_stats = on
</literal>,
12437 <literal>log_planner_stats = on
</literal>,
12438 <literal>log_executor_stats = on
</literal></entry>
12441 <entry><option>-W
<replaceable>x
</replaceable></option></entry>
12442 <entry><literal>post_auth_delay =
<replaceable>x
</replaceable></literal></entry>