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 set configuration parameters. The subsequent sections
15 discuss each parameter in detail.
18 <sect1 id=
"config-setting">
19 <title>Setting Parameters
</title>
22 All parameter names are case-insensitive. Every parameter takes a
23 value of one of five types: Boolean, integer, floating point,
24 string or enum. Boolean values can be written as
<literal>ON
</literal>,
25 <literal>OFF
</literal>,
<literal>TRUE
</literal>,
26 <literal>FALSE
</literal>,
<literal>YES
</literal>,
27 <literal>NO
</literal>,
<literal>1</literal>,
<literal>0</literal>
28 (all case-insensitive) or any unambiguous prefix of these.
32 Some settings specify a memory or time value. Each of these has an
33 implicit unit, which is either kilobytes, blocks (typically eight
34 kilobytes), milliseconds, seconds, or minutes. Default units can be
35 found by referencing
<structname>pg_settings<
/>.
<structfield>unit<
/>.
37 a different unit can also be specified explicitly. Valid memory units
38 are
<literal>kB
</literal> (kilobytes),
<literal>MB
</literal>
39 (megabytes), and
<literal>GB
</literal> (gigabytes); valid time units
40 are
<literal>ms
</literal> (milliseconds),
<literal>s
</literal>
41 (seconds),
<literal>min
</literal> (minutes),
<literal>h
</literal>
42 (hours), and
<literal>d
</literal> (days). Note that the multiplier
43 for memory units is
1024, not
1000.
47 Parameters of type
<quote>enum<
/> are specified in the same way as string
48 parameters, but are restricted to a limited set of values. The allowed
50 from
<structname>pg_settings<
/>.
<structfield>enumvals<
/>.
51 Enum parameter values are case-insensitive.
55 One way to set these parameters is to edit the file
56 <filename>postgresql.conf<
/><indexterm><primary>postgresql.conf<
/><
/>,
57 which is normally kept in the data directory. (
<application>initdb<
/>
58 installs a default copy there.) An example of what this file might look
63 log_destination = 'syslog'
64 search_path = '
"$user", public'
65 shared_buffers =
128MB
67 One parameter is specified per line. The equal sign between name and
68 value is optional. Whitespace is insignificant and blank lines are
69 ignored. Hash marks (
<literal>#
</literal>) introduce comments
70 anywhere. Parameter values that are not simple identifiers or
71 numbers must be single-quoted. To embed a single quote in a parameter
72 value, write either two quotes (preferred) or backslash-quote.
77 <primary><literal>include<
/></primary>
78 <secondary>in configuration file
</secondary>
80 In addition to parameter settings, the
<filename>postgresql.conf<
/>
81 file can contain
<firstterm>include directives<
/>, which specify
82 another file to read and process as if it were inserted into the
83 configuration file at this point. Include directives simply look like:
87 If the file name is not an absolute path, it is taken as relative to
88 the directory containing the referencing configuration file.
89 Inclusions can be nested.
94 <primary>SIGHUP
</primary>
96 The configuration file is reread whenever the main server process receives a
97 <systemitem>SIGHUP<
/> signal (which is most easily sent by means
98 of
<literal>pg_ctl reload<
/>). The main server process
99 also propagates this signal to all currently running server
100 processes so that existing sessions also get the new
101 value. Alternatively, you can send the signal to a single server
102 process directly. Some parameters can only be set at server start;
103 any changes to their entries in the configuration file will be ignored
104 until the server is restarted.
108 A second way to set these configuration parameters is to give them
109 as a command-line option to the
<command>postgres
</command> command, such as:
111 postgres -c log_connections=yes -c log_destination='syslog'
113 Command-line options override any conflicting settings in
114 <filename>postgresql.conf
</filename>. Note that this means you won't
115 be able to change the value on-the-fly by editing
116 <filename>postgresql.conf
</filename>, so while the command-line
117 method might be convenient, it can cost you flexibility later.
121 Occasionally it is useful to give a command line option to
122 one particular session only. The environment variable
123 <envar>PGOPTIONS
</envar> can be used for this purpose on the
126 env PGOPTIONS='-c geqo=off' psql
128 (This works for any
<application>libpq<
/>-based client application, not
129 just
<application>psql
</application>.) Note that this won't work for
130 parameters that are fixed when the server is started or that must be
131 specified in
<filename>postgresql.conf
</filename>.
135 Furthermore, it is possible to assign a set of parameter settings to
136 a user or a database. Whenever a session is started, the default
137 settings for the user and database involved are loaded. The
138 commands
<xref linkend=
"sql-alteruser" endterm=
"sql-alteruser-title">
139 and
<xref linkend=
"sql-alterdatabase" endterm=
"sql-alterdatabase-title">,
140 respectively, are used to configure these settings. Per-database
141 settings override anything received from the
142 <command>postgres
</command> command-line or the configuration
143 file, and in turn are overridden by per-user settings; both are
144 overridden by per-session settings.
148 Some parameters can be changed in individual
<acronym>SQL
</acronym>
149 sessions with the
<xref linkend=
"SQL-SET" endterm=
"SQL-SET-title">
150 command, for example:
152 SET ENABLE_SEQSCAN TO OFF;
154 If
<command>SET<
/> is allowed, it overrides all other sources of
155 values for the parameter. Some parameters cannot be changed via
156 <command>SET
</command>: for example, if they control behavior that
157 cannot be changed without restarting the entire
158 <productname>PostgreSQL
</productname> server. Also, some parameters can
159 be modified via
<command>SET
</command> or
<command>ALTER<
/> by superusers,
160 but not by ordinary users.
164 The
<xref linkend=
"SQL-SHOW" endterm=
"SQL-SHOW-title">
165 command allows inspection of the current values of all parameters.
169 The virtual table
<structname>pg_settings
</structname>
170 (described in
<xref linkend=
"view-pg-settings">) also allows
171 displaying and updating session run-time parameters. It is equivalent
172 to
<command>SHOW<
/> and
<command>SET<
/>, but can be more convenient
173 to use because it can be joined with other tables, or selected from using
174 any desired selection condition. It also contains more information about
175 what values are allowed for the parameters.
179 <sect1 id=
"runtime-config-file-locations">
180 <title>File Locations
</title>
183 In addition to the
<filename>postgresql.conf
</filename> file
184 already mentioned,
<productname>PostgreSQL
</productname> uses
185 two other manually-edited configuration files, which control
186 client authentication (their use is discussed in
<xref
187 linkend=
"client-authentication">). By default, all three
188 configuration files are stored in the database cluster's data
189 directory. The parameters described in this section allow the
190 configuration files to be placed elsewhere. (Doing so can ease
191 administration. In particular it is often easier to ensure that
192 the configuration files are properly backed-up when they are
197 <varlistentry id=
"guc-data-directory" xreflabel=
"data_directory">
198 <term><varname>data_directory
</varname> (
<type>string
</type>)
</term>
200 <primary><varname>data_directory<
/> configuration parameter
</primary>
204 Specifies the directory to use for data storage.
205 This parameter can only be set at server start.
210 <varlistentry id=
"guc-config-file" xreflabel=
"config_file">
211 <term><varname>config_file
</varname> (
<type>string
</type>)
</term>
213 <primary><varname>config_file<
/> configuration parameter
</primary>
217 Specifies the main server configuration file
218 (customarily called
<filename>postgresql.conf<
/>).
219 This parameter can only be set on the
<command>postgres
</command> command line.
224 <varlistentry id=
"guc-hba-file" xreflabel=
"hba_file">
225 <term><varname>hba_file
</varname> (
<type>string
</type>)
</term>
227 <primary><varname>hba_file<
/> configuration parameter
</primary>
231 Specifies the configuration file for host-based authentication
232 (customarily called
<filename>pg_hba.conf<
/>).
233 This parameter can only be set at server start.
238 <varlistentry id=
"guc-ident-file" xreflabel=
"ident_file">
239 <term><varname>ident_file
</varname> (
<type>string
</type>)
</term>
241 <primary><varname>ident_file<
/> configuration parameter
</primary>
245 Specifies the configuration file for
246 <application>ident<
/> authentication
247 (customarily called
<filename>pg_ident.conf<
/>).
248 This parameter can only be set at server start.
253 <varlistentry id=
"guc-external-pid-file" xreflabel=
"external_pid_file">
254 <term><varname>external_pid_file
</varname> (
<type>string
</type>)
</term>
256 <primary><varname>external_pid_file<
/> configuration parameter
</primary>
260 Specifies the name of an additional process-id (PID) file that the
261 server should create for use by server administration programs.
262 This parameter can only be set at server start.
269 In a default installation, none of the above parameters are set
270 explicitly. Instead, the
271 data directory is specified by the
<option>-D
</option> command-line
272 option or the
<envar>PGDATA
</envar> environment variable, and the
273 configuration files are all found within the data directory.
277 If you wish to keep the configuration files elsewhere than the
278 data directory, the
<command>postgres
</command> <option>-D
</option>
279 command-line option or
<envar>PGDATA
</envar> environment variable
280 must point to the directory containing the configuration files,
281 and the
<varname>data_directory<
/> parameter must be set in
282 <filename>postgresql.conf
</filename> (or on the command line) to show
283 where the data directory is actually located. Notice that
284 <varname>data_directory<
/> overrides
<option>-D
</option> and
285 <envar>PGDATA
</envar> for the location
286 of the data directory, but not for the location of the configuration
291 If you wish, you can specify the configuration file names and locations
292 individually using the parameters
<varname>config_file<
/>,
293 <varname>hba_file<
/> and/or
<varname>ident_file<
/>.
294 <varname>config_file<
/> can only be specified on the
295 <command>postgres
</command> command line, but the others can be
296 set within the main configuration file. If all three parameters plus
297 <varname>data_directory<
/> are explicitly set, then it is not necessary
298 to specify
<option>-D
</option> or
<envar>PGDATA
</envar>.
302 When setting any of these parameters, a relative path will be interpreted
303 with respect to the directory in which
<command>postgres
</command>
308 <sect1 id=
"runtime-config-connection">
309 <title>Connections and Authentication
</title>
311 <sect2 id=
"runtime-config-connection-settings">
312 <title>Connection Settings
</title>
316 <varlistentry id=
"guc-listen-addresses" xreflabel=
"listen_addresses">
317 <term><varname>listen_addresses
</varname> (
<type>string
</type>)
</term>
319 <primary><varname>listen_addresses<
/> configuration parameter
</primary>
323 Specifies the TCP/IP address(es) on which the server is
324 to listen for connections from client applications.
325 The value takes the form of a comma-separated list of host names
326 and/or numeric IP addresses. The special entry
<literal>*<
/>
327 corresponds to all available IP interfaces.
328 If the list is empty, the server does not listen on any IP interface
329 at all, in which case only Unix-domain sockets can be used to connect
331 The default value is
<systemitem class=
"systemname">localhost<
/>,
332 which allows only local
<quote>loopback<
/> connections to be made.
333 This parameter can only be set at server start.
338 <varlistentry id=
"guc-port" xreflabel=
"port">
339 <term><varname>port
</varname> (
<type>integer
</type>)
</term>
341 <primary><varname>port<
/> configuration parameter
</primary>
345 The TCP port the server listens on;
5432 by default. Note that the
346 same port number is used for all IP addresses the server listens on.
347 This parameter can only be set at server start.
352 <varlistentry id=
"guc-max-connections" xreflabel=
"max_connections">
353 <term><varname>max_connections
</varname> (
<type>integer
</type>)
</term>
355 <primary><varname>max_connections<
/> configuration parameter
</primary>
359 Determines the maximum number of concurrent connections to the
360 database server. The default is typically
100 connections, but
361 might be less if your kernel settings will not support it (as
362 determined during
<application>initdb<
/>). This parameter can
363 only be set at server start.
367 Increasing this parameter might cause
<productname>PostgreSQL<
/>
368 to request more
<systemitem class=
"osname">System V<
/> shared
369 memory or semaphores than your operating system's default configuration
370 allows. See
<xref linkend=
"sysvipc"> for information on how to
371 adjust those parameters, if necessary.
376 <varlistentry id=
"guc-superuser-reserved-connections"
377 xreflabel=
"superuser_reserved_connections">
378 <term><varname>superuser_reserved_connections
</varname>
379 (
<type>integer
</type>)
</term>
381 <primary><varname>superuser_reserved_connections<
/> configuration parameter
</primary>
385 Determines the number of connection
<quote>slots
</quote> that
386 are reserved for connections by
<productname>PostgreSQL<
/>
387 superusers. At most
<xref linkend=
"guc-max-connections">
388 connections can ever be active simultaneously. Whenever the
389 number of active concurrent connections is at least
390 <varname>max_connections<
/> minus
391 <varname>superuser_reserved_connections
</varname>, new
392 connections will be accepted only for superusers.
396 The default value is three connections. The value must be less
397 than the value of
<varname>max_connections
</varname>. This
398 parameter can only be set at server start.
403 <varlistentry id=
"guc-unix-socket-directory" xreflabel=
"unix_socket_directory">
404 <term><varname>unix_socket_directory
</varname> (
<type>string
</type>)
</term>
406 <primary><varname>unix_socket_directory<
/> configuration parameter
</primary>
410 Specifies the directory of the Unix-domain socket on which the
411 server is to listen for
412 connections from client applications. The default is normally
413 <filename>/tmp
</filename>, but can be changed at build time.
414 This parameter can only be set at server start.
419 <varlistentry id=
"guc-unix-socket-group" xreflabel=
"unix_socket_group">
420 <term><varname>unix_socket_group
</varname> (
<type>string
</type>)
</term>
422 <primary><varname>unix_socket_group<
/> configuration parameter
</primary>
426 Sets the owning group of the Unix-domain socket. (The owning
427 user of the socket is always the user that starts the
428 server.) In combination with the parameter
429 <varname>unix_socket_permissions
</varname> this can be used as
430 an additional access control mechanism for Unix-domain connections.
431 By default this is the empty string, which selects the default
432 group for the current user. This parameter can only be set at
438 <varlistentry id=
"guc-unix-socket-permissions" xreflabel=
"unix_socket_permissions">
439 <term><varname>unix_socket_permissions
</varname> (
<type>integer
</type>)
</term>
441 <primary><varname>unix_socket_permissions<
/> configuration parameter
</primary>
445 Sets the access permissions of the Unix-domain socket. Unix-domain
446 sockets use the usual Unix file system permission set.
447 The parameter value is expected to be a numeric mode
448 specification in the form accepted by the
449 <function>chmod
</function> and
<function>umask
</function>
450 system calls. (To use the customary octal format the number
451 must start with a
<literal>0</literal> (zero).)
455 The default permissions are
<literal>0777</literal>, meaning
456 anyone can connect. Reasonable alternatives are
457 <literal>0770</literal> (only user and group, see also
458 <varname>unix_socket_group
</varname>) and
<literal>0700</literal>
459 (only user). (Note that for a Unix-domain socket, only write
460 permission matters and so there is no point in setting or revoking
461 read or execute permissions.)
465 This access control mechanism is independent of the one
466 described in
<xref linkend=
"client-authentication">.
470 This parameter can only be set at server start.
475 <varlistentry id=
"guc-bonjour-name" xreflabel=
"bonjour_name">
476 <term><varname>bonjour_name
</varname> (
<type>string
</type>)
</term>
478 <primary><varname>bonjour_name<
/> configuration parameter
</primary>
482 Specifies the
<productname>Bonjour
</productname> broadcast
483 name. The computer name is used if this parameter is set to the
484 empty string
<literal>''<
/> (which is the default). This parameter is
485 ignored if the server was not compiled with
486 <productname>Bonjour
</productname> support.
487 This parameter can only be set at server start.
492 <varlistentry id=
"guc-tcp-keepalives-idle" xreflabel=
"tcp_keepalives_idle">
493 <term><varname>tcp_keepalives_idle
</varname> (
<type>integer
</type>)
</term>
495 <primary><varname>tcp_keepalives_idle<
/> configuration parameter
</primary>
499 On systems that support the
<symbol>TCP_KEEPIDLE
</symbol> socket option, specifies the
500 number of seconds between sending keepalives on an otherwise idle
501 connection. A value of zero uses the system default. If
<symbol>TCP_KEEPIDLE
</symbol> is
502 not supported, this parameter must be zero. This parameter is ignored for
503 connections made via a Unix-domain socket.
508 <varlistentry id=
"guc-tcp-keepalives-interval" xreflabel=
"tcp_keepalives_interval">
509 <term><varname>tcp_keepalives_interval
</varname> (
<type>integer
</type>)
</term>
511 <primary><varname>tcp_keepalives_interval<
/> configuration parameter
</primary>
515 On systems that support the
<symbol>TCP_KEEPINTVL
</symbol> socket option, specifies how
516 long, in seconds, to wait for a response to a keepalive before
517 retransmitting. A value of zero uses the system default. If
<symbol>TCP_KEEPINTVL
</symbol>
518 is not supported, this parameter must be zero. This parameter is ignored
519 for connections made via a Unix-domain socket.
524 <varlistentry id=
"guc-tcp-keepalives-count" xreflabel=
"tcp_keepalives_count">
525 <term><varname>tcp_keepalives_count
</varname> (
<type>integer
</type>)
</term>
527 <primary><varname>tcp_keepalives_count<
/> configuration parameter
</primary>
531 On systems that support the
<symbol>TCP_KEEPCNT
</symbol> socket option, specifies how
532 many keepalives can be lost before the connection is considered dead.
533 A value of zero uses the system default. If
<symbol>TCP_KEEPCNT
</symbol> is not
534 supported, this parameter must be zero. This parameter is ignored
535 for connections made via a Unix-domain socket.
542 <sect2 id=
"runtime-config-connection-security">
543 <title>Security and Authentication
</title>
546 <varlistentry id=
"guc-authentication-timeout" xreflabel=
"authentication_timeout">
547 <term><varname>authentication_timeout
</varname> (
<type>integer
</type>)
</term>
548 <indexterm><primary>timeout<
/><secondary>client authentication<
/></indexterm>
549 <indexterm><primary>client authentication<
/><secondary>timeout during<
/></indexterm>
551 <primary><varname>authentication_timeout<
/> configuration parameter
</primary>
556 Maximum time to complete client authentication, in seconds. If a
557 would-be client has not completed the authentication protocol in
558 this much time, the server breaks the connection. This prevents
559 hung clients from occupying a connection indefinitely.
560 The default is one minute (
<literal>1m<
/>).
561 This parameter can only be set in the
<filename>postgresql.conf<
/>
562 file or on the server command line.
567 <varlistentry id=
"guc-ssl" xreflabel=
"ssl">
568 <term><varname>ssl
</varname> (
<type>boolean
</type>)
</term>
570 <primary><varname>ssl<
/> configuration parameter
</primary>
574 Enables
<acronym>SSL<
/> connections. Please read
575 <xref linkend=
"ssl-tcp"> before using this. The default
576 is
<literal>off<
/>. This parameter can only be set at server
577 start.
<acronym>SSL<
/> communication is only possible with
583 <varlistentry id=
"guc-ssl-ciphers" xreflabel=
"ssl_ciphers">
584 <term><varname>ssl_ciphers
</varname> (
<type>string
</type>)
</term>
586 <primary><varname>ssl_ciphers<
/> configuration parameter
</primary>
590 Specifies a list of
<acronym>SSL<
/> ciphers that are allowed to be
591 used on secure connections. See the
<application>openssl<
/>
592 manual page for a list of supported ciphers.
597 <varlistentry id=
"guc-password-encryption" xreflabel=
"password_encryption">
598 <term><varname>password_encryption
</varname> (
<type>boolean
</type>)
</term>
600 <primary><varname>password_encryption<
/> configuration parameter
</primary>
604 When a password is specified in
<xref
605 linkend=
"sql-createuser" endterm=
"sql-createuser-title"> or
606 <xref linkend=
"sql-alteruser" endterm=
"sql-alteruser-title">
607 without writing either
<literal>ENCRYPTED<
/> or
608 <literal>UNENCRYPTED<
/>, this parameter determines whether the
609 password is to be encrypted. The default is
<literal>on<
/>
610 (encrypt the password).
615 <varlistentry id=
"guc-krb-server-keyfile" xreflabel=
"krb_server_keyfile">
616 <term><varname>krb_server_keyfile
</varname> (
<type>string
</type>)
</term>
618 <primary><varname>krb_server_keyfile<
/> configuration parameter
</primary>
622 Sets the location of the Kerberos server key file. See
623 <xref linkend=
"kerberos-auth"> or
<xref linkend=
"gssapi-auth">
624 for details. This parameter can only be set in the
625 <filename>postgresql.conf<
/> file or on the server command line.
630 <varlistentry id=
"guc-krb-srvname" xreflabel=
"krb_srvname">
631 <term><varname>krb_srvname
</varname> (
<type>string
</type>)
</term>
633 <primary><varname>krb_srvname<
/> configuration parameter
</primary>
637 Sets the Kerberos service name. See
<xref linkend=
"kerberos-auth">
638 for details. This parameter can only be set in the
639 <filename>postgresql.conf<
/> file or on the server command line.
644 <varlistentry id=
"guc-krb-caseins-users" xreflabel=
"krb_caseins_users">
645 <term><varname>krb_caseins_users
</varname> (
<type>boolean
</type>)
</term>
647 <primary><varname>krb_caseins_users
</varname> configuration parameter
</primary>
651 Sets whether Kerberos and GSSAPI user names should be treated
653 The default is
<literal>off<
/> (case sensitive). This parameter can only be
654 set in the
<filename>postgresql.conf<
/> file or on the server command line.
659 <varlistentry id=
"guc-db-user-namespace" xreflabel=
"db_user_namespace">
660 <term><varname>db_user_namespace
</varname> (
<type>boolean
</type>)
</term>
662 <primary><varname>db_user_namespace<
/> configuration parameter
</primary>
666 This parameter enables per-database user names. It is off by default.
667 This parameter can only be set in the
<filename>postgresql.conf<
/>
668 file or on the server command line.
672 If this is on, you should create users as
<literal>username@dbname<
/>.
673 When
<literal>username<
/> is passed by a connecting client,
674 <literal>@<
/> and the database name are appended to the user
675 name and that database-specific user name is looked up by the
676 server. Note that when you create users with names containing
677 <literal>@<
/> within the SQL environment, you will need to
682 With this parameter enabled, you can still create ordinary global
683 users. Simply append
<literal>@<
/> when specifying the user
684 name in the client. The
<literal>@<
/> will be stripped off
685 before the user name is looked up by the server.
689 <varname>db_user_namespace<
/> causes the client's and
690 server's user name representation to differ.
691 Authentication checks are always done with the server's user name
692 so authentication methods must be configured for the
693 server's user name, not the client's. Because
694 <literal>md5<
/> uses the user name as salt on both the
695 client and server,
<literal>md5<
/> cannot be used with
696 <varname>db_user_namespace<
/>.
701 This feature is intended as a temporary measure until a
702 complete solution is found. At that time, this option will
713 <sect1 id=
"runtime-config-resource">
714 <title>Resource Consumption
</title>
716 <sect2 id=
"runtime-config-resource-memory">
717 <title>Memory
</title>
720 <varlistentry id=
"guc-shared-buffers" xreflabel=
"shared_buffers">
721 <term><varname>shared_buffers
</varname> (
<type>integer
</type>)
</term>
723 <primary><varname>shared_buffers<
/> configuration parameter
</primary>
727 Sets the amount of memory the database server uses for shared
728 memory buffers. The default is typically
32 megabytes
729 (
<literal>32MB<
/>), but might be less if your kernel settings will
730 not support it (as determined during
<application>initdb<
/>).
731 This setting must be at least
128 kilobytes. (Non-default
732 values of
<symbol>BLCKSZ
</symbol> change the minimum.) However,
733 settings significantly higher than the minimum are usually needed
734 for good performance. Several tens of megabytes are recommended
735 for production installations. This parameter can only be set at
740 Increasing this parameter might cause
<productname>PostgreSQL<
/>
741 to request more
<systemitem class=
"osname">System V<
/> shared
742 memory than your operating system's default configuration
743 allows. See
<xref linkend=
"sysvipc"> for information on how to
744 adjust those parameters, if necessary.
749 <varlistentry id=
"guc-temp-buffers" xreflabel=
"temp_buffers">
750 <term><varname>temp_buffers
</varname> (
<type>integer
</type>)
</term>
752 <primary><varname>temp_buffers<
/> configuration parameter
</primary>
756 Sets the maximum number of temporary buffers used by each database
757 session. These are session-local buffers used only for access to
758 temporary tables. The default is eight megabytes
759 (
<literal>8MB<
/>). The setting can be changed within individual
760 sessions, but only up until the first use of temporary tables
761 within a session; subsequent attempts to change the value will
762 have no effect on that session.
766 A session will allocate temporary buffers as needed up to the limit
767 given by
<varname>temp_buffers<
/>. The cost of setting a large
768 value in sessions that do not actually need a lot of temporary
769 buffers is only a buffer descriptor, or about
64 bytes, per
770 increment in
<varname>temp_buffers<
/>. However if a buffer is
771 actually used an additional
8192 bytes will be consumed for it
772 (or in general,
<symbol>BLCKSZ
</symbol> bytes).
777 <varlistentry id=
"guc-max-prepared-transactions" xreflabel=
"max_prepared_transactions">
778 <term><varname>max_prepared_transactions
</varname> (
<type>integer
</type>)
</term>
780 <primary><varname>max_prepared_transactions<
/> configuration parameter
</primary>
784 Sets the maximum number of transactions that can be in the
785 <quote>prepared<
/> state simultaneously (see
<xref
786 linkend=
"sql-prepare-transaction"
787 endterm=
"sql-prepare-transaction-title">).
788 Setting this parameter to zero (which is the default)
789 disables the prepared-transaction feature.
790 This parameter can only be set at server start.
794 If you are not planning to use prepared transactions, this parameter
795 should be set to zero to prevent accidental creation of prepared
796 transactions. If you are using prepared transactions, you will
797 probably want
<varname>max_prepared_transactions
</varname> to be at
798 least as large as
<xref linkend=
"guc-max-connections">, so that every
799 session can have a prepared transaction pending.
803 Increasing this parameter might cause
<productname>PostgreSQL<
/>
804 to request more
<systemitem class=
"osname">System V<
/> shared
805 memory than your operating system's default configuration
806 allows. See
<xref linkend=
"sysvipc"> for information on how to
807 adjust those parameters, if necessary.
812 <varlistentry id=
"guc-work-mem" xreflabel=
"work_mem">
813 <term><varname>work_mem
</varname> (
<type>integer
</type>)
</term>
815 <primary><varname>work_mem<
/> configuration parameter
</primary>
819 Specifies the amount of memory to be used by internal sort operations
820 and hash tables before switching to temporary disk files. The value
821 defaults to one megabyte (
<literal>1MB<
/>).
822 Note that for a complex query, several sort or hash operations might be
823 running in parallel; each one will be allowed to use as much memory
824 as this value specifies before it starts to put data into temporary
825 files. Also, several running sessions could be doing such operations
826 concurrently. So the total memory used could be many
827 times the value of
<varname>work_mem
</varname>; it is necessary to
828 keep this fact in mind when choosing the value. Sort operations are
829 used for
<literal>ORDER BY<
/>,
<literal>DISTINCT<
/>, and
831 Hash tables are used in hash joins, hash-based aggregation, and
832 hash-based processing of
<literal>IN<
/> subqueries.
837 <varlistentry id=
"guc-maintenance-work-mem" xreflabel=
"maintenance_work_mem">
838 <term><varname>maintenance_work_mem
</varname> (
<type>integer
</type>)
</term>
840 <primary><varname>maintenance_work_mem<
/> configuration parameter
</primary>
844 Specifies the maximum amount of memory to be used in maintenance
845 operations, such as
<command>VACUUM
</command>,
<command>CREATE
846 INDEX<
/>, and
<command>ALTER TABLE ADD FOREIGN KEY<
/>. It defaults
847 to
16 megabytes (
<literal>16MB<
/>). Since only one of these
848 operations can be executed at a time by a database session, and
849 an installation normally doesn't have many of them running
850 concurrently, it's safe to set this value significantly larger
851 than
<varname>work_mem
</varname>. Larger settings might improve
852 performance for vacuuming and for restoring database dumps.
855 Note that when autovacuum runs, up to
856 <xref linkend=
"guc-autovacuum-max-workers"> times this memory may be
857 allocated, so be careful not to set the default value too high.
862 <varlistentry id=
"guc-max-stack-depth" xreflabel=
"max_stack_depth">
863 <term><varname>max_stack_depth
</varname> (
<type>integer
</type>)
</term>
865 <primary><varname>max_stack_depth<
/> configuration parameter
</primary>
869 Specifies the maximum safe depth of the server's execution stack.
870 The ideal setting for this parameter is the actual stack size limit
871 enforced by the kernel (as set by
<literal>ulimit -s<
/> or local
872 equivalent), less a safety margin of a megabyte or so. The safety
873 margin is needed because the stack depth is not checked in every
874 routine in the server, but only in key potentially-recursive routines
875 such as expression evaluation. The default setting is two
876 megabytes (
<literal>2MB<
/>), which is conservatively small and
877 unlikely to risk crashes. However, it might be too small to allow
878 execution of complex functions. Only superusers can change this
883 Setting
<varname>max_stack_depth<
/> higher than
884 the actual kernel limit will mean that a runaway recursive function
885 can crash an individual backend process. On platforms where
886 <productname>PostgreSQL
</productname> can determine the kernel limit,
887 it will not let you set this variable to an unsafe value. However,
888 not all platforms provide the information, so caution is recommended
889 in selecting a value.
897 <sect2 id=
"runtime-config-resource-kernel">
898 <title>Kernel Resource Usage
</title>
901 <varlistentry id=
"guc-max-files-per-process" xreflabel=
"max_files_per_process">
902 <term><varname>max_files_per_process
</varname> (
<type>integer
</type>)
</term>
904 <primary><varname>max_files_per_process<
/> configuration parameter
</primary>
908 Sets the maximum number of simultaneously open files allowed to each
909 server subprocess. The default is one thousand files. If the kernel is enforcing
910 a safe per-process limit, you don't need to worry about this setting.
911 But on some platforms (notably, most BSD systems), the kernel will
912 allow individual processes to open many more files than the system
913 can really support when a large number of processes all try to open
914 that many files. If you find yourself seeing
<quote>Too many open
915 files<
/> failures, try reducing this setting.
916 This parameter can only be set at server start.
921 <varlistentry id=
"guc-shared-preload-libraries" xreflabel=
"shared_preload_libraries">
922 <term><varname>shared_preload_libraries
</varname> (
<type>string
</type>)
</term>
924 <primary><varname>shared_preload_libraries<
/> configuration parameter
</primary>
928 This variable specifies one or more shared libraries that are
929 to be preloaded at server start. If more than one library is to be
930 loaded, separate their names with commas. For example,
931 <literal>'$libdir/mylib'
</literal> would cause
932 <literal>mylib.so<
/> (or on some platforms,
933 <literal>mylib.sl<
/>) to be preloaded from the installation's
934 standard library directory.
935 This parameter can only be set at server start.
939 <productname>PostgreSQL
</productname> procedural language
940 libraries can be preloaded in this way, typically by using the
941 syntax
<literal>'$libdir/plXXX'
</literal> where
942 <literal>XXX
</literal> is
<literal>pgsql<
/>,
<literal>perl<
/>,
943 <literal>tcl<
/>, or
<literal>python<
/>.
947 By preloading a shared library, the library startup time is avoided
948 when the library is first used. However, the time to start each new
949 server process might increase slightly, even if that process never
950 uses the library. So this parameter is recommended only for
951 libraries that will be used in most sessions.
956 On Windows hosts, preloading a library at server start will not reduce
957 the time required to start each new server process; each server process
958 will re-load all preload libraries. However,
<varname>shared_preload_libraries
959 </varname> is still useful on Windows hosts because some shared libraries may
960 need to perform certain operations that only take place at postmaster start
961 (for example, a shared library may need to reserve lightweight locks
962 or shared memory and you can't do that after the postmaster has started).
966 If a specified library is not found,
967 the server will fail to start.
971 Every PostgreSQL-supported library has a
<quote>magic
972 block<
/> that is checked to guarantee compatibility.
973 For this reason, non-PostgreSQL libraries cannot be
982 <sect2 id=
"runtime-config-resource-vacuum-cost">
983 <title id=
"runtime-config-resource-vacuum-cost-title">
984 Cost-Based Vacuum Delay
988 During the execution of
<xref linkend=
"sql-vacuum"
989 endterm=
"sql-vacuum-title"> and
<xref linkend=
"sql-analyze"
990 endterm=
"sql-analyze-title"> commands, the system maintains an
991 internal counter that keeps track of the estimated cost of the
992 various I/O operations that are performed. When the accumulated
993 cost reaches a limit (specified by
994 <varname>vacuum_cost_limit
</varname>), the process performing
995 the operation will sleep for a while (specified by
996 <varname>vacuum_cost_delay
</varname>). Then it will reset the
997 counter and continue execution.
1001 The intent of this feature is to allow administrators to reduce
1002 the I/O impact of these commands on concurrent database
1003 activity. There are many situations in which it is not very
1004 important that maintenance commands like
1005 <command>VACUUM
</command> and
<command>ANALYZE
</command> finish
1006 quickly; however, it is usually very important that these
1007 commands do not significantly interfere with the ability of the
1008 system to perform other database operations. Cost-based vacuum
1009 delay provides a way for administrators to achieve this.
1013 This feature is disabled by default for manually issued
1014 <command>VACUUM
</command> commands. To enable it, set the
1015 <varname>vacuum_cost_delay
</varname> variable to a nonzero
1020 <varlistentry id=
"guc-vacuum-cost-delay" xreflabel=
"vacuum_cost_delay">
1021 <term><varname>vacuum_cost_delay
</varname> (
<type>integer
</type>)
</term>
1023 <primary><varname>vacuum_cost_delay<
/> configuration parameter
</primary>
1027 The length of time, in milliseconds, that the process will sleep
1028 when the cost limit has been exceeded.
1029 The default value is zero, which disables the cost-based vacuum
1030 delay feature. Positive values enable cost-based vacuuming.
1031 Note that on many systems, the effective resolution
1032 of sleep delays is
10 milliseconds; setting
1033 <varname>vacuum_cost_delay
</varname> to a value that is
1034 not a multiple of
10 might have the same results as setting it
1035 to the next higher multiple of
10.
1039 When using cost-based vacuuming, appropriate values for
1040 <varname>vacuum_cost_delay<
/> are usually quite small, perhaps
1041 10 or
20 milliseconds. Adjusting vacuum's resource consumption
1042 is best done by changing the other vacuum cost parameters.
1047 <varlistentry id=
"guc-vacuum-cost-page-hit" xreflabel=
"vacuum_cost_page_hit">
1048 <term><varname>vacuum_cost_page_hit
</varname> (
<type>integer
</type>)
</term>
1050 <primary><varname>vacuum_cost_page_hit<
/> configuration parameter
</primary>
1054 The estimated cost for vacuuming a buffer found in the shared buffer
1055 cache. It represents the cost to lock the buffer pool, lookup
1056 the shared hash table and scan the content of the page. The
1057 default value is one.
1062 <varlistentry id=
"guc-vacuum-cost-page-miss" xreflabel=
"vacuum_cost_page_miss">
1063 <term><varname>vacuum_cost_page_miss
</varname> (
<type>integer
</type>)
</term>
1065 <primary><varname>vacuum_cost_page_miss<
/> configuration parameter
</primary>
1069 The estimated cost for vacuuming a buffer that has to be read from
1070 disk. This represents the effort to lock the buffer pool,
1071 lookup the shared hash table, read the desired block in from
1072 the disk and scan its content. The default value is
10.
1077 <varlistentry id=
"guc-vacuum-cost-page-dirty" xreflabel=
"vacuum_cost_page_dirty">
1078 <term><varname>vacuum_cost_page_dirty
</varname> (
<type>integer
</type>)
</term>
1080 <primary><varname>vacuum_cost_page_dirty<
/> configuration parameter
</primary>
1084 The estimated cost charged when vacuum modifies a block that was
1085 previously clean. It represents the extra I/O required to
1086 flush the dirty block out to disk again. The default value is
1092 <varlistentry id=
"guc-vacuum-cost-limit" xreflabel=
"vacuum_cost_limit">
1093 <term><varname>vacuum_cost_limit
</varname> (
<type>integer
</type>)
</term>
1095 <primary><varname>vacuum_cost_limit<
/> configuration parameter
</primary>
1099 The accumulated cost that will cause the vacuuming process to sleep.
1100 The default value is
200.
1108 There are certain operations that hold critical locks and should
1109 therefore complete as quickly as possible. Cost-based vacuum
1110 delays do not occur during such operations. Therefore it is
1111 possible that the cost accumulates far higher than the specified
1112 limit. To avoid uselessly long delays in such cases, the actual
1113 delay is calculated as
<varname>vacuum_cost_delay
</varname> *
1114 <varname>accumulated_balance
</varname> /
1115 <varname>vacuum_cost_limit
</varname> with a maximum of
1116 <varname>vacuum_cost_delay
</varname> *
4.
1121 <sect2 id=
"runtime-config-resource-background-writer">
1122 <title>Background Writer
</title>
1125 There is a separate server
1126 process called the
<firstterm>background writer<
/>, whose function
1127 is to issue writes of
<quote>dirty<
/> shared buffers. The intent is
1128 that server processes handling user queries should seldom or never have
1129 to wait for a write to occur, because the background writer will do it.
1130 However there is a net overall
1131 increase in I/O load, because a repeatedly-dirtied page might
1132 otherwise be written only once per checkpoint interval, but the
1133 background writer might write it several times in the same interval.
1134 The parameters discussed in this subsection can be used to
1135 tune the behavior for local needs.
1139 <varlistentry id=
"guc-bgwriter-delay" xreflabel=
"bgwriter_delay">
1140 <term><varname>bgwriter_delay
</varname> (
<type>integer
</type>)
</term>
1142 <primary><varname>bgwriter_delay<
/> configuration parameter
</primary>
1146 Specifies the delay between activity rounds for the
1147 background writer. In each round the writer issues writes
1148 for some number of dirty buffers (controllable by the
1149 following parameters). It then sleeps for
<varname>bgwriter_delay<
/>
1150 milliseconds, and repeats. The default value is
200 milliseconds
1151 (
<literal>200ms<
/>). Note that on many systems, the effective
1152 resolution of sleep delays is
10 milliseconds; setting
1153 <varname>bgwriter_delay<
/> to a value that is not a multiple of
1154 10 might have the same results as setting it to the next higher
1155 multiple of
10. This parameter can only be set in the
1156 <filename>postgresql.conf<
/> file or on the server command line.
1161 <varlistentry id=
"guc-bgwriter-lru-maxpages" xreflabel=
"bgwriter_lru_maxpages">
1162 <term><varname>bgwriter_lru_maxpages
</varname> (
<type>integer
</type>)
</term>
1164 <primary><varname>bgwriter_lru_maxpages<
/> configuration parameter
</primary>
1168 In each round, no more than this many buffers will be written
1169 by the background writer. Setting this to zero disables
1170 background writing (except for checkpoint activity).
1171 The default value is
100 buffers.
1172 This parameter can only be set in the
<filename>postgresql.conf<
/>
1173 file or on the server command line.
1178 <varlistentry id=
"guc-bgwriter-lru-multiplier" xreflabel=
"bgwriter_lru_multiplier">
1179 <term><varname>bgwriter_lru_multiplier
</varname> (
<type>floating point
</type>)
</term>
1181 <primary><varname>bgwriter_lru_multiplier<
/> configuration parameter
</primary>
1185 The number of dirty buffers written in each round is based on the
1186 number of new buffers that have been needed by server processes
1187 during recent rounds. The average recent need is multiplied by
1188 <varname>bgwriter_lru_multiplier<
/> to arrive at an estimate of the
1189 number of buffers that will be needed during the next round. Dirty
1190 buffers are written until there are that many clean, reusable buffers
1191 available. (However, no more than
<varname>bgwriter_lru_maxpages<
/>
1192 buffers will be written per round.)
1193 Thus, a setting of
1.0 represents a
<quote>just in time<
/> policy
1194 of writing exactly the number of buffers predicted to be needed.
1195 Larger values provide some cushion against spikes in demand,
1196 while smaller values intentionally leave writes to be done by
1199 This parameter can only be set in the
<filename>postgresql.conf<
/>
1200 file or on the server command line.
1207 Smaller values of
<varname>bgwriter_lru_maxpages
</varname> and
1208 <varname>bgwriter_lru_multiplier
</varname> reduce the extra I/O load
1209 caused by the background writer, but make it more likely that server
1210 processes will have to issue writes for themselves, delaying interactive
1215 <sect2 id=
"runtime-config-resource-async-behavior">
1216 <title>Asynchronous Behavior
</title>
1219 <varlistentry id=
"guc-effective-io-concurrency" xreflabel=
"effective_io_concurrency">
1220 <term><varname>effective_io_concurrency
</varname> (
<type>integer
</type>)
</term>
1222 <primary><varname>effective_io_concurrency<
/> configuration parameter
</primary>
1226 Sets the number of concurrent disk I/O operations that
1227 <productname>PostgreSQL<
/> expects can be executed
1228 simultaneously. Raising this value will increase the number of I/O
1229 operations that any individual
<productname>PostgreSQL<
/> session
1230 attempts to initiate in parallel. The allowed range is
1 to
1000,
1231 or zero to disable issuance of asynchronous I/O requests.
1235 A good starting point for this setting is the number of separate
1236 drives comprising a RAID
0 stripe or RAID
1 mirror being used for the
1237 database. (For RAID
5 the parity drive should not be counted.)
1238 However, if the database is often busy with multiple queries issued in
1239 concurrent sessions, lower values may be sufficient to keep the disk
1240 array busy. A value higher than needed to keep the disks busy will
1241 only result in extra CPU overhead.
1245 For more exotic systems, such as memory-based storage or a RAID array
1246 that is limited by bus bandwidth, the correct value might be the
1247 number of I/O paths available. Some experimentation may be needed
1248 to find the best value.
1252 Asynchronous I/O depends on an effective
<function>posix_fadvise<
/>
1253 function, which some operating systems lack. If the function is not
1254 present then setting this parameter to anything but zero will result
1255 in an error. On some operating systems (e.g., Solaris), the function
1256 is present but does not actually do anything.
1264 <sect1 id=
"runtime-config-wal">
1265 <title>Write Ahead Log
</title>
1268 See also
<xref linkend=
"wal-configuration"> for details on WAL
1269 and checkpoint tuning.
1272 <sect2 id=
"runtime-config-wal-settings">
1273 <title>Settings
</title>
1276 <varlistentry id=
"guc-fsync" xreflabel=
"fsync">
1278 <primary><varname>fsync<
/> configuration parameter
</primary>
1280 <term><varname>fsync
</varname> (
<type>boolean
</type>)
</term>
1283 If this parameter is on, the
<productname>PostgreSQL<
/> server
1284 will try to make sure that updates are physically written to
1285 disk, by issuing
<function>fsync()<
/> system calls or various
1286 equivalent methods (see
<xref linkend=
"guc-wal-sync-method">).
1287 This ensures that the database cluster can recover to a
1288 consistent state after an operating system or hardware crash.
1292 However, using
<varname>fsync
</varname> results in a
1293 performance penalty: when a transaction is committed,
1294 <productname>PostgreSQL
</productname> must wait for the
1295 operating system to flush the write-ahead log to disk. When
1296 <varname>fsync
</varname> is disabled, the operating system is
1297 allowed to do its best in buffering, ordering, and delaying
1298 writes. This can result in significantly improved performance.
1299 However, if the system crashes, the results of the last few
1300 committed transactions might be lost in part or whole. In the
1301 worst case, unrecoverable data corruption might occur.
1302 (Crashes of the database software itself are
<emphasis>not<
/>
1303 a risk factor here. Only an operating-system-level crash
1304 creates a risk of corruption.)
1308 Due to the risks involved, there is no universally correct
1309 setting for
<varname>fsync
</varname>. Some administrators
1310 always disable
<varname>fsync
</varname>, while others only
1311 turn it off during initial bulk data loads, where there is a clear
1312 restart point if something goes wrong. Others
1313 always leave
<varname>fsync
</varname> enabled. The default is
1314 to enable
<varname>fsync
</varname>, for maximum reliability.
1315 If you trust your operating system, your hardware, and your
1316 utility company (or your battery backup), you can consider
1317 disabling
<varname>fsync
</varname>.
1321 In many situations, turning off
<xref linkend=
"guc-synchronous-commit">
1322 for noncritical transactions can provide much of the potential
1323 performance benefit of turning off
<varname>fsync
</varname>, without
1324 the attendant risks of data corruption.
1328 This parameter can only be set in the
<filename>postgresql.conf<
/>
1329 file or on the server command line.
1330 If you turn this parameter off, also consider turning off
1331 <xref linkend=
"guc-full-page-writes">.
1336 <varlistentry id=
"guc-synchronous-commit" xreflabel=
"synchronous_commit">
1337 <term><varname>synchronous_commit
</varname> (
<type>boolean
</type>)
</term>
1339 <primary><varname>synchronous_commit<
/> configuration parameter
</primary>
1343 Specifies whether transaction commit will wait for WAL records
1344 to be written to disk before the command returns a
<quote>success<
/>
1345 indication to the client. The default, and safe, setting is
1346 <literal>on<
/>. When
<literal>off<
/>, there can be a delay between
1347 when success is reported to the client and when the transaction is
1348 really guaranteed to be safe against a server crash. (The maximum
1349 delay is three times
<xref linkend=
"guc-wal-writer-delay">.) Unlike
1350 <xref linkend=
"guc-fsync">, setting this parameter to
<literal>off<
/>
1351 does not create any risk of database inconsistency: a crash might
1352 result in some recent allegedly-committed transactions being lost, but
1353 the database state will be just the same as if those transactions had
1354 been aborted cleanly. So, turning
<varname>synchronous_commit<
/> off
1355 can be a useful alternative when performance is more important than
1356 exact certainty about the durability of a transaction. For more
1357 discussion see
<xref linkend=
"wal-async-commit">.
1360 This parameter can be changed at any time; the behavior for any
1361 one transaction is determined by the setting in effect when it
1362 commits. It is therefore possible, and useful, to have some
1363 transactions commit synchronously and others asynchronously.
1364 For example, to make a single multi-statement transaction commit
1365 asynchronously when the default is the opposite, issue
<command>SET
1366 LOCAL synchronous_commit TO OFF<
/> within the transaction.
1371 <varlistentry id=
"guc-wal-sync-method" xreflabel=
"wal_sync_method">
1372 <term><varname>wal_sync_method
</varname> (
<type>enum
</type>)
</term>
1374 <primary><varname>wal_sync_method<
/> configuration parameter
</primary>
1378 Method used for forcing WAL updates out to disk.
1379 If
<varname>fsync
</varname> is off then this setting is irrelevant,
1380 since updates will not be forced out at all.
1381 Possible values are:
1386 <literal>open_datasync<
/> (write WAL files with
<function>open()<
/> option
<symbol>O_DSYNC<
/>)
1391 <literal>fdatasync<
/> (call
<function>fdatasync()<
/> at each commit)
1396 <literal>fsync_writethrough<
/> (call
<function>fsync()<
/> at each commit, forcing write-through of any disk write cache)
1401 <literal>fsync<
/> (call
<function>fsync()<
/> at each commit)
1406 <literal>open_sync<
/> (write WAL files with
<function>open()<
/> option
<symbol>O_SYNC<
/>)
1411 Not all of these choices are available on all platforms.
1412 The default is the first method in the above list that is supported
1414 The
<literal>open_<
/>* options also use
<literal>O_DIRECT<
/> if available.
1415 This parameter can only be set in the
<filename>postgresql.conf<
/>
1416 file or on the server command line.
1421 <varlistentry id=
"guc-full-page-writes" xreflabel=
"full_page_writes">
1423 <primary><varname>full_page_writes<
/> configuration parameter
</primary>
1425 <term><varname>full_page_writes
</varname> (
<type>boolean
</type>)
</term>
1428 When this parameter is on, the
<productname>PostgreSQL<
/> server
1429 writes the entire content of each disk page to WAL during the
1430 first modification of that page after a checkpoint.
1431 This is needed because
1432 a page write that is in process during an operating system crash might
1433 be only partially completed, leading to an on-disk page
1434 that contains a mix of old and new data. The row-level change data
1435 normally stored in WAL will not be enough to completely restore
1436 such a page during post-crash recovery. Storing the full page image
1437 guarantees that the page can be correctly restored, but at a price
1438 in increasing the amount of data that must be written to WAL.
1439 (Because WAL replay always starts from a checkpoint, it is sufficient
1440 to do this during the first change of each page after a checkpoint.
1441 Therefore, one way to reduce the cost of full-page writes is to
1442 increase the checkpoint interval parameters.)
1446 Turning this parameter off speeds normal operation, but
1447 might lead to a corrupt database after an operating system crash
1448 or power failure. The risks are similar to turning off
1449 <varname>fsync<
/>, though smaller. It might be safe to turn off
1450 this parameter if you have hardware (such as a battery-backed disk
1451 controller) or file-system software that reduces
1452 the risk of partial page writes to an acceptably low level (e.g., ReiserFS
4).
1456 Turning off this parameter does not affect use of
1457 WAL archiving for point-in-time recovery (PITR)
1458 (see
<xref linkend=
"continuous-archiving">).
1462 This parameter can only be set in the
<filename>postgresql.conf<
/>
1463 file or on the server command line.
1464 The default is
<literal>on<
/>.
1469 <varlistentry id=
"guc-wal-buffers" xreflabel=
"wal_buffers">
1470 <term><varname>wal_buffers
</varname> (
<type>integer
</type>)
</term>
1472 <primary><varname>wal_buffers<
/> configuration parameter
</primary>
1476 The amount of memory used in shared memory for WAL data. The
1477 default is
64 kilobytes (
<literal>64kB<
/>). The setting need only
1478 be large enough to hold the amount of WAL data generated by one
1479 typical transaction, since the data is written out to disk at
1480 every transaction commit. This parameter can only be set at server
1485 Increasing this parameter might cause
<productname>PostgreSQL<
/>
1486 to request more
<systemitem class=
"osname">System V<
/> shared
1487 memory than your operating system's default configuration
1488 allows. See
<xref linkend=
"sysvipc"> for information on how to
1489 adjust those parameters, if necessary.
1494 <varlistentry id=
"guc-wal-writer-delay" xreflabel=
"wal_writer_delay">
1495 <term><varname>wal_writer_delay
</varname> (
<type>integer
</type>)
</term>
1497 <primary><varname>wal_writer_delay<
/> configuration parameter
</primary>
1501 Specifies the delay between activity rounds for the WAL writer.
1502 In each round the writer will flush WAL to disk. It then sleeps for
1503 <varname>wal_writer_delay<
/> milliseconds, and repeats. The default
1504 value is
200 milliseconds (
<literal>200ms<
/>). Note that on many
1505 systems, the effective resolution of sleep delays is
10 milliseconds;
1506 setting
<varname>wal_writer_delay<
/> to a value that is not a multiple
1507 of
10 might have the same results as setting it to the next higher
1508 multiple of
10. This parameter can only be set in the
1509 <filename>postgresql.conf<
/> file or on the server command line.
1514 <varlistentry id=
"guc-commit-delay" xreflabel=
"commit_delay">
1515 <term><varname>commit_delay
</varname> (
<type>integer
</type>)
</term>
1517 <primary><varname>commit_delay<
/> configuration parameter
</primary>
1521 Time delay between writing a commit record to the WAL buffer
1522 and flushing the buffer out to disk, in microseconds. A
1523 nonzero delay can allow multiple transactions to be committed
1524 with only one
<function>fsync()
</function> system call, if
1525 system load is high enough that additional transactions become
1526 ready to commit within the given interval. But the delay is
1527 just wasted if no other transactions become ready to
1528 commit. Therefore, the delay is only performed if at least
1529 <varname>commit_siblings
</varname> other transactions are
1530 active at the instant that a server process has written its
1531 commit record. The default is zero (no delay).
1536 <varlistentry id=
"guc-commit-siblings" xreflabel=
"commit_siblings">
1537 <term><varname>commit_siblings
</varname> (
<type>integer
</type>)
</term>
1539 <primary><varname>commit_siblings<
/> configuration parameter
</primary>
1543 Minimum number of concurrent open transactions to require
1544 before performing the
<varname>commit_delay<
/> delay. A larger
1545 value makes it more probable that at least one other
1546 transaction will become ready to commit during the delay
1547 interval. The default is five transactions.
1554 <sect2 id=
"runtime-config-wal-checkpoints">
1555 <title>Checkpoints
</title>
1558 <varlistentry id=
"guc-checkpoint-segments" xreflabel=
"checkpoint_segments">
1559 <term><varname>checkpoint_segments
</varname> (
<type>integer
</type>)
</term>
1561 <primary><varname>checkpoint_segments<
/> configuration parameter
</primary>
1565 Maximum number of log file segments between automatic WAL
1566 checkpoints (each segment is normally
16 megabytes). The default
1567 is three segments. Increasing this parameter can increase the
1568 amount of time needed for crash recovery.
1569 This parameter can only be set in the
<filename>postgresql.conf<
/>
1570 file or on the server command line.
1575 <varlistentry id=
"guc-checkpoint-timeout" xreflabel=
"checkpoint_timeout">
1576 <term><varname>checkpoint_timeout
</varname> (
<type>integer
</type>)
</term>
1578 <primary><varname>checkpoint_timeout<
/> configuration parameter
</primary>
1582 Maximum time between automatic WAL checkpoints, in
1583 seconds. The default is five minutes (
<literal>5min<
/>).
1584 Increasing this parameter can increase the amount of time needed
1586 This parameter can only be set in the
<filename>postgresql.conf<
/>
1587 file or on the server command line.
1592 <varlistentry id=
"guc-checkpoint-completion-target" xreflabel=
"checkpoint_completion_target">
1593 <term><varname>checkpoint_completion_target
</varname> (
<type>floating point
</type>)
</term>
1595 <primary><varname>checkpoint_completion_target<
/> configuration parameter
</primary>
1599 Specifies the target length of checkpoints, as a fraction of
1600 the checkpoint interval. The default is
0.5.
1602 This parameter can only be set in the
<filename>postgresql.conf<
/>
1603 file or on the server command line.
1608 <varlistentry id=
"guc-checkpoint-warning" xreflabel=
"checkpoint_warning">
1609 <term><varname>checkpoint_warning
</varname> (
<type>integer
</type>)
</term>
1611 <primary><varname>checkpoint_warning<
/> configuration parameter
</primary>
1615 Write a message to the server log if checkpoints caused by
1616 the filling of checkpoint segment files happen closer together
1617 than this many seconds (which suggests that
1618 <varname>checkpoint_segments<
/> ought to be raised). The default is
1619 30 seconds (
<literal>30s<
/>). Zero disables the warning.
1620 This parameter can only be set in the
<filename>postgresql.conf<
/>
1621 file or on the server command line.
1628 <sect2 id=
"runtime-config-wal-archiving">
1629 <title>Archiving
</title>
1632 <varlistentry id=
"guc-archive-mode" xreflabel=
"archive_mode">
1633 <term><varname>archive_mode
</varname> (
<type>boolean
</type>)
</term>
1635 <primary><varname>archive_mode<
/> configuration parameter
</primary>
1639 When
<varname>archive_mode<
/> is enabled, completed WAL segments
1640 can be sent to archive storage by setting
1641 <xref linkend=
"guc-archive-command">.
1642 <varname>archive_mode<
/> and
<varname>archive_command<
/> are
1643 separate variables so that
<varname>archive_command<
/> can be
1644 changed without leaving archiving mode.
1645 This parameter can only be set at server start.
1650 <varlistentry id=
"guc-archive-command" xreflabel=
"archive_command">
1651 <term><varname>archive_command
</varname> (
<type>string
</type>)
</term>
1653 <primary><varname>archive_command<
/> configuration parameter
</primary>
1657 The shell command to execute to archive a completed segment of
1658 the WAL file series. Any
<literal>%p<
/> in the string is
1659 replaced by the path name of the file to archive, and any
1660 <literal>%f<
/> is replaced by the file name only.
1661 (The path name is relative to the working directory of the server,
1662 i.e., the cluster's data directory.)
1663 Use
<literal>%%<
/> to embed an actual
<literal>%<
/> character in the
1664 command. For more information see
<xref
1665 linkend=
"backup-archiving-wal">.
1666 This parameter can only be set in the
<filename>postgresql.conf<
/>
1667 file or on the server command line. It is ignored unless
1668 <varname>archive_mode<
/> was enabled at server start.
1669 If
<varname>archive_command<
/> is an empty string (the default) while
1670 <varname>archive_mode<
/> is enabled, then WAL archiving is temporarily
1671 disabled, but the server continues to accumulate WAL segment files in
1672 the expectation that a command will soon be provided.
1675 It is important for the command to return a zero exit status if
1676 and only if it succeeds. Examples:
1678 archive_command = 'cp
"%p" /mnt/server/archivedir/
"%f"'
1679 archive_command = 'copy
"%p" "C:\\server\\archivedir\\%f"' # Windows
1685 <varlistentry id=
"guc-archive-timeout" xreflabel=
"archive_timeout">
1686 <term><varname>archive_timeout
</varname> (
<type>integer
</type>)
</term>
1688 <primary><varname>archive_timeout<
/> configuration parameter
</primary>
1692 The
<xref linkend=
"guc-archive-command"> is only invoked on
1693 completed WAL segments. Hence, if your server generates little WAL
1694 traffic (or has slack periods where it does so), there could be a
1695 long delay between the completion of a transaction and its safe
1696 recording in archive storage. To put a limit on how old unarchived
1697 data can be, you can set
<varname>archive_timeout<
/> to force the
1698 server to switch to a new WAL segment file periodically. When this
1699 parameter is greater than zero, the server will switch to a new
1700 segment file whenever this many seconds have elapsed since the last
1701 segment file switch. Note that archived files that are closed early
1702 due to a forced switch are still the same length as completely full
1703 files. Therefore, it is unwise to use a very short
1704 <varname>archive_timeout<
/> — it will bloat your archive
1705 storage.
<varname>archive_timeout<
/> settings of a minute or so are
1706 usually reasonable. This parameter can only be set in the
1707 <filename>postgresql.conf<
/> file or on the server command line.
1716 <sect1 id=
"runtime-config-query">
1717 <title>Query Planning
</title>
1719 <sect2 id=
"runtime-config-query-enable">
1720 <title>Planner Method Configuration
</title>
1723 These configuration parameters provide a crude method of
1724 influencing the query plans chosen by the query optimizer. If
1725 the default plan chosen by the optimizer for a particular query
1726 is not optimal, a temporary solution can be found by using one
1727 of these configuration parameters to force the optimizer to
1728 choose a different plan. Turning one of these settings off
1729 permanently is seldom a good idea, however.
1730 Better ways to improve the quality of the
1731 plans chosen by the optimizer include adjusting the
<xref
1732 linkend=
"runtime-config-query-constants"
1733 endterm=
"runtime-config-query-constants-title">, running
<xref
1734 linkend=
"sql-analyze" endterm=
"sql-analyze-title"> more
1735 frequently, increasing the value of the
<xref
1736 linkend=
"guc-default-statistics-target"> configuration parameter,
1737 and increasing the amount of statistics collected for
1738 specific columns using
<command>ALTER TABLE SET
1739 STATISTICS
</command>.
1743 <varlistentry id=
"guc-enable-bitmapscan" xreflabel=
"enable_bitmapscan">
1744 <term><varname>enable_bitmapscan
</varname> (
<type>boolean
</type>)
</term>
1746 <primary>bitmap scan
</primary>
1749 <primary><varname>enable_bitmapscan<
/> configuration parameter
</primary>
1753 Enables or disables the query planner's use of bitmap-scan plan
1754 types. The default is
<literal>on<
/>.
1759 <varlistentry id=
"guc-enable-hashagg" xreflabel=
"enable_hashagg">
1760 <term><varname>enable_hashagg
</varname> (
<type>boolean
</type>)
</term>
1762 <primary><varname>enable_hashagg<
/> configuration parameter
</primary>
1766 Enables or disables the query planner's use of hashed
1767 aggregation plan types. The default is
<literal>on<
/>.
1772 <varlistentry id=
"guc-enable-hashjoin" xreflabel=
"enable_hashjoin">
1773 <term><varname>enable_hashjoin
</varname> (
<type>boolean
</type>)
</term>
1775 <primary><varname>enable_hashjoin<
/> configuration parameter
</primary>
1779 Enables or disables the query planner's use of hash-join plan
1780 types. The default is
<literal>on<
/>.
1785 <varlistentry id=
"guc-enable-indexscan" xreflabel=
"enable_indexscan">
1786 <term><varname>enable_indexscan
</varname> (
<type>boolean
</type>)
</term>
1788 <primary>index scan
</primary>
1791 <primary><varname>enable_indexscan<
/> configuration parameter
</primary>
1795 Enables or disables the query planner's use of index-scan plan
1796 types. The default is
<literal>on<
/>.
1801 <varlistentry id=
"guc-enable-mergejoin" xreflabel=
"enable_mergejoin">
1802 <term><varname>enable_mergejoin
</varname> (
<type>boolean
</type>)
</term>
1804 <primary><varname>enable_mergejoin<
/> configuration parameter
</primary>
1808 Enables or disables the query planner's use of merge-join plan
1809 types. The default is
<literal>on<
/>.
1814 <varlistentry id=
"guc-enable-nestloop" xreflabel=
"enable_nestloop">
1815 <term><varname>enable_nestloop
</varname> (
<type>boolean
</type>)
</term>
1817 <primary><varname>enable_nestloop<
/> configuration parameter
</primary>
1821 Enables or disables the query planner's use of nested-loop join
1822 plans. It's not possible to suppress nested-loop joins entirely,
1823 but turning this variable off discourages the planner from using
1824 one if there are other methods available. The default is
1830 <varlistentry id=
"guc-enable-seqscan" xreflabel=
"enable_seqscan">
1831 <term><varname>enable_seqscan
</varname> (
<type>boolean
</type>)
</term>
1833 <primary>sequential scan
</primary>
1836 <primary><varname>enable_seqscan<
/> configuration parameter
</primary>
1840 Enables or disables the query planner's use of sequential scan
1841 plan types. It's not possible to suppress sequential scans
1842 entirely, but turning this variable off discourages the planner
1843 from using one if there are other methods available. The
1844 default is
<literal>on<
/>.
1849 <varlistentry id=
"guc-enable-sort" xreflabel=
"enable_sort">
1850 <term><varname>enable_sort
</varname> (
<type>boolean
</type>)
</term>
1852 <primary><varname>enable_sort<
/> configuration parameter
</primary>
1856 Enables or disables the query planner's use of explicit sort
1857 steps. It's not possible to suppress explicit sorts entirely,
1858 but turning this variable off discourages the planner from
1859 using one if there are other methods available. The default
1865 <varlistentry id=
"guc-enable-tidscan" xreflabel=
"enable_tidscan">
1866 <term><varname>enable_tidscan
</varname> (
<type>boolean
</type>)
</term>
1868 <primary><varname>enable_tidscan<
/> configuration parameter
</primary>
1872 Enables or disables the query planner's use of
<acronym>TID<
/>
1873 scan plan types. The default is
<literal>on<
/>.
1880 <sect2 id=
"runtime-config-query-constants">
1881 <title id=
"runtime-config-query-constants-title">
1882 Planner Cost Constants
1886 The
<firstterm>cost<
/> variables described in this section are measured
1887 on an arbitrary scale. Only their relative values matter, hence
1888 scaling them all up or down by the same factor will result in no change
1889 in the planner's choices. Traditionally, these variables have been
1890 referenced to sequential page fetches as the unit of cost; that is,
1891 <varname>seq_page_cost<
/> is conventionally set to
<literal>1.0<
/>
1892 and the other cost variables are set with reference to that. But
1893 you can use a different scale if you prefer, such as actual execution
1894 times in milliseconds on a particular machine.
1899 Unfortunately, there is no well-defined method for determining ideal
1900 values for the cost variables. They are best treated as averages over
1901 the entire mix of queries that a particular installation will get. This
1902 means that changing them on the basis of just a few experiments is very
1909 <varlistentry id=
"guc-seq-page-cost" xreflabel=
"seq_page_cost">
1910 <term><varname>seq_page_cost
</varname> (
<type>floating point
</type>)
</term>
1912 <primary><varname>seq_page_cost<
/> configuration parameter
</primary>
1916 Sets the planner's estimate of the cost of a disk page fetch
1917 that is part of a series of sequential fetches. The default is
1.0.
1922 <varlistentry id=
"guc-random-page-cost" xreflabel=
"random_page_cost">
1923 <term><varname>random_page_cost
</varname> (
<type>floating point
</type>)
</term>
1925 <primary><varname>random_page_cost<
/> configuration parameter
</primary>
1929 Sets the planner's estimate of the cost of a
1930 non-sequentially-fetched disk page. The default is
4.0.
1931 Reducing this value relative to
<varname>seq_page_cost<
/>
1932 will cause the system to prefer index scans; raising it will
1933 make index scans look relatively more expensive. You can raise
1934 or lower both values together to change the importance of disk I/O
1935 costs relative to CPU costs, which are described by the following
1941 Although the system will let you set
<varname>random_page_cost<
/> to
1942 less than
<varname>seq_page_cost<
/>, it is not physically sensible
1943 to do so. However, setting them equal makes sense if the database
1944 is entirely cached in RAM, since in that case there is no penalty
1945 for touching pages out of sequence. Also, in a heavily-cached
1946 database you should lower both values relative to the CPU parameters,
1947 since the cost of fetching a page already in RAM is much smaller
1948 than it would normally be.
1954 <varlistentry id=
"guc-cpu-tuple-cost" xreflabel=
"cpu_tuple_cost">
1955 <term><varname>cpu_tuple_cost
</varname> (
<type>floating point
</type>)
</term>
1957 <primary><varname>cpu_tuple_cost<
/> configuration parameter
</primary>
1961 Sets the planner's estimate of the cost of processing
1962 each row during a query.
1963 The default is
0.01.
1968 <varlistentry id=
"guc-cpu-index-tuple-cost" xreflabel=
"cpu_index_tuple_cost">
1969 <term><varname>cpu_index_tuple_cost
</varname> (
<type>floating point
</type>)
</term>
1971 <primary><varname>cpu_index_tuple_cost<
/> configuration parameter
</primary>
1975 Sets the planner's estimate of the cost of processing
1976 each index entry during an index scan.
1977 The default is
0.005.
1982 <varlistentry id=
"guc-cpu-operator-cost" xreflabel=
"cpu_operator_cost">
1983 <term><varname>cpu_operator_cost
</varname> (
<type>floating point
</type>)
</term>
1985 <primary><varname>cpu_operator_cost<
/> configuration parameter
</primary>
1989 Sets the planner's estimate of the cost of processing each
1990 operator or function executed during a query.
1991 The default is
0.0025.
1996 <varlistentry id=
"guc-effective-cache-size" xreflabel=
"effective_cache_size">
1997 <term><varname>effective_cache_size
</varname> (
<type>integer
</type>)
</term>
1999 <primary><varname>effective_cache_size<
/> configuration parameter
</primary>
2003 Sets the planner's assumption about the effective size of the
2004 disk cache that is available to a single query. This is
2005 factored into estimates of the cost of using an index; a
2006 higher value makes it more likely index scans will be used, a
2007 lower value makes it more likely sequential scans will be
2008 used. When setting this parameter you should consider both
2009 <productname>PostgreSQL
</productname>'s shared buffers and the
2010 portion of the kernel's disk cache that will be used for
2011 <productname>PostgreSQL
</productname> data files. Also, take
2012 into account the expected number of concurrent queries on different
2013 tables, since they will have to share the available
2014 space. This parameter has no effect on the size of shared
2015 memory allocated by
<productname>PostgreSQL
</productname>, nor
2016 does it reserve kernel disk cache; it is used only for estimation
2017 purposes. The default is
128 megabytes (
<literal>128MB<
/>).
2025 <sect2 id=
"runtime-config-query-geqo">
2026 <title>Genetic Query Optimizer
</title>
2029 The genetic query optimizer (GEQO) is an algorithm that does query
2030 planning using heuristic searching. This reduces planning time for
2031 complex queries (those joining many relations), at the cost of producing
2032 plans that are sometimes inferior to those found by the normal
2033 exhaustive-search algorithm. Also, GEQO's searching is randomized and
2034 therefore its plans may vary nondeterministically.
2035 For more information see
<xref linkend=
"geqo">.
2040 <varlistentry id=
"guc-geqo" xreflabel=
"geqo">
2042 <primary>genetic query optimization
</primary>
2045 <primary>GEQO
</primary>
2046 <see>genetic query optimization
</see>
2049 <primary><varname>geqo<
/> configuration parameter
</primary>
2051 <term><varname>geqo
</varname> (
<type>boolean
</type>)
</term>
2054 Enables or disables genetic query optimization.
2055 This is on by default. It is usually best not to turn it off in
2056 production; the
<varname>geqo_threshold
</varname> variable provides a
2057 more granular way to control use of GEQO.
2062 <varlistentry id=
"guc-geqo-threshold" xreflabel=
"geqo_threshold">
2063 <term><varname>geqo_threshold
</varname> (
<type>integer
</type>)
</term>
2065 <primary><varname>geqo_threshold<
/> configuration parameter
</primary>
2069 Use genetic query optimization to plan queries with at least
2070 this many
<literal>FROM<
/> items involved. (Note that a
2071 <literal>FULL OUTER JOIN<
/> construct counts as only one
<literal>FROM<
/>
2072 item.) The default is
12. For simpler queries it is usually best
2073 to use the deterministic, exhaustive planner, but for queries with
2074 many tables the deterministic planner takes too long.
2079 <varlistentry id=
"guc-geqo-effort" xreflabel=
"geqo_effort">
2080 <term><varname>geqo_effort
</varname>
2081 (
<type>integer
</type>)
</term>
2083 <primary><varname>geqo_effort<
/> configuration parameter
</primary>
2087 Controls the trade-off between planning time and query plan
2088 quality in GEQO. This variable must be an integer in the
2089 range from
1 to
10. The default value is five. Larger values
2090 increase the time spent doing query planning, but also
2091 increase the likelihood that an efficient query plan will be
2096 <varname>geqo_effort
</varname> doesn't actually do anything
2097 directly; it is only used to compute the default values for
2098 the other variables that influence GEQO behavior (described
2099 below). If you prefer, you can set the other parameters by
2105 <varlistentry id=
"guc-geqo-pool-size" xreflabel=
"geqo_pool_size">
2106 <term><varname>geqo_pool_size
</varname> (
<type>integer
</type>)
</term>
2108 <primary><varname>geqo_pool_size<
/> configuration parameter
</primary>
2112 Controls the pool size used by GEQO, that is the
2113 number of individuals in the genetic population. It must be
2114 at least two, and useful values are typically
100 to
1000. If
2115 it is set to zero (the default setting) then a suitable
2116 value is chosen based on
<varname>geqo_effort
</varname> and
2117 the number of tables in the query.
2122 <varlistentry id=
"guc-geqo-generations" xreflabel=
"geqo_generations">
2123 <term><varname>geqo_generations
</varname> (
<type>integer
</type>)
</term>
2125 <primary><varname>geqo_generations<
/> configuration parameter
</primary>
2129 Controls the number of generations used by GEQO, that is
2130 the number of iterations of the algorithm. It must
2131 be at least one, and useful values are in the same range as
2132 the pool size. If it is set to zero (the default setting)
2133 then a suitable value is chosen based on
2134 <varname>geqo_pool_size
</varname>.
2139 <varlistentry id=
"guc-geqo-selection-bias" xreflabel=
"geqo_selection_bias">
2140 <term><varname>geqo_selection_bias
</varname> (
<type>floating point
</type>)
</term>
2142 <primary><varname>geqo_selection_bias<
/> configuration parameter
</primary>
2146 Controls the selection bias used by GEQO. The selection bias
2147 is the selective pressure within the population. Values can be
2148 from
1.50 to
2.00; the latter is the default.
2155 <sect2 id=
"runtime-config-query-other">
2156 <title>Other Planner Options
</title>
2160 <varlistentry id=
"guc-default-statistics-target" xreflabel=
"default_statistics_target">
2161 <term><varname>default_statistics_target
</varname> (
<type>integer
</type>)
</term>
2163 <primary><varname>default_statistics_target<
/> configuration parameter
</primary>
2167 Sets the default statistics target for table columns that have
2168 not had a column-specific target set via
<command>ALTER TABLE
2169 SET STATISTICS<
/>. Larger values increase the time needed to
2170 do
<command>ANALYZE<
/>, but might improve the quality of the
2171 planner's estimates. The default is
100. For more information
2172 on the use of statistics by the
<productname>PostgreSQL<
/>
2173 query planner, refer to
<xref linkend=
"planner-stats">.
2178 <varlistentry id=
"guc-constraint-exclusion" xreflabel=
"constraint_exclusion">
2179 <term><varname>constraint_exclusion
</varname> (
<type>enum
</type>)
</term>
2181 <primary>constraint exclusion
</primary>
2184 <primary><varname>constraint_exclusion<
/> configuration parameter
</primary>
2188 Controls the query planner's use of table constraints to
2190 The allowed values of
<varname>constraint_exclusion<
/> are
2191 <literal>on<
/> (examine constraints for all tables),
2192 <literal>off<
/> (never examine constraints), and
2193 <literal>partition<
/> (examine constraints only for inheritance child
2194 tables and
<literal>UNION ALL<
/> subqueries).
2195 <literal>partition<
/> is the default setting.
2199 When this parameter allows it for a particular table, the planner
2200 compares query conditions with the table's
<literal>CHECK<
/>
2201 constraints, and omits scanning tables for which the conditions
2202 contradict the constraints. For example:
2205 CREATE TABLE parent(key integer, ...);
2206 CREATE TABLE child1000(check (key between
1000 and
1999)) INHERITS(parent);
2207 CREATE TABLE child2000(check (key between
2000 and
2999)) INHERITS(parent);
2209 SELECT * FROM parent WHERE key =
2400;
2212 With constraint exclusion enabled, this
<command>SELECT<
/>
2213 will not scan
<structname>child1000<
/> at all. This can
2214 improve performance when inheritance is used to build
2219 Currently, constraint exclusion is enabled by default
2220 only for cases that are often used to implement table partitioning.
2221 Turning it on for all tables imposes extra planning overhead that is
2222 quite noticeable on simple queries, and most often will yield no
2223 benefit for simple queries. If you have no partitioned tables
2224 you might prefer to turn it off entirely.
2228 Refer to
<xref linkend=
"ddl-partitioning-constraint-exclusion"> for
2229 more information on using constraint exclusion and partitioning.
2234 <varlistentry id=
"guc-cursor-tuple-fraction" xreflabel=
"cursor_tuple_fraction">
2235 <term><varname>cursor_tuple_fraction
</varname> (
<type>floating point
</type>)
</term>
2237 <primary><varname>cursor_tuple_fraction<
/> configuration parameter
</primary>
2241 Sets the planner's estimate of the fraction of a cursor's rows that
2242 will be retrieved. The default is
0.1. Smaller values of this
2243 setting bias the planner towards using
<quote>fast start<
/> plans
2244 for cursors, which will retrieve the first few rows quickly while
2245 perhaps taking a long time to fetch all rows. Larger values
2246 put more emphasis on the total estimated time. At the maximum
2247 setting of
1.0, cursors are planned exactly like regular queries,
2248 considering only the total estimated time and not how soon the
2249 first rows might be delivered.
2254 <varlistentry id=
"guc-from-collapse-limit" xreflabel=
"from_collapse_limit">
2255 <term><varname>from_collapse_limit
</varname> (
<type>integer
</type>)
</term>
2257 <primary><varname>from_collapse_limit<
/> configuration parameter
</primary>
2261 The planner will merge sub-queries into upper queries if the
2262 resulting
<literal>FROM
</literal> list would have no more than
2263 this many items. Smaller values reduce planning time but might
2264 yield inferior query plans. The default is eight.
2265 For more information see
<xref linkend=
"explicit-joins">.
2269 Setting this value to
<xref linkend=
"guc-geqo-threshold"> or more
2270 may trigger use of the GEQO planner, resulting in nondeterministic
2271 plans. See
<xref linkend=
"runtime-config-query-geqo">.
2276 <varlistentry id=
"guc-join-collapse-limit" xreflabel=
"join_collapse_limit">
2277 <term><varname>join_collapse_limit
</varname> (
<type>integer
</type>)
</term>
2279 <primary><varname>join_collapse_limit<
/> configuration parameter
</primary>
2283 The planner will rewrite explicit
<literal>JOIN<
/>
2284 constructs (except
<literal>FULL JOIN<
/>s) into lists of
2285 <literal>FROM<
/> items whenever a list of no more than this many items
2286 would result. Smaller values reduce planning time but might
2287 yield inferior query plans.
2291 By default, this variable is set the same as
2292 <varname>from_collapse_limit
</varname>, which is appropriate
2293 for most uses. Setting it to
1 prevents any reordering of
2294 explicit
<literal>JOIN<
/>s. Thus, the explicit join order
2295 specified in the query will be the actual order in which the
2296 relations are joined. The query planner does not always choose
2297 the optimal join order; advanced users can elect to
2298 temporarily set this variable to
1, and then specify the join
2299 order they desire explicitly.
2300 For more information see
<xref linkend=
"explicit-joins">.
2304 Setting this value to
<xref linkend=
"guc-geqo-threshold"> or more
2305 may trigger use of the GEQO planner, resulting in nondeterministic
2306 plans. See
<xref linkend=
"runtime-config-query-geqo">.
2315 <sect1 id=
"runtime-config-logging">
2316 <title>Error Reporting and Logging
</title>
2318 <indexterm zone=
"runtime-config-logging">
2319 <primary>server log
</primary>
2322 <sect2 id=
"runtime-config-logging-where">
2323 <title>Where To Log
</title>
2325 <indexterm zone=
"runtime-config-logging-where">
2326 <primary>where to log
</primary>
2331 <varlistentry id=
"guc-log-destination" xreflabel=
"log_destination">
2332 <term><varname>log_destination
</varname> (
<type>string
</type>)
</term>
2334 <primary><varname>log_destination<
/> configuration parameter
</primary>
2338 <productname>PostgreSQL
</productname> supports several methods
2339 for logging server messages, including
2340 <systemitem>stderr
</systemitem>,
<systemitem>csvlog
</systemitem> and
2341 <systemitem>syslog
</systemitem>. On Windows,
2342 <systemitem>eventlog
</systemitem> is also supported. Set this
2343 parameter to a list of desired log destinations separated by
2344 commas. The default is to log to
<systemitem>stderr
</systemitem>
2346 This parameter can only be set in the
<filename>postgresql.conf<
/>
2347 file or on the server command line.
2350 If
<systemitem>csvlog<
/> is included in
<varname>log_destination<
/>,
2351 log entries are output in
<quote>comma separated
2352 value<
/> format, which is convenient for loading them into programs.
2353 See
<xref linkend=
"runtime-config-logging-csvlog"> for details.
2354 <varname>logging_collector
</varname> must be enabled to generate
2355 CSV-format log output.
2360 On most Unix systems, you will need to alter the configuration of
2361 your system's
<application>syslog
</application> daemon in order
2362 to make use of the
<systemitem>syslog
</systemitem> option for
2363 <varname>log_destination<
/>.
<productname>PostgreSQL
</productname>
2364 can log to
<application>syslog
</application> facilities
2365 <literal>LOCAL0<
/> through
<literal>LOCAL7<
/> (see
<xref
2366 linkend=
"guc-syslog-facility">), but the default
2367 <application>syslog
</application> configuration on most platforms
2368 will discard all such messages. You will need to add something like
2370 local0.* /var/log/postgresql
2372 to the
<application>syslog
</application> daemon's configuration file
2379 <varlistentry id=
"guc-logging-collector" xreflabel=
"logging_collector">
2380 <term><varname>logging_collector
</varname> (
<type>boolean
</type>)
</term>
2382 <primary><varname>logging_collector<
/> configuration parameter
</primary>
2386 This parameter allows messages sent to
<application>stderr<
/>,
2387 and CSV-format log output, to be
2388 captured and redirected into log files.
2389 This approach is often more useful than
2390 logging to
<application>syslog<
/>, since some types of messages
2391 might not appear in
<application>syslog<
/> output (a common example
2392 is dynamic-linker failure messages).
2393 This parameter can only be set at server start.
2398 <varlistentry id=
"guc-log-directory" xreflabel=
"log_directory">
2399 <term><varname>log_directory
</varname> (
<type>string
</type>)
</term>
2401 <primary><varname>log_directory<
/> configuration parameter
</primary>
2405 When
<varname>logging_collector<
/> is enabled,
2406 this parameter determines the directory in which log files will be created.
2407 It can be specified as an absolute path, or relative to the
2408 cluster data directory.
2409 This parameter can only be set in the
<filename>postgresql.conf<
/>
2410 file or on the server command line.
2415 <varlistentry id=
"guc-log-filename" xreflabel=
"log_filename">
2416 <term><varname>log_filename
</varname> (
<type>string
</type>)
</term>
2418 <primary><varname>log_filename<
/> configuration parameter
</primary>
2422 When
<varname>logging_collector
</varname> is enabled,
2423 this parameter sets the file names of the created log files. The value
2424 is treated as a
<systemitem>strftime
</systemitem> pattern,
2425 so
<literal>%
</literal>-escapes can be used to specify time-varying
2426 file names. (Note that if there are
2427 any time-zone-dependent
<literal>%
</literal>-escapes, the computation
2428 is done in the zone specified
2429 by
<xref linkend=
"guc-log-timezone">.)
2430 Note that the system's
<systemitem>strftime
</systemitem> is not used
2431 directly, so platform-specific (nonstandard) extensions do not work.
2434 If you specify a file name without escapes, you should plan to
2435 use a log rotation utility to avoid eventually filling the
2436 entire disk. In releases prior to
8.4, if
2437 no
<literal>%
</literal> escapes were
2438 present,
<productname>PostgreSQL
</productname> would append
2439 the epoch of the new log file's creation time, but this is no
2443 If CSV-format output is enabled in
<varname>log_destination<
/>,
2444 <literal>.csv<
/> will be appended to the timestamped
2445 log file name to create the file name for CSV-format output.
2446 (If
<varname>log_filename<
/> ends in
<literal>.log<
/>, the suffix is
2448 In the case of the example above, the CSV
2449 file name will be
<literal>server_log
.1093827753.csv
</literal>.
2452 This parameter can only be set in the
<filename>postgresql.conf<
/>
2453 file or on the server command line.
2458 <varlistentry id=
"guc-log-rotation-age" xreflabel=
"log_rotation_age">
2459 <term><varname>log_rotation_age
</varname> (
<type>integer
</type>)
</term>
2461 <primary><varname>log_rotation_age<
/> configuration parameter
</primary>
2465 When
<varname>logging_collector
</varname> is enabled,
2466 this parameter determines the maximum lifetime of an individual log file.
2467 After this many minutes have elapsed, a new log file will
2468 be created. Set to zero to disable time-based creation of
2470 This parameter can only be set in the
<filename>postgresql.conf<
/>
2471 file or on the server command line.
2476 <varlistentry id=
"guc-log-rotation-size" xreflabel=
"log_rotation_size">
2477 <term><varname>log_rotation_size
</varname> (
<type>integer
</type>)
</term>
2479 <primary><varname>log_rotation_size<
/> configuration parameter
</primary>
2483 When
<varname>logging_collector
</varname> is enabled,
2484 this parameter determines the maximum size of an individual log file.
2485 After this many kilobytes have been emitted into a log file,
2486 a new log file will be created. Set to zero to disable size-based
2487 creation of new log files.
2488 This parameter can only be set in the
<filename>postgresql.conf<
/>
2489 file or on the server command line.
2494 <varlistentry id=
"guc-log-truncate-on-rotation" xreflabel=
"log_truncate_on_rotation">
2495 <term><varname>log_truncate_on_rotation
</varname> (
<type>boolean
</type>)
</term>
2497 <primary><varname>log_truncate_on_rotation<
/> configuration parameter
</primary>
2501 When
<varname>logging_collector
</varname> is enabled,
2502 this parameter will cause
<productname>PostgreSQL
</productname> to truncate (overwrite),
2503 rather than append to, any existing log file of the same name.
2504 However, truncation will occur only when a new file is being opened
2505 due to time-based rotation, not during server startup or size-based
2506 rotation. When off, pre-existing files will be appended to in
2507 all cases. For example, using this setting in combination with
2508 a
<varname>log_filename
</varname> like
<literal>postgresql-%H.log
</literal>
2509 would result in generating twenty-four hourly log files and then
2510 cyclically overwriting them.
2511 This parameter can only be set in the
<filename>postgresql.conf<
/>
2512 file or on the server command line.
2515 Example: To keep
7 days of logs, one log file per day named
2516 <literal>server_log.Mon
</literal>,
<literal>server_log.Tue
</literal>,
2517 etc, and automatically overwrite last week's log with this week's log,
2518 set
<varname>log_filename
</varname> to
<literal>server_log.%a
</literal>,
2519 <varname>log_truncate_on_rotation
</varname> to
<literal>on
</literal>, and
2520 <varname>log_rotation_age
</varname> to
<literal>1440</literal>.
2523 Example: To keep
24 hours of logs, one log file per hour, but
2524 also rotate sooner if the log file size exceeds
1GB, set
2525 <varname>log_filename
</varname> to
<literal>server_log.%H%M
</literal>,
2526 <varname>log_truncate_on_rotation
</varname> to
<literal>on
</literal>,
2527 <varname>log_rotation_age
</varname> to
<literal>60</literal>, and
2528 <varname>log_rotation_size
</varname> to
<literal>1000000</literal>.
2529 Including
<literal>%M<
/> in
<varname>log_filename
</varname> allows
2530 any size-driven rotations that might occur to select a file name
2531 different from the hour's initial file name.
2536 <varlistentry id=
"guc-syslog-facility" xreflabel=
"syslog_facility">
2537 <term><varname>syslog_facility
</varname> (
<type>enum
</type>)
</term>
2539 <primary><varname>syslog_facility<
/> configuration parameter
</primary>
2543 When logging to
<application>syslog<
/> is enabled, this parameter
2544 determines the
<application>syslog
</application>
2545 <quote>facility
</quote> to be used. You can choose
2546 from
<literal>LOCAL0<
/>,
<literal>LOCAL1<
/>,
2547 <literal>LOCAL2<
/>,
<literal>LOCAL3<
/>,
<literal>LOCAL4<
/>,
2548 <literal>LOCAL5<
/>,
<literal>LOCAL6<
/>,
<literal>LOCAL7<
/>;
2549 the default is
<literal>LOCAL0<
/>. See also the
2550 documentation of your system's
2551 <application>syslog
</application> daemon.
2552 This parameter can only be set in the
<filename>postgresql.conf<
/>
2553 file or on the server command line.
2558 <varlistentry id=
"guc-syslog-ident" xreflabel=
"syslog_ident">
2559 <term><varname>syslog_ident
</varname> (
<type>string
</type>)
</term>
2561 <primary><varname>syslog_identity<
/> configuration parameter
</primary>
2565 When logging to
<application>syslog<
/> is enabled, this parameter
2566 determines the program name used to identify
2567 <productname>PostgreSQL
</productname> messages in
2568 <application>syslog
</application> logs. The default is
2569 <literal>postgres
</literal>.
2570 This parameter can only be set in the
<filename>postgresql.conf<
/>
2571 file or on the server command line.
2578 <sect2 id=
"runtime-config-logging-when">
2579 <title>When To Log
</title>
2583 <varlistentry id=
"guc-client-min-messages" xreflabel=
"client_min_messages">
2584 <term><varname>client_min_messages
</varname> (
<type>enum
</type>)
</term>
2586 <primary><varname>client_min_messages<
/> configuration parameter
</primary>
2590 Controls which message levels are sent to the client.
2591 Valid values are
<literal>DEBUG5<
/>,
2592 <literal>DEBUG4<
/>,
<literal>DEBUG3<
/>,
<literal>DEBUG2<
/>,
2593 <literal>DEBUG1<
/>,
<literal>LOG<
/>,
<literal>NOTICE<
/>,
2594 <literal>WARNING<
/>,
<literal>ERROR<
/>,
<literal>FATAL<
/>,
2595 and
<literal>PANIC<
/>. Each level
2596 includes all the levels that follow it. The later the level,
2597 the fewer messages are sent. The default is
2598 <literal>NOTICE<
/>. Note that
<literal>LOG<
/> has a different
2599 rank here than in
<varname>log_min_messages<
/>.
2604 <varlistentry id=
"guc-log-min-messages" xreflabel=
"log_min_messages">
2605 <term><varname>log_min_messages
</varname> (
<type>enum
</type>)
</term>
2607 <primary><varname>log_min_messages<
/> configuration parameter
</primary>
2611 Controls which message levels are written to the server log.
2612 Valid values are
<literal>DEBUG5<
/>,
<literal>DEBUG4<
/>,
2613 <literal>DEBUG3<
/>,
<literal>DEBUG2<
/>,
<literal>DEBUG1<
/>,
2614 <literal>INFO<
/>,
<literal>NOTICE<
/>,
<literal>WARNING<
/>,
2615 <literal>ERROR<
/>,
<literal>LOG<
/>,
<literal>FATAL<
/>, and
2616 <literal>PANIC<
/>. Each level includes all the levels that
2617 follow it. The later the level, the fewer messages are sent
2618 to the log. The default is
<literal>WARNING<
/>. Note that
2619 <literal>LOG<
/> has a different rank here than in
2620 <varname>client_min_messages<
/>.
2621 Only superusers can change this setting.
2626 <varlistentry id=
"guc-log-error-verbosity" xreflabel=
"log_error_verbosity">
2627 <term><varname>log_error_verbosity
</varname> (
<type>enum
</type>)
</term>
2629 <primary><varname>log_error_verbosity<
/> configuration parameter
</primary>
2633 Controls the amount of detail written in the server log for each
2634 message that is logged. Valid values are
<literal>TERSE<
/>,
2635 <literal>DEFAULT<
/>, and
<literal>VERBOSE<
/>, each adding more
2636 fields to displayed messages.
2637 Only superusers can change this setting.
2642 <varlistentry id=
"guc-log-min-error-statement" xreflabel=
"log_min_error_statement">
2643 <term><varname>log_min_error_statement
</varname> (
<type>enum
</type>)
</term>
2645 <primary><varname>log_min_error_statement<
/> configuration parameter
</primary>
2649 Controls whether or not the SQL statement that causes an error
2650 condition will be recorded in the server log. The current
2651 SQL statement is included in the log entry for any message of
2652 the specified severity or higher.
2653 Valid values are
<literal>DEBUG5
</literal>,
2654 <literal>DEBUG4
</literal>,
<literal>DEBUG3
</literal>,
2655 <literal>DEBUG2
</literal>,
<literal>DEBUG1
</literal>,
2656 <literal>INFO
</literal>,
<literal>NOTICE
</literal>,
2657 <literal>WARNING
</literal>,
<literal>ERROR
</literal>,
2658 <literal>LOG
</literal>,
2659 <literal>FATAL
</literal>, and
<literal>PANIC
</literal>.
2660 The default is
<literal>ERROR
</literal>, which means statements
2661 causing errors, log messages, fatal errors, or panics will be logged.
2662 To effectively turn off logging of failing statements,
2663 set this parameter to
<literal>PANIC
</literal>.
2664 Only superusers can change this setting.
2669 <varlistentry id=
"guc-log-min-duration-statement" xreflabel=
"log_min_duration_statement">
2670 <term><varname>log_min_duration_statement
</varname> (
<type>integer
</type>)
</term>
2672 <primary><varname>log_min_duration_statement<
/> configuration parameter
</primary>
2676 Causes the duration of each completed statement to be logged
2677 if the statement ran for at least the specified number of
2678 milliseconds. Setting this to zero prints all statement durations.
2679 Minus-one (the default) disables logging statement durations.
2680 For example, if you set it to
<literal>250ms
</literal>
2681 then all SQL statements that run
250ms or longer will be
2682 logged. Enabling this parameter can be helpful in tracking down
2683 unoptimized queries in your applications.
2684 Only superusers can change this setting.
2688 For clients using extended query protocol, durations of the Parse,
2689 Bind, and Execute steps are logged independently.
2694 When using this option together with
2695 <xref linkend=
"guc-log-statement">,
2696 the text of statements that are logged because of
2697 <varname>log_statement<
/> will not be repeated in the
2698 duration log message.
2699 If you are not using
<application>syslog<
/>, it is recommended
2700 that you log the PID or session ID using
2701 <xref linkend=
"guc-log-line-prefix">
2702 so that you can link the statement message to the later
2703 duration message using the process ID or session ID.
2709 <varlistentry id=
"guc-silent-mode" xreflabel=
"silent_mode">
2710 <term><varname>silent_mode
</varname> (
<type>boolean
</type>)
</term>
2712 <primary><varname>silent_mode<
/> configuration parameter
</primary>
2716 Runs the server silently. If this parameter is set, the server
2717 will automatically run in background and any controlling
2718 terminals are disassociated.
2719 The server's standard output and standard error are redirected
2720 to
<literal>/dev/null<
/>, so any messages sent to them will be lost.
2721 Unless
<application>syslog<
/> logging is selected or
2722 <varname>logging_collector<
/> is enabled, using this parameter
2723 is discouraged because it makes it impossible to see error messages.
2724 This parameter can only be set at server start.
2732 <xref linkend=
"runtime-config-severity-levels"> explains the message
2733 severity levels used by
<productname>PostgreSQL<
/>. If logging output
2734 is sent to
<systemitem>syslog
</systemitem> or Windows'
2735 <systemitem>eventlog
</systemitem>, the severity levels are translated
2736 as shown in the table.
2739 <table id=
"runtime-config-severity-levels">
2740 <title>Message severity levels
</title>
2744 <entry>Severity
</entry>
2745 <entry>Usage
</entry>
2746 <entry><systemitem>syslog<
/></entry>
2747 <entry><systemitem>eventlog<
/></entry>
2753 <entry><literal>DEBUG1..DEBUG5<
/></entry>
2754 <entry>Provides successively-more-detailed information for use by
2756 <entry><literal>DEBUG<
/></entry>
2757 <entry><literal>INFORMATION<
/></entry>
2761 <entry><literal>INFO<
/></entry>
2762 <entry>Provides information implicitly requested by the user,
2763 e.g., output from
<command>VACUUM VERBOSE<
/>.
</entry>
2764 <entry><literal>INFO<
/></entry>
2765 <entry><literal>INFORMATION<
/></entry>
2769 <entry><literal>NOTICE<
/></entry>
2770 <entry>Provides information that might be helpful to users, e.g.,
2771 notice of truncation of long identifiers.
</entry>
2772 <entry><literal>NOTICE<
/></entry>
2773 <entry><literal>INFORMATION<
/></entry>
2777 <entry><literal>WARNING<
/></entry>
2778 <entry>Provides warnings of likely problems, e.g.,
<command>COMMIT<
/>
2779 outside a transaction block.
</entry>
2780 <entry><literal>NOTICE<
/></entry>
2781 <entry><literal>WARNING<
/></entry>
2785 <entry><literal>ERROR<
/></entry>
2786 <entry>Reports an error that caused the current command to
2788 <entry><literal>WARNING<
/></entry>
2789 <entry><literal>ERROR<
/></entry>
2793 <entry><literal>LOG<
/></entry>
2794 <entry>Reports information of interest to administrators, e.g.,
2795 checkpoint activity.
</entry>
2796 <entry><literal>INFO<
/></entry>
2797 <entry><literal>INFORMATION<
/></entry>
2801 <entry><literal>FATAL<
/></entry>
2802 <entry>Reports an error that caused the current session to
2804 <entry><literal>ERR<
/></entry>
2805 <entry><literal>ERROR<
/></entry>
2809 <entry><literal>PANIC<
/></entry>
2810 <entry>Reports an error that caused all database sessions to abort.
</entry>
2811 <entry><literal>CRIT<
/></entry>
2812 <entry><literal>ERROR<
/></entry>
2819 <sect2 id=
"runtime-config-logging-what">
2820 <title>What To Log
</title>
2825 <term><varname>debug_print_parse
</varname> (
<type>boolean
</type>)
</term>
2826 <term><varname>debug_print_rewritten
</varname> (
<type>boolean
</type>)
</term>
2827 <term><varname>debug_print_plan
</varname> (
<type>boolean
</type>)
</term>
2829 <primary><varname>debug_print_parse<
/> configuration parameter
</primary>
2832 <primary><varname>debug_print_rewritten<
/> configuration parameter
</primary>
2835 <primary><varname>debug_print_plan<
/> configuration parameter
</primary>
2839 These parameters enable various debugging output to be emitted.
2840 When set, they print the resulting parse tree, the query rewriter
2841 output, or the execution plan for each executed query.
2842 These messages are emitted at
<literal>LOG<
/> message level, so by
2843 default they will appear in the server log but will not be sent to the
2844 client. You can change that by adjusting
2845 <xref linkend=
"guc-client-min-messages"> and/or
2846 <xref linkend=
"guc-log-min-messages">.
2847 These parameters are off by default.
2853 <term><varname>debug_pretty_print
</varname> (
<type>boolean
</type>)
</term>
2855 <primary><varname>debug_pretty_print<
/> configuration parameter
</primary>
2859 When set,
<varname>debug_pretty_print
</varname> indents the messages
2860 produced by
<varname>debug_print_parse
</varname>,
2861 <varname>debug_print_rewritten
</varname>, or
2862 <varname>debug_print_plan
</varname>. This results in more readable
2863 but much longer output than the
<quote>compact<
/> format used when
2864 it is off. It is on by default.
2869 <varlistentry id=
"guc-log-checkpoints" xreflabel=
"log_checkpoints">
2870 <term><varname>log_checkpoints
</varname> (
<type>boolean
</type>)
</term>
2872 <primary><varname>log_checkpoints<
/> configuration parameter
</primary>
2876 Causes checkpoints to be logged in the server log. Some
2877 statistics about each checkpoint are included in the log messages,
2878 including the number of buffers written and the time spent writing
2880 This parameter can only be set in the
<filename>postgresql.conf<
/>
2881 file or on the server command line. The default is off.
2886 <varlistentry id=
"guc-log-connections" xreflabel=
"log_connections">
2887 <term><varname>log_connections
</varname> (
<type>boolean
</type>)
</term>
2889 <primary><varname>log_connections<
/> configuration parameter
</primary>
2893 Causes each attempted connection to the server to be logged,
2894 as well as successful completion of client authentication.
2895 This parameter can only be set in the
<filename>postgresql.conf<
/>
2896 file or on the server command line. The default is off.
2901 Some client programs, like
<application>psql<
/>, attempt
2902 to connect twice while determining if a password is required, so
2903 duplicate
<quote>connection received<
/> messages do not
2904 necessarily indicate a problem.
2910 <varlistentry id=
"guc-log-disconnections" xreflabel=
"log_disconnections">
2911 <term><varname>log_disconnections
</varname> (
<type>boolean
</type>)
</term>
2913 <primary><varname>log_disconnections<
/> configuration parameter
</primary>
2917 This outputs a line in the server log similar to
2918 <varname>log_connections
</varname> but at session termination,
2919 and includes the duration of the session. This is off by
2921 This parameter can only be set in the
<filename>postgresql.conf<
/>
2922 file or on the server command line.
2928 <varlistentry id=
"guc-log-duration" xreflabel=
"log_duration">
2929 <term><varname>log_duration
</varname> (
<type>boolean
</type>)
</term>
2931 <primary><varname>log_duration<
/> configuration parameter
</primary>
2935 Causes the duration of every completed statement to be logged.
2936 The default is
<literal>off<
/>.
2937 Only superusers can change this setting.
2941 For clients using extended query protocol, durations of the Parse,
2942 Bind, and Execute steps are logged independently.
2947 The difference between setting this option and setting
2948 <xref linkend=
"guc-log-min-duration-statement"> to zero is that
2949 exceeding
<varname>log_min_duration_statement<
/> forces the text of
2950 the query to be logged, but this option doesn't. Thus, if
2951 <varname>log_duration<
/> is
<literal>on<
/> and
2952 <varname>log_min_duration_statement<
/> has a positive value, all
2953 durations are logged but the query text is included only for
2954 statements exceeding the threshold. This behavior can be useful for
2955 gathering statistics in high-load installations.
2961 <varlistentry id=
"guc-log-hostname" xreflabel=
"log_hostname">
2962 <term><varname>log_hostname
</varname> (
<type>boolean
</type>)
</term>
2964 <primary><varname>log_hostname<
/> configuration parameter
</primary>
2968 By default, connection log messages only show the IP address of the
2969 connecting host. Turning on this parameter causes logging of the
2970 host name as well. Note that depending on your host name resolution
2971 setup this might impose a non-negligible performance penalty.
2972 This parameter can only be set in the
<filename>postgresql.conf<
/>
2973 file or on the server command line.
2978 <varlistentry id=
"guc-log-line-prefix" xreflabel=
"log_line_prefix">
2979 <term><varname>log_line_prefix
</varname> (
<type>string
</type>)
</term>
2981 <primary><varname>log_line_prefix<
/> configuration parameter
</primary>
2985 This is a
<function>printf<
/>-style string that is output at the
2986 beginning of each log line.
2987 <literal>%<
/> characters begin
<quote>escape sequences<
/>
2988 that are replaced with status information as outlined below.
2989 Unrecognized escapes are ignored. Other
2990 characters are copied straight to the log line. Some escapes are
2991 only recognized by session processes, and do not apply to
2992 background processes such as the main server process.
2993 This parameter can only be set in the
<filename>postgresql.conf<
/>
2994 file or on the server command line. The default is an empty string.
3000 <entry>Escape
</entry>
3001 <entry>Effect
</entry>
3002 <entry>Session only
</entry>
3007 <entry><literal>%u
</literal></entry>
3008 <entry>User name
</entry>
3012 <entry><literal>%d
</literal></entry>
3013 <entry>Database name
</entry>
3017 <entry><literal>%r
</literal></entry>
3018 <entry>Remote host name or IP address, and remote port
</entry>
3022 <entry><literal>%h
</literal></entry>
3023 <entry>Remote host name or IP address
</entry>
3027 <entry><literal>%p
</literal></entry>
3028 <entry>Process ID
</entry>
3032 <entry><literal>%t
</literal></entry>
3033 <entry>Time stamp without milliseconds
</entry>
3037 <entry><literal>%m
</literal></entry>
3038 <entry>Time stamp with milliseconds
</entry>
3042 <entry><literal>%i
</literal></entry>
3043 <entry>Command tag: type of session's current command
</entry>
3047 <entry><literal>%e
</literal></entry>
3048 <entry>SQL state
</entry>
3052 <entry><literal>%c
</literal></entry>
3053 <entry>Session ID: see below
</entry>
3057 <entry><literal>%l
</literal></entry>
3058 <entry>Number of the log line for each session or process, starting at
1</entry>
3062 <entry><literal>%s
</literal></entry>
3063 <entry>Process start time stamp
</entry>
3067 <entry><literal>%v
</literal></entry>
3068 <entry>Virtual transaction ID (backendID/localXID)
</entry>
3072 <entry><literal>%x
</literal></entry>
3073 <entry>Transaction ID (
0 if none is assigned)
</entry>
3077 <entry><literal>%q
</literal></entry>
3078 <entry>Produces no output, but tells non-session
3079 processes to stop at this point in the string; ignored by
3080 session processes
</entry>
3084 <entry><literal>%%
</literal></entry>
3085 <entry>Literal
<literal>%<
/></entry>
3092 The
<literal>%c<
/> escape prints a quasi-unique session identifier,
3093 consisting of two
4-byte hexadecimal numbers (without leading zeros)
3094 separated by a dot. The numbers are the process start time and the
3095 process ID, so
<literal>%c<
/> can also be used as a space saving way
3096 of printing those items. For example, to generate the session
3097 identifier from
<literal>pg_stat_activity<
/>, use this query:
3099 SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
3101 FROM pg_stat_activity;
3108 If you set a nonempty value for
<varname>log_line_prefix<
/>,
3109 you should usually make its last character be a space, to provide
3110 visual separation from the rest of the log line. A punctuation
3111 character could be used too.
3117 <application>Syslog<
/> produces its own
3118 time stamp and process ID information, so you probably do not want to
3119 use those escapes if you are logging to
<application>syslog<
/>.
3125 <varlistentry id=
"guc-log-lock-waits" xreflabel=
"log_lock_waits">
3126 <term><varname>log_lock_waits
</varname> (
<type>boolean
</type>)
</term>
3128 <primary><varname>log_lock_waits<
/> configuration parameter
</primary>
3132 Controls whether a log message is produced when a session waits
3133 longer than
<xref linkend=
"guc-deadlock-timeout"> to acquire a
3134 lock. This is useful in determining if lock waits are causing
3135 poor performance. The default is
<literal>off<
/>.
3140 <varlistentry id=
"guc-log-statement" xreflabel=
"log_statement">
3141 <term><varname>log_statement
</varname> (
<type>enum
</type>)
</term>
3143 <primary><varname>log_statement<
/> configuration parameter
</primary>
3147 Controls which SQL statements are logged. Valid values are
3148 <literal>none<
/>,
<literal>ddl<
/>,
<literal>mod<
/>, and
3149 <literal>all<
/>.
<literal>ddl<
/> logs all data definition
3150 statements, such as
<command>CREATE<
/>,
<command>ALTER<
/>, and
3151 <command>DROP<
/> statements.
<literal>mod<
/> logs all
3152 <literal>ddl<
/> statements, plus data-modifying statements
3153 such as
<command>INSERT<
/>,
3154 <command>UPDATE<
/>,
<command>DELETE<
/>,
<command>TRUNCATE<
/>,
3155 and
<command>COPY FROM<
/>.
3156 <command>PREPARE<
/>,
<command>EXECUTE<
/>, and
3157 <command>EXPLAIN ANALYZE<
/> statements are also logged if their
3158 contained command is of an appropriate type. For clients using
3159 extended query protocol, logging occurs when an Execute message
3160 is received, and values of the Bind parameters are included
3161 (with any embedded single-quote marks doubled).
3165 The default is
<literal>none<
/>. Only superusers can change this
3171 Statements that contain simple syntax errors are not logged
3172 even by the
<varname>log_statement<
/> =
<literal>all<
/> setting,
3173 because the log message is emitted only after basic parsing has
3174 been done to determine the statement type. In the case of extended
3175 query protocol, this setting likewise does not log statements that
3176 fail before the Execute phase (i.e., during parse analysis or
3177 planning). Set
<varname>log_min_error_statement<
/> to
3178 <literal>ERROR<
/> (or lower) to log such statements.
3184 <varlistentry id=
"guc-log-temp-files" xreflabel=
"log_temp_files">
3185 <term><varname>log_temp_files
</varname> (
<type>integer
</type>)
</term>
3187 <primary><varname>log_temp_files<
/> configuration parameter
</primary>
3191 Controls logging of use of temporary files.
3192 Temporary files can be
3193 created for sorts, hashes, and temporary query results.
3194 A log entry is made for each temporary file when it is deleted.
3195 A value of zero logs all temporary files, while positive
3196 values log only files whose size is greater than or equal to
3197 the specified number of kilobytes. The
3198 default setting is
<literal>-
1<
/>, which disables such logging.
3199 Only superusers can change this setting.
3204 <varlistentry id=
"guc-log-timezone" xreflabel=
"log_timezone">
3205 <term><varname>log_timezone
</varname> (
<type>string
</type>)
</term>
3207 <primary><varname>log_timezone<
/> configuration parameter
</primary>
3211 Sets the time zone used for timestamps written in the log.
3212 Unlike
<xref linkend=
"guc-timezone">, this value is cluster-wide,
3213 so that all sessions will report timestamps consistently.
3214 The default is
<literal>unknown<
/>, which means to use whatever
3215 the system environment specifies as the time zone. See
<xref
3216 linkend=
"datatype-timezones"> for more information.
3217 This parameter can only be set in the
<filename>postgresql.conf<
/>
3218 file or on the server command line.
3225 <sect2 id=
"runtime-config-logging-csvlog">
3226 <title>Using CSV-Format Log Output
</title>
3229 Including
<literal>csvlog<
/> in the
<varname>log_destination<
/> list
3230 provides a convenient way to import log files into a database table.
3231 This option emits log lines in comma-separated-value format,
3232 with these columns: timestamp with milliseconds, user name, database
3233 name, process ID, host:port number, session ID, per-session or -process line
3234 number, command tag, session start time, virtual transaction ID,
3235 regular transaction id, error severity, SQL state code, error message,
3236 error message detail, hint, internal query that led to the error (if
3237 any), character count of the error position thereof, error context,
3238 user query that led to the error (if any and enabled by
3239 <varname>log_min_error_statement<
/>), character count of the error
3240 position thereof, location of the error in the PostgreSQL source code
3241 (if
<varname>log_error_verbosity<
/> is set to
<literal>verbose<
/>).
3242 Here is a sample table definition for storing CSV-format log output:
3245 CREATE TABLE postgres_log
3247 log_time timestamp(
3) with time zone,
3251 connection_from text,
3253 session_line_num bigint,
3255 session_start_time timestamp with time zone,
3256 virtual_transaction_id text,
3257 transaction_id bigint,
3258 error_severity text,
3259 sql_state_code text,
3263 internal_query text,
3264 internal_query_pos integer,
3269 PRIMARY KEY (session_id, session_line_num)
3275 To import a log file into this table, use the
<command>COPY FROM<
/>
3279 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
3284 There are a few things you need to do to simplify importing CSV log
3285 files easily and automatically:
3290 Set
<varname>log_filename
</varname> and
3291 <varname>log_rotation_age<
/> to provide a consistent,
3292 predictable naming scheme for your log files. This lets you
3293 predict what the file name will be and know when an individual log
3294 file is complete and therefore ready to be imported.
3300 Set
<varname>log_rotation_size
</varname> to
0 to disable
3301 size-based log rotation, as it makes the log file name difficult
3308 Set
<varname>log_truncate_on_rotation
</varname> to
<literal>on<
/> so
3309 that old log data isn't mixed with the new in the same file.
3315 The table definition above includes a primary key specification.
3316 This is useful to protect against accidentally importing the same
3317 information twice. The
<command>COPY<
/> command commits all of the
3318 data it imports at one time, so any error will cause the entire
3319 import to fail. If you import a partial log file and later import
3320 the file again when it is complete, the primary key violation will
3321 cause the import to fail. Wait until the log is complete and
3322 closed before importing. This procedure will also protect against
3323 accidentally importing a partial line that hasn't been completely
3324 written, which would also cause
<command>COPY<
/> to fail.
3333 <sect1 id=
"runtime-config-statistics">
3334 <title>Run-Time Statistics
</title>
3336 <sect2 id=
"runtime-config-statistics-collector">
3337 <title>Query and Index Statistics Collector
</title>
3340 These parameters control server-wide statistics collection features.
3341 When statistics collection is enabled, the data that is produced can be
3342 accessed via the
<structname>pg_stat
</structname> and
3343 <structname>pg_statio
</structname> family of system views.
3344 Refer to
<xref linkend=
"monitoring"> for more information.
3349 <varlistentry id=
"guc-track-activities" xreflabel=
"track_activities">
3350 <term><varname>track_activities
</varname> (
<type>boolean
</type>)
</term>
3352 <primary><varname>track_activities<
/> configuration parameter
</primary>
3356 Enables the collection of information on the currently
3357 executing command of each session, along with the time at
3358 which that command began execution. This parameter is on by
3359 default. Note that even when enabled, this information is not
3360 visible to all users, only to superusers and the user owning
3361 the session being reported on; so it should not represent a
3363 Only superusers can change this setting.
3368 <varlistentry id=
"guc-track-activity-query-size" xreflabel=
"track_activity_query_size">
3369 <term><varname>track_activity_query_size
</varname> (
<type>integer
</type>)
</term>
3371 <primary><varname>track_activity_query_size<
/> configuration parameter
</primary>
3375 Specifies the number of bytes reserved to track the currently
3376 executing command for each active session, for the
3377 <structname>pg_stat_activity<
/>.
<structfield>current_query<
/> field.
3378 The default value is
1024. This parameter can only be set at server
3384 <varlistentry id=
"guc-track-counts" xreflabel=
"track_counts">
3385 <term><varname>track_counts
</varname> (
<type>boolean
</type>)
</term>
3387 <primary><varname>track_counts<
/> configuration parameter
</primary>
3391 Enables collection of statistics on database activity.
3392 This parameter is on by default, because the autovacuum
3393 daemon needs the collected information.
3394 Only superusers can change this setting.
3399 <varlistentry id=
"guc-track-functions" xreflabel=
"track_functions">
3400 <term><varname>track_functions
</varname> (
<type>enum
</type>)
</term>
3402 <primary><varname>track_functions<
/> configuration parameter
</primary>
3406 Enables tracking of function call counts and time used. Specify
3407 <literal>pl
</literal> to track only procedural-language functions,
3408 <literal>all
</literal> to also track SQL and C language functions.
3409 The default is
<literal>none
</literal>, which disables function
3410 statistics tracking. Only superusers can change this setting.
3415 SQL-language functions that are simple enough to be
<quote>inlined<
/>
3416 into the calling query will not be tracked, regardless of this
3423 <varlistentry id=
"guc-update-process-title" xreflabel=
"update_process_title">
3424 <term><varname>update_process_title
</varname> (
<type>boolean
</type>)
</term>
3426 <primary><varname>update_process_title<
/> configuration parameter
</primary>
3430 Enables updating of the process title every time a new SQL command
3431 is received by the server. The process title is typically viewed
3432 by the
<command>ps<
/> command,
3433 or in Windows by using the
<application>Process Explorer<
/>.
3434 Only superusers can change this setting.
3439 <varlistentry id=
"guc-stats-temp-directory" xreflabel=
"stats_temp_directory">
3440 <term><varname>stats_temp_directory
</varname> (
<type>string
</type>)
</term>
3442 <primary><varname>stats_temp_directory<
/> configuration parameter
</primary>
3446 Sets the directory to store temporary statistics data in. This can be
3447 a path relative to the data directory or an absolute path. The default
3448 is
<filename>pg_stat_tmp
</filename>. Pointing this at a RAM based
3449 filesystem will decrease physical I/O requirements and can lead to
3450 improved performance.
3451 This parameter can only be set in the
<filename>postgresql.conf<
/>
3452 file or on the server command line.
3460 <sect2 id=
"runtime-config-statistics-monitor">
3461 <title>Statistics Monitoring
</title>
3465 <term><varname>log_statement_stats
</varname> (
<type>boolean
</type>)
</term>
3466 <term><varname>log_parser_stats
</varname> (
<type>boolean
</type>)
</term>
3467 <term><varname>log_planner_stats
</varname> (
<type>boolean
</type>)
</term>
3468 <term><varname>log_executor_stats
</varname> (
<type>boolean
</type>)
</term>
3470 <primary><varname>log_statement_stats<
/> configuration parameter
</primary>
3473 <primary><varname>log_parser_stats<
/> configuration parameter
</primary>
3476 <primary><varname>log_planner_stats<
/> configuration parameter
</primary>
3479 <primary><varname>log_executor_stats<
/> configuration parameter
</primary>
3483 For each query, write performance statistics of the respective
3484 module to the server log. This is a crude profiling
3485 instrument.
<varname>log_statement_stats
</varname> reports total
3486 statement statistics, while the others report per-module statistics.
3487 <varname>log_statement_stats
</varname> cannot be enabled together with
3488 any of the per-module options. All of these options are disabled by
3489 default. Only superusers can change these settings.
3499 <sect1 id=
"runtime-config-autovacuum">
3500 <title>Automatic Vacuuming
</title>
3503 <primary>autovacuum
</primary>
3504 <secondary>configuration parameters
</secondary>
3508 These settings control the behavior of the
<firstterm>autovacuum<
/>
3509 feature. Refer to
<xref linkend=
"autovacuum"> for
3515 <varlistentry id=
"guc-autovacuum" xreflabel=
"autovacuum">
3516 <term><varname>autovacuum
</varname> (
<type>boolean
</type>)
</term>
3518 <primary><varname>autovacuum<
/> configuration parameter
</primary>
3522 Controls whether the server should run the
3523 autovacuum launcher daemon. This is on by default; however,
3524 <xref linkend=
"guc-track-counts"> must also be turned on for
3526 This parameter can only be set in the
<filename>postgresql.conf<
/>
3527 file or on the server command line.
3530 Note that even when this parameter is disabled, the system
3531 will launch autovacuum processes if necessary to
3532 prevent transaction ID wraparound. See
<xref
3533 linkend=
"vacuum-for-wraparound"> for more information.
3538 <varlistentry id=
"guc-log-autovacuum-min-duration" xreflabel=
"log_autovacuum_min_duration">
3539 <term><varname>log_autovacuum_min_duration
</varname> (
<type>integer
</type>)
</term>
3541 <primary><varname>log_autovacuum_min_duration<
/> configuration parameter
</primary>
3545 Causes each action executed by autovacuum to be logged if it ran for at
3546 least the specified number of milliseconds. Setting this to zero logs
3547 all autovacuum actions. Minus-one (the default) disables logging
3548 autovacuum actions. For example, if you set this to
3549 <literal>250ms
</literal> then all automatic vacuums and analyzes that run
3550 250ms or longer will be logged. Enabling this parameter can be helpful
3551 in tracking autovacuum activity. This setting can only be set in
3552 the
<filename>postgresql.conf<
/> file or on the server command line.
3557 <varlistentry id=
"guc-autovacuum-max-workers" xreflabel=
"autovacuum_max_workers">
3558 <term><varname>autovacuum_max_workers
</varname> (
<type>integer
</type>)
</term>
3560 <primary><varname>autovacuum_max_workers<
/> configuration parameter
</primary>
3564 Specifies the maximum number of autovacuum processes (other than the
3565 autovacuum launcher) which may be running at any one time. The default
3566 is three. This parameter can only be set in
3567 the
<filename>postgresql.conf<
/> file or on the server command line.
3572 <varlistentry id=
"guc-autovacuum-naptime" xreflabel=
"autovacuum_naptime">
3573 <term><varname>autovacuum_naptime
</varname> (
<type>integer
</type>)
</term>
3575 <primary><varname>autovacuum_naptime<
/> configuration parameter
</primary>
3579 Specifies the minimum delay between autovacuum runs on any given
3580 database. In each round the daemon examines the
3581 database and issues
<command>VACUUM<
/> and
<command>ANALYZE<
/> commands
3582 as needed for tables in that database. The delay is measured
3583 in seconds, and the default is one minute (
<literal>1m<
/>).
3584 This parameter can only be set in the
<filename>postgresql.conf<
/>
3585 file or on the server command line.
3590 <varlistentry id=
"guc-autovacuum-vacuum-threshold" xreflabel=
"autovacuum_vacuum_threshold">
3591 <term><varname>autovacuum_vacuum_threshold
</varname> (
<type>integer
</type>)
</term>
3593 <primary><varname>autovacuum_vacuum_threshold<
/> configuration parameter
</primary>
3597 Specifies the minimum number of updated or deleted tuples needed
3598 to trigger a
<command>VACUUM<
/> in any one table.
3599 The default is
50 tuples.
3600 This parameter can only be set in the
<filename>postgresql.conf<
/>
3601 file or on the server command line.
3602 This setting can be overridden for individual tables by
3603 changing storage parameters.
3608 <varlistentry id=
"guc-autovacuum-analyze-threshold" xreflabel=
"autovacuum_analyze_threshold">
3609 <term><varname>autovacuum_analyze_threshold
</varname> (
<type>integer
</type>)
</term>
3611 <primary><varname>autovacuum_analyze_threshold<
/> configuration parameter
</primary>
3615 Specifies the minimum number of inserted, updated or deleted tuples
3616 needed to trigger an
<command>ANALYZE<
/> in any one table.
3617 The default is
50 tuples.
3618 This parameter can only be set in the
<filename>postgresql.conf<
/>
3619 file or on the server command line.
3620 This setting can be overridden for individual tables by
3621 changing storage parameters.
3626 <varlistentry id=
"guc-autovacuum-vacuum-scale-factor" xreflabel=
"autovacuum_vacuum_scale_factor">
3627 <term><varname>autovacuum_vacuum_scale_factor
</varname> (
<type>floating point
</type>)
</term>
3629 <primary><varname>autovacuum_vacuum_scale_factor<
/> configuration parameter
</primary>
3633 Specifies a fraction of the table size to add to
3634 <varname>autovacuum_vacuum_threshold
</varname>
3635 when deciding whether to trigger a
<command>VACUUM<
/>.
3636 The default is
0.2 (
20% of table size).
3637 This parameter can only be set in the
<filename>postgresql.conf<
/>
3638 file or on the server command line.
3639 This setting can be overridden for individual tables by
3640 changing storage parameters.
3645 <varlistentry id=
"guc-autovacuum-analyze-scale-factor" xreflabel=
"autovacuum_analyze_scale_factor">
3646 <term><varname>autovacuum_analyze_scale_factor
</varname> (
<type>floating point
</type>)
</term>
3648 <primary><varname>autovacuum_analyze_scale_factor<
/> configuration parameter
</primary>
3652 Specifies a fraction of the table size to add to
3653 <varname>autovacuum_analyze_threshold
</varname>
3654 when deciding whether to trigger an
<command>ANALYZE<
/>.
3655 The default is
0.1 (
10% of table size).
3656 This parameter can only be set in the
<filename>postgresql.conf<
/>
3657 file or on the server command line.
3658 This setting can be overridden for individual tables by
3659 changing storage parameters.
3664 <varlistentry id=
"guc-autovacuum-freeze-max-age" xreflabel=
"autovacuum_freeze_max_age">
3665 <term><varname>autovacuum_freeze_max_age
</varname> (
<type>integer
</type>)
</term>
3667 <primary><varname>autovacuum_freeze_max_age<
/> configuration parameter
</primary>
3671 Specifies the maximum age (in transactions) that a table's
3672 <structname>pg_class<
/>.
<structfield>relfrozenxid<
/> field can
3673 attain before a
<command>VACUUM<
/> operation is forced to prevent
3674 transaction ID wraparound within the table. Note that the system
3675 will launch autovacuum processes to prevent wraparound even when
3676 autovacuum is otherwise disabled.
3677 The default is
200 million transactions.
3678 This parameter can only be set at server start, but the setting
3679 can be reduced for individual tables by
3680 changing storage parameters.
3681 For more information see
<xref linkend=
"vacuum-for-wraparound">.
3686 <varlistentry id=
"guc-autovacuum-vacuum-cost-delay" xreflabel=
"autovacuum_vacuum_cost_delay">
3687 <term><varname>autovacuum_vacuum_cost_delay
</varname> (
<type>integer
</type>)
</term>
3689 <primary><varname>autovacuum_vacuum_cost_delay<
/> configuration parameter
</primary>
3693 Specifies the cost delay value that will be used in automatic
3694 <command>VACUUM<
/> operations. If
<literal>-
1<
/> is
3695 specified, the regular
3696 <xref linkend=
"guc-vacuum-cost-delay"> value will be used.
3697 The default value is
20 milliseconds.
3698 This parameter can only be set in the
<filename>postgresql.conf<
/>
3699 file or on the server command line.
3700 This setting can be overridden for individual tables by
3701 changing storage parameters.
3706 <varlistentry id=
"guc-autovacuum-vacuum-cost-limit" xreflabel=
"autovacuum_vacuum_cost_limit">
3707 <term><varname>autovacuum_vacuum_cost_limit
</varname> (
<type>integer
</type>)
</term>
3709 <primary><varname>autovacuum_vacuum_cost_limit<
/> configuration parameter
</primary>
3713 Specifies the cost limit value that will be used in automatic
3714 <command>VACUUM<
/> operations. If
<literal>-
1<
/> is specified (which is the
3715 default), the regular
3716 <xref linkend=
"guc-vacuum-cost-limit"> value will be used. Note that
3717 the value is distributed proportionally among the running autovacuum
3718 workers, if there is more than one, so that the sum of the limits of
3719 each worker never exceeds the limit on this variable.
3720 This parameter can only be set in the
<filename>postgresql.conf<
/>
3721 file or on the server command line.
3722 This setting can be overridden for individual tables by
3723 changing storage parameters.
3731 <sect1 id=
"runtime-config-client">
3732 <title>Client Connection Defaults
</title>
3734 <sect2 id=
"runtime-config-client-statement">
3735 <title>Statement Behavior
</title>
3738 <varlistentry id=
"guc-search-path" xreflabel=
"search_path">
3739 <term><varname>search_path
</varname> (
<type>string
</type>)
</term>
3741 <primary><varname>search_path<
/> configuration parameter
</primary>
3743 <indexterm><primary>path<
/><secondary>for schemas<
/><
/>
3746 This variable specifies the order in which schemas are searched
3747 when an object (table, data type, function, etc.) is referenced by a
3748 simple name with no schema component. When there are objects of
3749 identical names in different schemas, the one found first
3750 in the search path is used. An object that is not in any of the
3751 schemas in the search path can only be referenced by specifying
3752 its containing schema with a qualified (dotted) name.
3756 The value for
<varname>search_path
</varname> has to be a comma-separated
3757 list of schema names. If one of the list items is
3758 the special value
<literal>$user
</literal>, then the schema
3759 having the name returned by
<function>SESSION_USER<
/> is substituted, if there
3760 is such a schema. (If not,
<literal>$user
</literal> is ignored.)
3764 The system catalog schema,
<literal>pg_catalog<
/>, is always
3765 searched, whether it is mentioned in the path or not. If it is
3766 mentioned in the path then it will be searched in the specified
3767 order. If
<literal>pg_catalog<
/> is not in the path then it will
3768 be searched
<emphasis>before<
/> searching any of the path items.
3772 Likewise, the current session's temporary-table schema,
3773 <literal>pg_temp_
<replaceable>nnn<
/><
/>, is always searched if it
3774 exists. It can be explicitly listed in the path by using the
3775 alias
<literal>pg_temp<
/>. If it is not listed in the path then
3776 it is searched first (before even
<literal>pg_catalog<
/>). However,
3777 the temporary schema is only searched for relation (table, view,
3778 sequence, etc) and data type names. It will never be searched for
3779 function or operator names.
3783 When objects are created without specifying a particular target
3784 schema, they will be placed in the first schema listed
3785 in the search path. An error is reported if the search path is
3790 The default value for this parameter is
3791 <literal>'
"$user", public'
</literal> (where the second part will be
3792 ignored if there is no schema named
<literal>public<
/>).
3793 This supports shared use of a database (where no users
3794 have private schemas, and all share use of
<literal>public<
/>),
3795 private per-user schemas, and combinations of these. Other
3796 effects can be obtained by altering the default search path
3797 setting, either globally or per-user.
3801 The current effective value of the search path can be examined
3802 via the
<acronym>SQL
</acronym> function
3803 <function>current_schemas()<
/>. This is not quite the same as
3804 examining the value of
<varname>search_path
</varname>, since
3805 <function>current_schemas()<
/> shows how the requests
3806 appearing in
<varname>search_path
</varname> were resolved.
3810 For more information on schema handling, see
<xref linkend=
"ddl-schemas">.
3815 <varlistentry id=
"guc-default-tablespace" xreflabel=
"default_tablespace">
3816 <term><varname>default_tablespace
</varname> (
<type>string
</type>)
</term>
3818 <primary><varname>default_tablespace<
/> configuration parameter
</primary>
3820 <indexterm><primary>tablespace<
/><secondary>default<
/><
/>
3823 This variable specifies the default tablespace in which to create
3824 objects (tables and indexes) when a
<command>CREATE<
/> command does
3825 not explicitly specify a tablespace.
3829 The value is either the name of a tablespace, or an empty string
3830 to specify using the default tablespace of the current database.
3831 If the value does not match the name of any existing tablespace,
3832 <productname>PostgreSQL<
/> will automatically use the default
3833 tablespace of the current database. If a nondefault tablespace
3834 is specified, the user must have
<literal>CREATE<
/> privilege
3835 for it, or creation attempts will fail.
3839 This variable is not used for temporary tables; for them,
3840 <xref linkend=
"guc-temp-tablespaces"> is consulted instead.
3844 For more information on tablespaces,
3845 see
<xref linkend=
"manage-ag-tablespaces">.
3850 <varlistentry id=
"guc-temp-tablespaces" xreflabel=
"temp_tablespaces">
3851 <term><varname>temp_tablespaces
</varname> (
<type>string
</type>)
</term>
3853 <primary><varname>temp_tablespaces<
/> configuration parameter
</primary>
3855 <indexterm><primary>tablespace<
/><secondary>temporary<
/><
/>
3858 This variable specifies tablespace(s) in which to create temporary
3859 objects (temp tables and indexes on temp tables) when a
3860 <command>CREATE<
/> command does not explicitly specify a tablespace.
3861 Temporary files for purposes such as sorting large data sets
3862 are also created in these tablespace(s).
3866 The value is a list of names of tablespaces. When there is more than
3867 one name in the list,
<productname>PostgreSQL<
/> chooses a random
3868 member of the list each time a temporary object is to be created;
3869 except that within a transaction, successively created temporary
3870 objects are placed in successive tablespaces from the list.
3871 If the selected element of the list is an empty string,
3872 <productname>PostgreSQL<
/> will automatically use the default
3873 tablespace of the current database instead.
3877 When
<varname>temp_tablespaces<
/> is set interactively, specifying a
3878 nonexistent tablespace is an error, as is specifying a tablespace for
3879 which the user does not have
<literal>CREATE<
/> privilege. However,
3880 when using a previously set value, nonexistent tablespaces are
3881 ignored, as are tablespaces for which the user lacks
3882 <literal>CREATE<
/> privilege. In particular, this rule applies when
3883 using a value set in
<filename>postgresql.conf<
/>.
3887 The default value is an empty string, which results in all temporary
3888 objects being created in the default tablespace of the current
3893 See also
<xref linkend=
"guc-default-tablespace">.
3898 <varlistentry id=
"guc-check-function-bodies" xreflabel=
"check_function_bodies">
3899 <term><varname>check_function_bodies
</varname> (
<type>boolean
</type>)
</term>
3901 <primary><varname>check_function_bodies<
/> configuration parameter
</primary>
3905 This parameter is normally on. When set to
<literal>off<
/>, it
3906 disables validation of the function body string during
<xref
3907 linkend=
"sql-createfunction"
3908 endterm=
"sql-createfunction-title">. Disabling validation is
3909 occasionally useful to avoid problems such as forward references
3910 when restoring function definitions from a dump.
3915 <varlistentry id=
"guc-default-transaction-isolation" xreflabel=
"default_transaction_isolation">
3917 <primary>transaction isolation level
</primary>
3920 <primary><varname>default_transaction_isolation<
/> configuration parameter
</primary>
3922 <term><varname>default_transaction_isolation
</varname> (
<type>enum
</type>)
</term>
3925 Each SQL transaction has an isolation level, which can be
3926 either
<quote>read uncommitted
</quote>,
<quote>read
3927 committed
</quote>,
<quote>repeatable read
</quote>, or
3928 <quote>serializable
</quote>. This parameter controls the
3929 default isolation level of each new transaction. The default
3930 is
<quote>read committed
</quote>.
3934 Consult
<xref linkend=
"mvcc"> and
<xref
3935 linkend=
"sql-set-transaction"
3936 endterm=
"sql-set-transaction-title"> for more information.
3941 <varlistentry id=
"guc-default-transaction-read-only" xreflabel=
"default_transaction_read_only">
3943 <primary>read-only transaction
</primary>
3946 <primary><varname>default_transaction_read_only<
/> configuration parameter
</primary>
3949 <term><varname>default_transaction_read_only
</varname> (
<type>boolean
</type>)
</term>
3952 A read-only SQL transaction cannot alter non-temporary tables.
3953 This parameter controls the default read-only status of each new
3954 transaction. The default is
<literal>off<
/> (read/write).
3958 Consult
<xref linkend=
"sql-set-transaction"
3959 endterm=
"sql-set-transaction-title"> for more information.
3964 <varlistentry id=
"guc-session-replication-role" xreflabel=
"session_replication_role">
3965 <term><varname>session_replication_role
</varname> (
<type>enum
</type>)
</term>
3967 <primary><varname>session_replication_role<
/> configuration parameter
</primary>
3971 Controls firing of replication-related triggers and rules for the
3972 current session. Setting this variable requires
3973 superuser privilege and results in discarding any previously cached
3974 query plans. Possible values are
<literal>origin<
/> (the default),
3975 <literal>replica<
/> and
<literal>local<
/>.
3976 See
<xref linkend=
"sql-altertable" endterm=
"sql-altertable-title"> for
3982 <varlistentry id=
"guc-statement-timeout" xreflabel=
"statement_timeout">
3983 <term><varname>statement_timeout
</varname> (
<type>integer
</type>)
</term>
3985 <primary><varname>statement_timeout<
/> configuration parameter
</primary>
3989 Abort any statement that takes over the specified number of
3990 milliseconds, starting from the time the command arrives at the server
3991 from the client. If
<varname>log_min_error_statement<
/> is set to
3992 <literal>ERROR<
/> or lower, the statement that timed out will also be
3993 logged. A value of zero (the default) turns off the
3998 Setting
<varname>statement_timeout<
/> in
3999 <filename>postgresql.conf<
/> is not recommended because it
4000 affects all sessions.
4005 <varlistentry id=
"guc-vacuum-freeze-table-age" xreflabel=
"vacuum_freeze_table_age">
4006 <term><varname>vacuum_freeze_table_age
</varname> (
<type>integer
</type>)
</term>
4008 <primary><varname>vacuum_freeze_table_age<
/> configuration parameter
</primary>
4012 <command>VACUUM<
/> performs a whole-table scan if the table's
4013 <structname>pg_class<
/>.
<structfield>relfrozenxid<
/> field has reached
4014 the age specified by this setting. The default is
150 million
4015 transactions. Although users can set this value anywhere from zero to
4016 one billion,
<command>VACUUM<
/> will silently limit the effective value
4017 to
95% of
<xref linkend=
"guc-autovacuum-freeze-max-age">, so that a
4018 periodical manual
<command>VACUUM<
/> has a chance to run before an
4019 anti-wraparound autovacuum is launched for the table. For more
4021 <xref linkend=
"vacuum-for-wraparound">.
4026 <varlistentry id=
"guc-vacuum-freeze-min-age" xreflabel=
"vacuum_freeze_min_age">
4027 <term><varname>vacuum_freeze_min_age
</varname> (
<type>integer
</type>)
</term>
4029 <primary><varname>vacuum_freeze_min_age<
/> configuration parameter
</primary>
4033 Specifies the cutoff age (in transactions) that
<command>VACUUM<
/>
4034 should use to decide whether to replace transaction IDs with
4035 <literal>FrozenXID<
/> while scanning a table.
4036 The default is
50 million transactions. Although
4037 users can set this value anywhere from zero to one billion,
4038 <command>VACUUM<
/> will silently limit the effective value to half
4039 the value of
<xref linkend=
"guc-autovacuum-freeze-max-age">, so
4040 that there is not an unreasonably short time between forced
4041 autovacuums. For more information see
<xref
4042 linkend=
"vacuum-for-wraparound">.
4047 <varlistentry id=
"guc-xmlbinary" xreflabel=
"xmlbinary">
4048 <term><varname>xmlbinary
</varname> (
<type>enum
</type>)
</term>
4050 <primary><varname>xmlbinary<
/> configuration parameter
</primary>
4054 Sets how binary values are to be encoded in XML. This applies
4055 for example when
<type>bytea
</type> values are converted to
4056 XML by the functions
<function>xmlelement
</function> or
4057 <function>xmlforest
</function>. Possible values are
4058 <literal>base64
</literal> and
<literal>hex
</literal>, which
4059 are both defined in the XML Schema standard. The default is
4060 <literal>base64
</literal>. For further information about
4061 XML-related functions, see
<xref linkend=
"functions-xml">.
4065 The actual choice here is mostly a matter of taste,
4066 constrained only by possible restrictions in client
4067 applications. Both methods support all possible values,
4068 although the hex encoding will be somewhat larger than the
4074 <varlistentry id=
"guc-xmloption" xreflabel=
"xmloption">
4075 <term><varname>xmloption
</varname> (
<type>enum
</type>)
</term>
4077 <primary><varname>xmloption<
/> configuration parameter
</primary>
4080 <primary><varname>SET XML OPTION<
/></primary>
4083 <primary>XML option
</primary>
4087 Sets whether
<literal>DOCUMENT
</literal> or
4088 <literal>CONTENT
</literal> is implicit when converting between
4089 XML and character string values. See
<xref
4090 linkend=
"datatype-xml"> for a description of this. Valid
4091 values are
<literal>DOCUMENT
</literal> and
4092 <literal>CONTENT
</literal>. The default is
4093 <literal>CONTENT
</literal>.
4097 According to the SQL standard, the command to set this option is
4099 SET XML OPTION { DOCUMENT | CONTENT };
4101 This syntax is also available in PostgreSQL.
4108 <sect2 id=
"runtime-config-client-format">
4109 <title>Locale and Formatting
</title>
4113 <varlistentry id=
"guc-datestyle" xreflabel=
"DateStyle">
4114 <term><varname>DateStyle
</varname> (
<type>string
</type>)
</term>
4116 <primary><varname>DateStyle<
/> configuration parameter
</primary>
4120 Sets the display format for date and time values, as well as the
4121 rules for interpreting ambiguous date input values. For
4122 historical reasons, this variable contains two independent
4123 components: the output format specification (
<literal>ISO<
/>,
4124 <literal>Postgres<
/>,
<literal>SQL<
/>, or
<literal>German<
/>)
4125 and the input/output specification for year/month/day ordering
4126 (
<literal>DMY<
/>,
<literal>MDY<
/>, or
<literal>YMD<
/>). These
4127 can be set separately or together. The keywords
<literal>Euro<
/>
4128 and
<literal>European<
/> are synonyms for
<literal>DMY<
/>; the
4129 keywords
<literal>US<
/>,
<literal>NonEuro<
/>, and
4130 <literal>NonEuropean<
/> are synonyms for
<literal>MDY<
/>. See
4131 <xref linkend=
"datatype-datetime"> for more information. The
4132 built-in default is
<literal>ISO, MDY<
/>, but
4133 <application>initdb
</application> will initialize the
4134 configuration file with a setting that corresponds to the
4135 behavior of the chosen
<varname>lc_time
</varname> locale.
4140 <varlistentry id=
"guc-intervalstyle" xreflabel=
"IntervalStyle">
4141 <term><varname>IntervalStyle
</varname> (
<type>enum
</type>)
</term>
4143 <primary><varname>IntervalStyle<
/> configuration parameter
</primary>
4147 Sets the display format for interval values.
4148 The value
<literal>sql_standard<
/> will produce
4149 output matching
<acronym>SQL
</acronym> standard interval literals.
4150 The value
<literal>postgres<
/> (which is the default) will produce
4151 output matching
<productname>PostgreSQL<
/> releases prior to
8.4
4152 when the
<xref linkend=
"guc-datestyle">
4153 parameter was set to
<literal>ISO<
/>.
4154 The value
<literal>postgres_verbose<
/> will produce output
4155 matching
<productname>PostgreSQL<
/> releases prior to
8.4
4156 when the
<varname>DateStyle<
/>
4157 parameter was set to non-
<literal>ISO<
/> output.
4158 The value
<literal>iso_8601<
/> will produce output matching the time
4159 interval
<quote>format with designators<
/> defined in section
4160 4.4.3.2 of ISO
8601.
4163 The
<varname>IntervalStyle<
/> parameter also affects the
4164 interpretation of ambiguous interval input. See
4165 <xref linkend=
"datatype-interval-input"> for more information.
4170 <varlistentry id=
"guc-timezone" xreflabel=
"timezone">
4171 <term><varname>timezone
</varname> (
<type>string
</type>)
</term>
4173 <primary><varname>timezone<
/> configuration parameter
</primary>
4175 <indexterm><primary>time zone<
/><
/>
4178 Sets the time zone for displaying and interpreting time stamps.
4179 The default is
<literal>unknown<
/>, which means to use whatever
4180 the system environment specifies as the time zone. See
<xref
4181 linkend=
"datatype-timezones"> for more
4187 <varlistentry id=
"guc-timezone-abbreviations" xreflabel=
"timezone_abbreviations">
4188 <term><varname>timezone_abbreviations
</varname> (
<type>string
</type>)
</term>
4190 <primary><varname>timezone_abbreviations<
/> configuration parameter
</primary>
4192 <indexterm><primary>time zone names<
/><
/>
4195 Sets the collection of time zone abbreviations that will be accepted
4196 by the server for datetime input. The default is
<literal>'Default'<
/>,
4197 which is a collection that works in most of the world; there are
4198 also 'Australia' and 'India', and other collections can be defined
4199 for a particular installation. See
<xref
4200 linkend=
"datetime-appendix"> for more information.
4205 <varlistentry id=
"guc-extra-float-digits" xreflabel=
"extra_float_digits">
4207 <primary>significant digits
</primary>
4210 <primary>floating-point
</primary>
4211 <secondary>display
</secondary>
4214 <primary><varname>extra_float_digits<
/> configuration parameter
</primary>
4217 <term><varname>extra_float_digits
</varname> (
<type>integer
</type>)
</term>
4220 This parameter adjusts the number of digits displayed for
4221 floating-point values, including
<type>float4<
/>,
<type>float8<
/>,
4222 and geometric data types. The parameter value is added to the
4223 standard number of digits (
<literal>FLT_DIG<
/> or
<literal>DBL_DIG<
/>
4224 as appropriate). The value can be set as high as
2, to include
4225 partially-significant digits; this is especially useful for dumping
4226 float data that needs to be restored exactly. Or it can be set
4227 negative to suppress unwanted digits.
4232 <varlistentry id=
"guc-client-encoding" xreflabel=
"client_encoding">
4233 <term><varname>client_encoding
</varname> (
<type>string
</type>)
</term>
4235 <primary><varname>client_encoding<
/> configuration parameter
</primary>
4237 <indexterm><primary>character set<
/><
/>
4240 Sets the client-side encoding (character set).
4241 The default is to use the database encoding.
4246 <varlistentry id=
"guc-lc-messages" xreflabel=
"lc_messages">
4247 <term><varname>lc_messages
</varname> (
<type>string
</type>)
</term>
4249 <primary><varname>lc_messages<
/> configuration parameter
</primary>
4253 Sets the language in which messages are displayed. Acceptable
4254 values are system-dependent; see
<xref linkend=
"locale"> for
4255 more information. If this variable is set to the empty string
4256 (which is the default) then the value is inherited from the
4257 execution environment of the server in a system-dependent way.
4261 On some systems, this locale category does not exist. Setting
4262 this variable will still work, but there will be no effect.
4263 Also, there is a chance that no translated messages for the
4264 desired language exist. In that case you will continue to see
4265 the English messages.
4269 Only superusers can change this setting, because it affects the
4270 messages sent to the server log as well as to the client.
4275 <varlistentry id=
"guc-lc-monetary" xreflabel=
"lc_monetary">
4276 <term><varname>lc_monetary
</varname> (
<type>string
</type>)
</term>
4278 <primary><varname>lc_monetary<
/> configuration parameter
</primary>
4282 Sets the locale to use for formatting monetary amounts, for
4283 example with the
<function>to_char
</function> family of
4284 functions. Acceptable values are system-dependent; see
<xref
4285 linkend=
"locale"> for more information. If this variable is
4286 set to the empty string (which is the default) then the value
4287 is inherited from the execution environment of the server in a
4288 system-dependent way.
4293 <varlistentry id=
"guc-lc-numeric" xreflabel=
"lc_numeric">
4294 <term><varname>lc_numeric
</varname> (
<type>string
</type>)
</term>
4296 <primary><varname>lc_numeric<
/> configuration parameter
</primary>
4300 Sets the locale to use for formatting numbers, for example
4301 with the
<function>to_char
</function> family of
4302 functions. Acceptable values are system-dependent; see
<xref
4303 linkend=
"locale"> for more information. If this variable is
4304 set to the empty string (which is the default) then the value
4305 is inherited from the execution environment of the server in a
4306 system-dependent way.
4311 <varlistentry id=
"guc-lc-time" xreflabel=
"lc_time">
4312 <term><varname>lc_time
</varname> (
<type>string
</type>)
</term>
4314 <primary><varname>lc_time<
/> configuration parameter
</primary>
4318 Sets the locale to use for formatting dates and times, for example
4319 with the
<function>to_char
</function> family of
4320 functions. Acceptable values are system-dependent; see
<xref
4321 linkend=
"locale"> for more information. If this variable is
4322 set to the empty string (which is the default) then the value
4323 is inherited from the execution environment of the server in a
4324 system-dependent way.
4329 <varlistentry id=
"guc-default-text-search-config" xreflabel=
"default_text_search_config">
4330 <term><varname>default_text_search_config
</varname> (
<type>string
</type>)
</term>
4332 <primary><varname>default_text_search_config<
/> configuration parameter
</primary>
4336 Selects the text search configuration that is used by those variants
4337 of the text search functions that do not have an explicit argument
4338 specifying the configuration.
4339 See
<xref linkend=
"textsearch"> for further information.
4340 The built-in default is
<literal>pg_catalog.simple<
/>, but
4341 <application>initdb
</application> will initialize the
4342 configuration file with a setting that corresponds to the
4343 chosen
<varname>lc_ctype
</varname> locale, if a configuration
4344 matching that locale can be identified.
4352 <sect2 id=
"runtime-config-client-other">
4353 <title>Other Defaults
</title>
4357 <varlistentry id=
"guc-dynamic-library-path" xreflabel=
"dynamic_library_path">
4358 <term><varname>dynamic_library_path
</varname> (
<type>string
</type>)
</term>
4360 <primary><varname>dynamic_library_path<
/> configuration parameter
</primary>
4362 <indexterm><primary>dynamic loading<
/><
/>
4365 If a dynamically loadable module needs to be opened and the
4366 file name specified in the
<command>CREATE FUNCTION
</command> or
4367 <command>LOAD
</command> command
4368 does not have a directory component (i.e., the
4369 name does not contain a slash), the system will search this
4370 path for the required file.
4374 The value for
<varname>dynamic_library_path
</varname> has to be a
4375 list of absolute directory paths separated by colons (or semi-colons
4376 on Windows). If a list element starts
4377 with the special string
<literal>$libdir
</literal>, the
4378 compiled-in
<productname>PostgreSQL
</productname> package
4379 library directory is substituted for
<literal>$libdir
</literal>. This
4380 is where the modules provided by the standard
4381 <productname>PostgreSQL
</productname> distribution are installed.
4382 (Use
<literal>pg_config --pkglibdir
</literal> to find out the name of
4383 this directory.) For example:
4385 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
4387 or, in a Windows environment:
4389 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
4394 The default value for this parameter is
4395 <literal>'$libdir'
</literal>. If the value is set to an empty
4396 string, the automatic path search is turned off.
4400 This parameter can be changed at run time by superusers, but a
4401 setting done that way will only persist until the end of the
4402 client connection, so this method should be reserved for
4403 development purposes. The recommended way to set this parameter
4404 is in the
<filename>postgresql.conf
</filename> configuration
4410 <varlistentry id=
"guc-gin-fuzzy-search-limit" xreflabel=
"gin_fuzzy_search_limit">
4411 <term><varname>gin_fuzzy_search_limit
</varname> (
<type>integer
</type>)
</term>
4413 <primary><varname>gin_fuzzy_search_limit<
/> configuration parameter
</primary>
4417 Soft upper limit of the size of the set returned by GIN index. For more
4418 information see
<xref linkend=
"gin-tips">.
4423 <varlistentry id=
"guc-local-preload-libraries" xreflabel=
"local_preload_libraries">
4424 <term><varname>local_preload_libraries
</varname> (
<type>string
</type>)
</term>
4426 <primary><varname>local_preload_libraries<
/> configuration parameter
</primary>
4429 <primary><filename>$libdir/plugins<
/></primary>
4433 This variable specifies one or more shared libraries that are
4434 to be preloaded at connection start. If more than one library
4435 is to be loaded, separate their names with commas.
4436 This parameter cannot be changed after the start of a particular
4441 Because this is not a superuser-only option, the libraries
4442 that can be loaded are restricted to those appearing in the
4443 <filename>plugins<
/> subdirectory of the installation's
4444 standard library directory. (It is the database administrator's
4445 responsibility to ensure that only
<quote>safe<
/> libraries
4446 are installed there.) Entries in
<varname>local_preload_libraries<
/>
4447 can specify this directory explicitly, for example
4448 <literal>$libdir/plugins/mylib
</literal>, or just specify
4449 the library name
— <literal>mylib
</literal> would have
4450 the same effect as
<literal>$libdir/plugins/mylib
</literal>.
4454 There is no performance advantage to loading a library at session
4455 start rather than when it is first used. Rather, the intent of
4456 this feature is to allow debugging or performance-measurement
4457 libraries to be loaded into specific sessions without an explicit
4458 <command>LOAD<
/> command being given. For example, debugging could
4459 be enabled for all sessions under a given user name by setting
4460 this parameter with
<command>ALTER USER SET<
/>.
4464 If a specified library is not found,
4465 the connection attempt will fail.
4469 Every PostgreSQL-supported library has a
<quote>magic
4470 block<
/> that is checked to guarantee compatibility.
4471 For this reason, non-PostgreSQL libraries cannot be
4481 <sect1 id=
"runtime-config-locks">
4482 <title>Lock Management
</title>
4486 <varlistentry id=
"guc-deadlock-timeout" xreflabel=
"deadlock_timeout">
4488 <primary>deadlock
</primary>
4489 <secondary>timeout during
</secondary>
4492 <primary>timeout
</primary>
4493 <secondary>deadlock
</secondary>
4496 <primary><varname>deadlock_timeout<
/> configuration parameter
</primary>
4499 <term><varname>deadlock_timeout
</varname> (
<type>integer
</type>)
</term>
4502 This is the amount of time, in milliseconds, to wait on a lock
4503 before checking to see if there is a deadlock condition. The
4504 check for deadlock is relatively slow, so the server doesn't run
4505 it every time it waits for a lock. We optimistically assume
4506 that deadlocks are not common in production applications and
4507 just wait on the lock for a while before starting the check for a
4508 deadlock. Increasing this value reduces the amount of time
4509 wasted in needless deadlock checks, but slows down reporting of
4510 real deadlock errors. The default is one second (
<literal>1s<
/>),
4511 which is probably about the smallest value you would want in
4512 practice. On a heavily loaded server you might want to raise it.
4513 Ideally the setting should exceed your typical transaction time,
4514 so as to improve the odds that a lock will be released before
4515 the waiter decides to check for deadlock.
4519 When
<xref linkend=
"guc-log-lock-waits"> is set,
4520 this parameter also determines the length of time to wait before
4521 a log message is issued about the lock wait. If you are trying
4522 to investigate locking delays you might want to set a shorter than
4523 normal
<varname>deadlock_timeout
</varname>.
4528 <varlistentry id=
"guc-max-locks-per-transaction" xreflabel=
"max_locks_per_transaction">
4529 <term><varname>max_locks_per_transaction
</varname> (
<type>integer
</type>)
</term>
4531 <primary><varname>max_locks_per_transaction<
/> configuration parameter
</primary>
4535 The shared lock table is created to track locks on
4536 <varname>max_locks_per_transaction
</varname> * (
<xref
4537 linkend=
"guc-max-connections"> +
<xref
4538 linkend=
"guc-max-prepared-transactions">) objects (e.g., tables);
4539 hence, no more than this many distinct objects can be locked at
4540 any one time. This parameter controls the average number of object
4541 locks allocated for each transaction; individual transactions
4542 can lock more objects as long as the locks of all transactions
4543 fit in the lock table. This is
<emphasis>not<
/> the number of
4544 rows that can be locked; that value is unlimited. The default,
4545 64, has historically proven sufficient, but you might need to
4546 raise this value if you have clients that touch many different
4547 tables in a single transaction. This parameter can only be set at
4552 Increasing this parameter might cause
<productname>PostgreSQL<
/>
4553 to request more
<systemitem class=
"osname">System V<
/> shared
4554 memory than your operating system's default configuration
4555 allows. See
<xref linkend=
"sysvipc"> for information on how to
4556 adjust those parameters, if necessary.
4564 <sect1 id=
"runtime-config-compatible">
4565 <title>Version and Platform Compatibility
</title>
4567 <sect2 id=
"runtime-config-compatible-version">
4568 <title>Previous PostgreSQL Versions
</title>
4572 <varlistentry id=
"guc-add-missing-from" xreflabel=
"add_missing_from">
4573 <term><varname>add_missing_from
</varname> (
<type>boolean
</type>)
</term>
4574 <indexterm><primary>FROM<
/><secondary>missing<
/><
/>
4576 <primary><varname>add_missing_from<
/> configuration parameter
</primary>
4580 When on, tables that are referenced by a query will be
4581 automatically added to the
<literal>FROM<
/> clause if not
4582 already present. This behavior does not comply with the SQL
4583 standard and many people dislike it because it can mask mistakes
4584 (such as referencing a table where you should have referenced
4585 its alias). The default is
<literal>off<
/>. This variable can be
4586 enabled for compatibility with releases of
4587 <productname>PostgreSQL<
/> prior to
8.1, where this behavior was
4592 Note that even when this variable is enabled, a warning
4593 message will be emitted for each implicit
<literal>FROM<
/>
4594 entry referenced by a query. Users are encouraged to update
4595 their applications to not rely on this behavior, by adding all
4596 tables referenced by a query to the query's
<literal>FROM<
/>
4597 clause (or its
<literal>USING<
/> clause in the case of
4598 <command>DELETE<
/>).
4603 <varlistentry id=
"guc-array-nulls" xreflabel=
"array_nulls">
4604 <term><varname>array_nulls
</varname> (
<type>boolean
</type>)
</term>
4606 <primary><varname>array_nulls<
/> configuration parameter
</primary>
4610 This controls whether the array input parser recognizes
4611 unquoted
<literal>NULL<
/> as specifying a null array element.
4612 By default, this is
<literal>on<
/>, allowing array values containing
4613 null values to be entered. However,
<productname>PostgreSQL<
/> versions
4614 before
8.2 did not support null values in arrays, and therefore would
4615 treat
<literal>NULL<
/> as specifying a normal array element with
4616 the string value
<quote>NULL<
/>. For backwards compatibility with
4617 applications that require the old behavior, this variable can be
4618 turned
<literal>off<
/>.
4622 Note that it is possible to create array values containing null values
4623 even when this variable is
<literal>off<
/>.
4628 <varlistentry id=
"guc-backslash-quote" xreflabel=
"backslash_quote">
4629 <term><varname>backslash_quote
</varname> (
<type>enum
</type>)
</term>
4630 <indexterm><primary>strings<
/><secondary>backslash quotes<
/><
/>
4632 <primary><varname>backslash_quote<
/> configuration parameter
</primary>
4636 This controls whether a quote mark can be represented by
4637 <literal>\'<
/> in a string literal. The preferred, SQL-standard way
4638 to represent a quote mark is by doubling it (
<literal>''<
/>) but
4639 <productname>PostgreSQL<
/> has historically also accepted
4640 <literal>\'<
/>. However, use of
<literal>\'<
/> creates security risks
4641 because in some client character set encodings, there are multibyte
4642 characters in which the last byte is numerically equivalent to ASCII
4643 <literal>\<
/>. If client-side code does escaping incorrectly then a
4644 SQL-injection attack is possible. This risk can be prevented by
4645 making the server reject queries in which a quote mark appears to be
4646 escaped by a backslash.
4647 The allowed values of
<varname>backslash_quote<
/> are
4648 <literal>on<
/> (allow
<literal>\'<
/> always),
4649 <literal>off<
/> (reject always), and
4650 <literal>safe_encoding<
/> (allow only if client encoding does not
4651 allow ASCII
<literal>\<
/> within a multibyte character).
4652 <literal>safe_encoding<
/> is the default setting.
4656 Note that in a standard-conforming string literal,
<literal>\<
/> just
4657 means
<literal>\<
/> anyway. This parameter affects the handling of
4658 non-standard-conforming literals, including
4659 escape string syntax (
<literal>E'...'<
/>).
4664 <varlistentry id=
"guc-default-with-oids" xreflabel=
"default_with_oids">
4665 <term><varname>default_with_oids
</varname> (
<type>boolean
</type>)
</term>
4667 <primary><varname>default_with_oids<
/> configuration parameter
</primary>
4671 This controls whether
<command>CREATE TABLE
</command> and
4672 <command>CREATE TABLE AS
</command> include an OID column in
4673 newly-created tables, if neither
<literal>WITH OIDS
</literal>
4674 nor
<literal>WITHOUT OIDS
</literal> is specified. It also
4675 determines whether OIDs will be included in tables created by
4676 <command>SELECT INTO
</command>. In
<productname>PostgreSQL<
/>
4677 8.1 <varname>default_with_oids<
/> is
<literal>off<
/> by default; in
4678 prior versions of
<productname>PostgreSQL
</productname>, it
4683 The use of OIDs in user tables is considered deprecated, so
4684 most installations should leave this variable disabled.
4685 Applications that require OIDs for a particular table should
4686 specify
<literal>WITH OIDS
</literal> when creating the
4687 table. This variable can be enabled for compatibility with old
4688 applications that do not follow this behavior.
4693 <varlistentry id=
"guc-escape-string-warning" xreflabel=
"escape_string_warning">
4694 <term><varname>escape_string_warning
</varname> (
<type>boolean
</type>)
</term>
4695 <indexterm><primary>strings<
/><secondary>escape warning<
/><
/>
4697 <primary><varname>escape_string_warning<
/> configuration parameter
</primary>
4701 When on, a warning is issued if a backslash (
<literal>\<
/>)
4702 appears in an ordinary string literal (
<literal>'...'<
/>
4703 syntax) and
<varname>standard_conforming_strings
</varname> is off.
4704 The default is
<literal>on<
/>.
4707 Applications that wish to use backslash as escape should be
4708 modified to use escape string syntax (
<literal>E'...'<
/>),
4709 because the default behavior of ordinary strings will change
4710 in a future release for SQL compatibility. This variable can
4711 be enabled to help detect applications that will break.
4716 <varlistentry id=
"guc-regex-flavor" xreflabel=
"regex_flavor">
4717 <term><varname>regex_flavor
</varname> (
<type>enum
</type>)
</term>
4718 <indexterm><primary>regular expressions<
/><
/>
4720 <primary><varname>regex_flavor<
/> configuration parameter
</primary>
4724 The regular expression
<quote>flavor<
/> can be set to
4725 <literal>advanced<
/>,
<literal>extended<
/>, or
<literal>basic<
/>.
4726 The default is
<literal>advanced<
/>. The
<literal>extended<
/>
4727 setting might be useful for exact backwards compatibility with
4728 pre-
7.4 releases of
<productname>PostgreSQL<
/>. See
4729 <xref linkend=
"posix-syntax-details"> for details.
4734 <varlistentry id=
"guc-sql-inheritance" xreflabel=
"sql_inheritance">
4735 <term><varname>sql_inheritance
</varname> (
<type>boolean
</type>)
</term>
4737 <primary><varname>sql_inheritance<
/> configuration parameter
</primary>
4739 <indexterm><primary>inheritance<
/><
/>
4742 This controls the inheritance semantics. If turned
<literal>off<
/>,
4743 subtables are not included by various commands by default; basically
4744 an implied
<literal>ONLY
</literal> key word. This was added for
4745 compatibility with releases prior to
7.1. See
4746 <xref linkend=
"ddl-inherit"> for more information.
4751 <varlistentry id=
"guc-standard-conforming-strings" xreflabel=
"standard_conforming_strings">
4752 <term><varname>standard_conforming_strings
</varname> (
<type>boolean
</type>)
</term>
4753 <indexterm><primary>strings<
/><secondary>standard conforming<
/><
/>
4755 <primary><varname>standard_conforming_strings<
/> configuration parameter
</primary>
4759 This controls whether ordinary string literals
4760 (
<literal>'...'<
/>) treat backslashes literally, as specified in
4762 The default is currently
<literal>off<
/>, causing
4763 <productname>PostgreSQL
</productname> to have its historical
4764 behavior of treating backslashes as escape characters.
4765 The default will change to
<literal>on<
/> in a future release
4766 to improve compatibility with the standard.
4767 Applications can check this
4768 parameter to determine how string literals will be processed.
4769 The presence of this parameter can also be taken as an indication
4770 that the escape string syntax (
<literal>E'...'<
/>) is supported.
4771 Escape string syntax should be used if an application desires
4772 backslashes to be treated as escape characters.
4777 <varlistentry id=
"guc-synchronize-seqscans" xreflabel=
"synchronize_seqscans">
4778 <term><varname>synchronize_seqscans
</varname> (
<type>boolean
</type>)
</term>
4780 <primary><varname>synchronize_seqscans<
/> configuration parameter
</primary>
4784 This allows sequential scans of large tables to synchronize with each
4785 other, so that concurrent scans read the same block at about the
4786 same time and hence share the I/O workload. When this is enabled,
4787 a scan might start in the middle of the table and then
<quote>wrap
4788 around<
/> the end to cover all rows, so as to synchronize with the
4789 activity of scans already in progress. This can result in
4790 unpredictable changes in the row ordering returned by queries that
4791 have no
<literal>ORDER BY<
/> clause. Setting this parameter to
4792 <literal>off<
/> ensures the pre-
8.3 behavior in which a sequential
4793 scan always starts from the beginning of the table. The default
4802 <sect2 id=
"runtime-config-compatible-clients">
4803 <title>Platform and Client Compatibility
</title>
4806 <varlistentry id=
"guc-transform-null-equals" xreflabel=
"transform_null_equals">
4807 <term><varname>transform_null_equals
</varname> (
<type>boolean
</type>)
</term>
4808 <indexterm><primary>IS NULL<
/><
/>
4810 <primary><varname>transform_null_equals<
/> configuration parameter
</primary>
4814 When on, expressions of the form
<literal><replaceable>expr<
/> =
4815 NULL
</literal> (or
<literal>NULL =
4816 <replaceable>expr<
/></literal>) are treated as
4817 <literal><replaceable>expr<
/> IS NULL
</literal>, that is, they
4818 return true if
<replaceable>expr<
/> evaluates to the null value,
4819 and false otherwise. The correct SQL-spec-compliant behavior of
4820 <literal><replaceable>expr<
/> = NULL
</literal> is to always
4821 return null (unknown). Therefore this parameter defaults to
4826 However, filtered forms in
<productname>Microsoft
4827 Access
</productname> generate queries that appear to use
4828 <literal><replaceable>expr<
/> = NULL
</literal> to test for
4829 null values, so if you use that interface to access the database you
4830 might want to turn this option on. Since expressions of the
4831 form
<literal><replaceable>expr<
/> = NULL
</literal> always
4832 return the null value (using the correct interpretation) they are not
4833 very useful and do not appear often in normal applications, so
4834 this option does little harm in practice. But new users are
4835 frequently confused about the semantics of expressions
4836 involving null values, so this option is not on by default.
4840 Note that this option only affects the exact form
<literal>= NULL<
/>,
4841 not other comparison operators or other expressions
4842 that are computationally equivalent to some expression
4843 involving the equals operator (such as
<literal>IN
</literal>).
4844 Thus, this option is not a general fix for bad programming.
4848 Refer to
<xref linkend=
"functions-comparison"> for related information.
4857 <sect1 id=
"runtime-config-preset">
4858 <title>Preset Options
</title>
4861 The following
<quote>parameters<
/> are read-only, and are determined
4862 when
<productname>PostgreSQL
</productname> is compiled or when it is
4863 installed. As such, they have been excluded from the sample
4864 <filename>postgresql.conf<
/> file. These options report
4865 various aspects of
<productname>PostgreSQL
</productname> behavior
4866 that might be of interest to certain applications, particularly
4867 administrative front-ends.
4872 <varlistentry id=
"guc-block-size" xreflabel=
"block_size">
4873 <term><varname>block_size
</varname> (
<type>integer
</type>)
</term>
4875 <primary><varname>block_size<
/> configuration parameter
</primary>
4879 Reports the size of a disk block. It is determined by the value
4880 of
<literal>BLCKSZ<
/> when building the server. The default
4881 value is
8192 bytes. The meaning of some configuration
4882 variables (such as
<xref linkend=
"guc-shared-buffers">) is
4883 influenced by
<varname>block_size
</varname>. See
<xref
4884 linkend=
"runtime-config-resource"> for information.
4889 <varlistentry id=
"guc-integer-datetimes" xreflabel=
"integer_datetimes">
4890 <term><varname>integer_datetimes
</varname> (
<type>boolean
</type>)
</term>
4892 <primary><varname>integer_datetimes<
/> configuration parameter
</primary>
4896 Reports whether
<productname>PostgreSQL<
/> was built with
4897 support for
64-bit-integer dates and times. This can be
4898 disabled by configuring with
<literal>--disable-integer-datetimes<
/>
4899 when building
<productname>PostgreSQL<
/>. The default value is
4900 <literal>on
</literal>.
4905 <varlistentry id=
"guc-lc-collate" xreflabel=
"lc_collate">
4906 <term><varname>lc_collate
</varname> (
<type>string
</type>)
</term>
4908 <primary><varname>lc_collate<
/> configuration parameter
</primary>
4912 Reports the locale in which sorting of textual data is done.
4913 See
<xref linkend=
"locale"> for more information.
4914 This value is determined when a database is created.
4919 <varlistentry id=
"guc-lc-ctype" xreflabel=
"lc_ctype">
4920 <term><varname>lc_ctype
</varname> (
<type>string
</type>)
</term>
4922 <primary><varname>lc_ctype<
/> configuration parameter
</primary>
4926 Reports the locale that determines character classifications.
4927 See
<xref linkend=
"locale"> for more information.
4928 This value is determined when a database is created.
4929 Ordinarily this will be the same as
<varname>lc_collate
</varname>,
4930 but for special applications it might be set differently.
4935 <varlistentry id=
"guc-max-function-args" xreflabel=
"max_function_args">
4936 <term><varname>max_function_args
</varname> (
<type>integer
</type>)
</term>
4938 <primary><varname>max_function_args<
/> configuration parameter
</primary>
4942 Reports the maximum number of function arguments. It is determined by
4943 the value of
<literal>FUNC_MAX_ARGS<
/> when building the server. The
4944 default value is
100 arguments.
4949 <varlistentry id=
"guc-max-identifier-length" xreflabel=
"max_identifier_length">
4950 <term><varname>max_identifier_length
</varname> (
<type>integer
</type>)
</term>
4952 <primary><varname>max_identifier_length<
/> configuration parameter
</primary>
4956 Reports the maximum identifier length. It is determined as one
4957 less than the value of
<literal>NAMEDATALEN<
/> when building
4958 the server. The default value of
<literal>NAMEDATALEN<
/> is
4959 64; therefore the default
4960 <varname>max_identifier_length
</varname> is
63 bytes.
4965 <varlistentry id=
"guc-max-index-keys" xreflabel=
"max_index_keys">
4966 <term><varname>max_index_keys
</varname> (
<type>integer
</type>)
</term>
4968 <primary><varname>max_index_keys<
/> configuration parameter
</primary>
4972 Reports the maximum number of index keys. It is determined by
4973 the value of
<literal>INDEX_MAX_KEYS<
/> when building the server. The
4974 default value is
32 keys.
4979 <varlistentry id=
"guc-segment-size" xreflabel=
"segment_size">
4980 <term><varname>segment_size
</varname> (
<type>integer
</type>)
</term>
4982 <primary><varname>segment_size<
/> configuration parameter
</primary>
4986 Reports the number of blocks (pages) that can be stored within a file
4987 segment. It is determined by the value of
<literal>RELSEG_SIZE<
/>
4988 when building the server. The maximum size of a segment file in bytes
4989 is equal to
<varname>segment_size<
/> multiplied by
4990 <varname>block_size<
/>; by default this is
1GB.
4995 <varlistentry id=
"guc-server-encoding" xreflabel=
"server_encoding">
4996 <term><varname>server_encoding
</varname> (
<type>string
</type>)
</term>
4998 <primary><varname>server_encoding<
/> configuration parameter
</primary>
5000 <indexterm><primary>character set<
/><
/>
5003 Reports the database encoding (character set).
5004 It is determined when the database is created. Ordinarily,
5005 clients need only be concerned with the value of
<xref
5006 linkend=
"guc-client-encoding">.
5011 <varlistentry id=
"guc-server-version" xreflabel=
"server_version">
5012 <term><varname>server_version
</varname> (
<type>string
</type>)
</term>
5014 <primary><varname>server_version<
/> configuration parameter
</primary>
5018 Reports the version number of the server. It is determined by the
5019 value of
<literal>PG_VERSION<
/> when building the server.
5024 <varlistentry id=
"guc-server-version-num" xreflabel=
"server_version_num">
5025 <term><varname>server_version_num
</varname> (
<type>integer
</type>)
</term>
5027 <primary><varname>server_version_num<
/> configuration parameter
</primary>
5031 Reports the version number of the server as an integer. It is determined
5032 by the value of
<literal>PG_VERSION_NUM<
/> when building the server.
5037 <varlistentry id=
"guc-wal-block-size" xreflabel=
"wal_block_size">
5038 <term><varname>wal_block_size
</varname> (
<type>integer
</type>)
</term>
5040 <primary><varname>wal_block_size<
/> configuration parameter
</primary>
5044 Reports the size of a WAL disk block. It is determined by the value
5045 of
<literal>XLOG_BLCKSZ<
/> when building the server. The default value
5051 <varlistentry id=
"guc-wal-segment-size" xreflabel=
"wal_segment_size">
5052 <term><varname>wal_segment_size
</varname> (
<type>integer
</type>)
</term>
5054 <primary><varname>wal_segment_size<
/> configuration parameter
</primary>
5058 Reports the number of blocks (pages) in a WAL segment file.
5059 The total size of a WAL segment file in bytes is equal to
5060 <varname>wal_segment_size<
/> multiplied by
<varname>wal_block_size<
/>;
5061 by default this is
16MB. See
<xref linkend=
"wal-configuration"> for
5070 <sect1 id=
"runtime-config-custom">
5071 <title>Customized Options
</title>
5074 This feature was designed to allow parameters not normally known to
5075 <productname>PostgreSQL
</productname> to be added by add-on modules
5076 (such as procedural languages). This allows add-on modules to be
5077 configured in the standard ways.
5082 <varlistentry id=
"guc-custom-variable-classes" xreflabel=
"custom_variable_classes">
5083 <term><varname>custom_variable_classes
</varname> (
<type>string
</type>)
</term>
5085 <primary><varname>custom_variable_classes<
/> configuration parameter
</primary>
5089 This variable specifies one or several class names to be used for
5090 custom variables, in the form of a comma-separated list. A custom
5091 variable is a variable not normally known
5092 to
<productname>PostgreSQL
</productname> proper but used by some
5093 add-on module. Such variables must have names consisting of a class
5094 name, a dot, and a variable name.
<varname>custom_variable_classes<
/>
5095 specifies all the class names in use in a particular installation.
5096 This parameter can only be set in the
<filename>postgresql.conf<
/>
5097 file or on the server command line.
5105 The difficulty with setting custom variables in
5106 <filename>postgresql.conf<
/> is that the file must be read before add-on
5107 modules have been loaded, and so custom variables would ordinarily be
5108 rejected as unknown. When
<varname>custom_variable_classes<
/> is set,
5109 the server will accept definitions of arbitrary variables within each
5110 specified class. These variables will be treated as placeholders and
5111 will have no function until the module that defines them is loaded. When a
5112 module for a specific class is loaded, it will add the proper variable
5113 definitions for its class name, convert any placeholder
5114 values according to those definitions, and issue warnings for any
5115 placeholders of its class that remain (which presumably would be
5116 misspelled configuration variables).
5120 Here is an example of what
<filename>postgresql.conf<
/> might contain
5121 when using custom variables:
5124 custom_variable_classes = 'plr,plperl'
5125 plr.path = '/usr/lib/R'
5126 plperl.use_strict = true
5127 plruby.use_strict = true # generates error: unknown class name
5132 <sect1 id=
"runtime-config-developer">
5133 <title>Developer Options
</title>
5136 The following parameters are intended for work on the
5137 <productname>PostgreSQL
</productname> source, and in some cases
5138 to assist with recovery of severely damaged databases. There
5139 should be no reason to use them in a production database setup.
5140 As such, they have been excluded from the sample
5141 <filename>postgresql.conf<
/> file. Note that many of these
5142 parameters require special source compilation flags to work at all.
5146 <varlistentry id=
"guc-allow-system-table-mods" xreflabel=
"allow_system_table_mods">
5147 <term><varname>allow_system_table_mods
</varname> (
<type>boolean
</type>)
</term>
5149 <primary><varname>allow_system_table_mods
</varname> configuration parameter
</primary>
5153 Allows modification of the structure of system tables.
5154 This is used by
<command>initdb
</command>.
5155 This parameter can only be set at server start.
5160 <varlistentry id=
"guc-debug-assertions" xreflabel=
"debug_assertions">
5161 <term><varname>debug_assertions
</varname> (
<type>boolean
</type>)
</term>
5163 <primary><varname>debug_assertions<
/> configuration parameter
</primary>
5167 Turns on various assertion checks. This is a debugging aid. If
5168 you are experiencing strange problems or crashes you might want
5169 to turn this on, as it might expose programming mistakes. To use
5170 this parameter, the macro
<symbol>USE_ASSERT_CHECKING
</symbol>
5171 must be defined when
<productname>PostgreSQL
</productname> is
5172 built (accomplished by the
<command>configure
</command> option
5173 <option>--enable-cassert
</option>). Note that
5174 <varname>debug_assertions
</varname> defaults to
<literal>on<
/>
5175 if
<productname>PostgreSQL
</productname> has been built with
5181 <varlistentry id=
"guc-ignore-system-indexes" xreflabel=
"ignore_system_indexes">
5182 <term><varname>ignore_system_indexes
</varname> (
<type>boolean
</type>)
</term>
5184 <primary><varname>ignore_system_indexes
</varname> configuration parameter
</primary>
5188 Ignore system indexes when reading system tables (but still
5189 update the indexes when modifying the tables). This is useful
5190 when recovering from damaged system indexes.
5191 This parameter cannot be changed after session start.
5196 <varlistentry id=
"guc-post-auth-delay" xreflabel=
"post_auth_delay">
5197 <term><varname>post_auth_delay
</varname> (
<type>integer
</type>)
</term>
5199 <primary><varname>post_auth_delay<
/> configuration parameter
</primary>
5203 If nonzero, a delay of this many seconds occurs when a new
5204 server process is started, after it conducts the
5205 authentication procedure. This is intended to give an
5206 opportunity to attach to the server process with a debugger.
5207 This parameter cannot be changed after session start.
5212 <varlistentry id=
"guc-pre-auth-delay" xreflabel=
"pre_auth_delay">
5213 <term><varname>pre_auth_delay
</varname> (
<type>integer
</type>)
</term>
5215 <primary><varname>pre_auth_delay<
/> configuration parameter
</primary>
5219 If nonzero, a delay of this many seconds occurs just after a
5220 new server process is forked, before it conducts the
5221 authentication procedure. This is intended to give an
5222 opportunity to attach to the server process with a debugger to
5223 trace down misbehavior in authentication.
5224 This parameter can only be set in the
<filename>postgresql.conf<
/>
5225 file or on the server command line.
5230 <varlistentry id=
"guc-trace-notify" xreflabel=
"trace_notify">
5231 <term><varname>trace_notify
</varname> (
<type>boolean
</type>)
</term>
5233 <primary><varname>trace_notify<
/> configuration parameter
</primary>
5237 Generates a great amount of debugging output for the
5238 <command>LISTEN
</command> and
<command>NOTIFY
</command>
5239 commands.
<xref linkend=
"guc-client-min-messages"> or
5240 <xref linkend=
"guc-log-min-messages"> must be
5241 <literal>DEBUG1
</literal> or lower to send this output to the
5242 client or server log, respectively.
5247 <varlistentry id=
"guc-trace-sort" xreflabel=
"trace_sort">
5248 <term><varname>trace_sort
</varname> (
<type>boolean
</type>)
</term>
5250 <primary><varname>trace_sort<
/> configuration parameter
</primary>
5254 If on, emit information about resource usage during sort operations.
5255 This parameter is only available if the
<symbol>TRACE_SORT
</symbol> macro
5256 was defined when
<productname>PostgreSQL
</productname> was compiled.
5257 (However,
<symbol>TRACE_SORT
</symbol> is currently defined by default.)
5263 <term><varname>trace_locks
</varname> (
<type>boolean
</type>)
</term>
5265 <primary><varname>trace_locks<
/> configuration parameter
</primary>
5269 If on, emit information about lock usage. Information dumped
5270 includes the type of lock operation, the type of lock and the unique
5271 identifier of the object being locked or unlocked. Also included
5272 are bitmasks for the lock types already granted on this object as
5273 well as for the lock types awaited on this object. For each lock
5274 type a count of the number of granted locks and waiting locks is
5275 also dumped as well as the totals. An example of the log file output
5279 LOG: LockAcquire: new: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5280 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
5281 wait(
0) type(AccessShareLock)
5284 LOG: GrantLock: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5285 grantMask(
2) req(
1,
0,
0,
0,
0,
0,
0)=
1 grant(
1,
0,
0,
0,
0,
0,
0)=
1
5286 wait(
0) type(AccessShareLock)
5290 LOG: UnGrantLock: updated: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5291 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
5292 wait(
0) type(AccessShareLock)
5295 LOG: CleanUpLock: deleting: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5296 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
5297 wait(
0) type(INVALID)
5300 Details of the structure being dumped may be found in
5301 src/include/storage/lock.h
5304 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5305 macro was defined when
<productname>PostgreSQL
</productname> was
5312 <term><varname>trace_lwlocks
</varname> (
<type>boolean
</type>)
</term>
5314 <primary><varname>trace_lwlocks<
/> configuration parameter
</primary>
5318 If on, emit information about lightweight lock usage. Lightweight
5319 locks are intended primarily to provide mutual exclusion of access
5320 to shared-memory data structures.
5323 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5324 macro was defined when
<productname>PostgreSQL
</productname> was
5331 <term><varname>trace_userlocks
</varname> (
<type>boolean
</type>)
</term>
5333 <primary><varname>trace_userlocks<
/> configuration parameter
</primary>
5337 If on, emit information about user lock usage. Output is the same
5338 as for
<symbol>trace_locks
</symbol>, only for user locks.
5341 User locks were removed as of PostgreSQL version
8.2. This option
5342 currently has no effect.
5345 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5346 macro was defined when
<productname>PostgreSQL
</productname> was
5353 <term><varname>trace_lock_oidmin
</varname> (
<type>integer
</type>)
</term>
5355 <primary><varname>trace_lock_oidmin<
/> configuration parameter
</primary>
5359 If set, do not trace locks for tables below this OID. (use to avoid
5360 output on system tables)
5363 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5364 macro was defined when
<productname>PostgreSQL
</productname> was
5371 <term><varname>trace_lock_table
</varname> (
<type>integer
</type>)
</term>
5373 <primary><varname>trace_lock_table<
/> configuration parameter
</primary>
5377 Unconditionally trace locks on this table (OID).
5380 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5381 macro was defined when
<productname>PostgreSQL
</productname> was
5388 <term><varname>debug_deadlocks
</varname> (
<type>boolean
</type>)
</term>
5390 <primary><varname>debug_deadlocks<
/> configuration parameter
</primary>
5394 If set, dumps information about all current locks when a
5395 DeadLockTimeout occurs.
5398 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5399 macro was defined when
<productname>PostgreSQL
</productname> was
5406 <term><varname>log_btree_build_stats
</varname> (
<type>boolean
</type>)
</term>
5408 <primary><varname>log_btree_build_stats<
/> configuration parameter
</primary>
5412 If set, logs system resource usage statistics (memory and CPU) on
5413 various btree operations.
5416 This parameter is only available if the
<symbol>BTREE_BUILD_STATS
</symbol>
5417 macro was defined when
<productname>PostgreSQL
</productname> was
5423 <varlistentry id=
"guc-wal-debug" xreflabel=
"wal_debug">
5424 <term><varname>wal_debug
</varname> (
<type>boolean
</type>)
</term>
5426 <primary><varname>wal_debug<
/> configuration parameter
</primary>
5430 If on, emit WAL-related debugging output. This parameter is
5431 only available if the
<symbol>WAL_DEBUG
</symbol> macro was
5432 defined when
<productname>PostgreSQL
</productname> was
5438 <varlistentry id=
"guc-zero-damaged-pages" xreflabel=
"zero_damaged_pages">
5439 <term><varname>zero_damaged_pages
</varname> (
<type>boolean
</type>)
</term>
5441 <primary><varname>zero_damaged_pages<
/> configuration parameter
</primary>
5445 Detection of a damaged page header normally causes
5446 <productname>PostgreSQL<
/> to report an error, aborting the current
5447 command. Setting
<varname>zero_damaged_pages<
/> to on causes
5448 the system to instead report a warning, zero out the damaged page,
5449 and continue processing. This behavior
<emphasis>will destroy data<
/>,
5450 namely all the rows on the damaged page. But it allows you to get
5451 past the error and retrieve rows from any undamaged pages that might
5452 be present in the table. So it is useful for recovering data if
5453 corruption has occurred due to hardware or software error. You should
5454 generally not set this on until you have given up hope of recovering
5455 data from the damaged page(s) of a table. The
5456 default setting is
<literal>off<
/>, and it can only be changed
5463 <sect1 id=
"runtime-config-short">
5464 <title>Short Options
</title>
5467 For convenience there are also single letter command-line option
5468 switches available for some parameters. They are described in
5469 <xref linkend=
"runtime-config-short-table">. Some of these
5470 options exist for historical reasons, and their presence as a
5471 single-letter option does not necessarily indicate an endorsement
5472 to use the option heavily.
5475 <table id=
"runtime-config-short-table">
5476 <title>Short option key
</title>
5480 <entry>Short option
</entry>
5481 <entry>Equivalent
</entry>
5487 <entry><option>-A
<replaceable>x
</replaceable></option></entry>
5488 <entry><literal>debug_assertions =
<replaceable>x
</replaceable><
/></entry>
5491 <entry><option>-B
<replaceable>x
</replaceable></option></entry>
5492 <entry><literal>shared_buffers =
<replaceable>x
</replaceable><
/></entry>
5495 <entry><option>-d
<replaceable>x
</replaceable></option></entry>
5496 <entry><literal>log_min_messages = DEBUG
<replaceable>x
</replaceable><
/></entry>
5499 <entry><option>-e
</option></entry>
5500 <entry><literal>datestyle = euro<
/></entry>
5504 <option>-fb
</option>,
<option>-fh
</option>,
<option>-fi
</option>,
5505 <option>-fm
</option>,
<option>-fn
</option>,
5506 <option>-fs
</option>,
<option>-ft
</option>
5509 <literal>enable_bitmapscan = off<
/>,
5510 <literal>enable_hashjoin = off<
/>,
5511 <literal>enable_indexscan = off<
/>,
5512 <literal>enable_mergejoin = off<
/>,
5513 <literal>enable_nestloop = off<
/>,
5514 <literal>enable_seqscan = off<
/>,
5515 <literal>enable_tidscan = off<
/>
5519 <entry><option>-F
</option></entry>
5520 <entry><literal>fsync = off<
/></entry>
5523 <entry><option>-h
<replaceable>x
</replaceable></option></entry>
5524 <entry><literal>listen_addresses =
<replaceable>x
</replaceable><
/></entry>
5527 <entry><option>-i
</option></entry>
5528 <entry><literal>listen_addresses = '*'<
/></entry>
5531 <entry><option>-k
<replaceable>x
</replaceable></option></entry>
5532 <entry><literal>unix_socket_directory =
<replaceable>x
</replaceable><
/></entry>
5535 <entry><option>-l
</option></entry>
5536 <entry><literal>ssl = on<
/></entry>
5539 <entry><option>-N
<replaceable>x
</replaceable></option></entry>
5540 <entry><literal>max_connections =
<replaceable>x
</replaceable><
/></entry>
5543 <entry><option>-O
</option></entry>
5544 <entry><literal>allow_system_table_mods = on<
/></entry>
5547 <entry><option>-p
<replaceable>x
</replaceable></option></entry>
5548 <entry><literal>port =
<replaceable>x
</replaceable><
/></entry>
5551 <entry><option>-P
</option></entry>
5552 <entry><literal>ignore_system_indexes = on<
/></entry>
5555 <entry><option>-s
</option></entry>
5556 <entry><literal>log_statement_stats = on<
/></entry>
5559 <entry><option>-S
<replaceable>x
</replaceable></option></entry>
5560 <entry><literal>work_mem =
<replaceable>x
</replaceable><
/></entry>
5563 <entry><option>-tpa
</option>,
<option>-tpl
</option>,
<option>-te
</option></entry>
5564 <entry><literal>log_parser_stats = on<
/>,
5565 <literal>log_planner_stats = on<
/>,
5566 <literal>log_executor_stats = on<
/></entry>
5569 <entry><option>-W
<replaceable>x
</replaceable></option></entry>
5570 <entry><literal>post_auth_delay =
<replaceable>x
</replaceable><
/></entry>