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>%c
</literal></entry>
3048 <entry>Session ID: see below
</entry>
3052 <entry><literal>%l
</literal></entry>
3053 <entry>Number of the log line for each session or process, starting at
1</entry>
3057 <entry><literal>%s
</literal></entry>
3058 <entry>Process start time stamp
</entry>
3062 <entry><literal>%v
</literal></entry>
3063 <entry>Virtual transaction ID (backendID/localXID)
</entry>
3067 <entry><literal>%x
</literal></entry>
3068 <entry>Transaction ID (
0 if none is assigned)
</entry>
3072 <entry><literal>%q
</literal></entry>
3073 <entry>Produces no output, but tells non-session
3074 processes to stop at this point in the string; ignored by
3075 session processes
</entry>
3079 <entry><literal>%%
</literal></entry>
3080 <entry>Literal
<literal>%<
/></entry>
3087 The
<literal>%c<
/> escape prints a quasi-unique session identifier,
3088 consisting of two
4-byte hexadecimal numbers (without leading zeros)
3089 separated by a dot. The numbers are the process start time and the
3090 process ID, so
<literal>%c<
/> can also be used as a space saving way
3091 of printing those items. For example, to generate the session
3092 identifier from
<literal>pg_stat_activity<
/>, use this query:
3094 SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
3096 FROM pg_stat_activity;
3103 If you set a nonempty value for
<varname>log_line_prefix<
/>,
3104 you should usually make its last character be a space, to provide
3105 visual separation from the rest of the log line. A punctuation
3106 character could be used too.
3112 <application>Syslog<
/> produces its own
3113 time stamp and process ID information, so you probably do not want to
3114 use those escapes if you are logging to
<application>syslog<
/>.
3120 <varlistentry id=
"guc-log-lock-waits" xreflabel=
"log_lock_waits">
3121 <term><varname>log_lock_waits
</varname> (
<type>boolean
</type>)
</term>
3123 <primary><varname>log_lock_waits<
/> configuration parameter
</primary>
3127 Controls whether a log message is produced when a session waits
3128 longer than
<xref linkend=
"guc-deadlock-timeout"> to acquire a
3129 lock. This is useful in determining if lock waits are causing
3130 poor performance. The default is
<literal>off<
/>.
3135 <varlistentry id=
"guc-log-statement" xreflabel=
"log_statement">
3136 <term><varname>log_statement
</varname> (
<type>enum
</type>)
</term>
3138 <primary><varname>log_statement<
/> configuration parameter
</primary>
3142 Controls which SQL statements are logged. Valid values are
3143 <literal>none<
/>,
<literal>ddl<
/>,
<literal>mod<
/>, and
3144 <literal>all<
/>.
<literal>ddl<
/> logs all data definition
3145 statements, such as
<command>CREATE<
/>,
<command>ALTER<
/>, and
3146 <command>DROP<
/> statements.
<literal>mod<
/> logs all
3147 <literal>ddl<
/> statements, plus data-modifying statements
3148 such as
<command>INSERT<
/>,
3149 <command>UPDATE<
/>,
<command>DELETE<
/>,
<command>TRUNCATE<
/>,
3150 and
<command>COPY FROM<
/>.
3151 <command>PREPARE<
/>,
<command>EXECUTE<
/>, and
3152 <command>EXPLAIN ANALYZE<
/> statements are also logged if their
3153 contained command is of an appropriate type. For clients using
3154 extended query protocol, logging occurs when an Execute message
3155 is received, and values of the Bind parameters are included
3156 (with any embedded single-quote marks doubled).
3160 The default is
<literal>none<
/>. Only superusers can change this
3166 Statements that contain simple syntax errors are not logged
3167 even by the
<varname>log_statement<
/> =
<literal>all<
/> setting,
3168 because the log message is emitted only after basic parsing has
3169 been done to determine the statement type. In the case of extended
3170 query protocol, this setting likewise does not log statements that
3171 fail before the Execute phase (i.e., during parse analysis or
3172 planning). Set
<varname>log_min_error_statement<
/> to
3173 <literal>ERROR<
/> (or lower) to log such statements.
3179 <varlistentry id=
"guc-log-temp-files" xreflabel=
"log_temp_files">
3180 <term><varname>log_temp_files
</varname> (
<type>integer
</type>)
</term>
3182 <primary><varname>log_temp_files<
/> configuration parameter
</primary>
3186 Controls logging of use of temporary files.
3187 Temporary files can be
3188 created for sorts, hashes, and temporary query results.
3189 A log entry is made for each temporary file when it is deleted.
3190 A value of zero logs all temporary files, while positive
3191 values log only files whose size is greater than or equal to
3192 the specified number of kilobytes. The
3193 default setting is
<literal>-
1<
/>, which disables such logging.
3194 Only superusers can change this setting.
3199 <varlistentry id=
"guc-log-timezone" xreflabel=
"log_timezone">
3200 <term><varname>log_timezone
</varname> (
<type>string
</type>)
</term>
3202 <primary><varname>log_timezone<
/> configuration parameter
</primary>
3206 Sets the time zone used for timestamps written in the log.
3207 Unlike
<xref linkend=
"guc-timezone">, this value is cluster-wide,
3208 so that all sessions will report timestamps consistently.
3209 The default is
<literal>unknown<
/>, which means to use whatever
3210 the system environment specifies as the time zone. See
<xref
3211 linkend=
"datatype-timezones"> for more information.
3212 This parameter can only be set in the
<filename>postgresql.conf<
/>
3213 file or on the server command line.
3220 <sect2 id=
"runtime-config-logging-csvlog">
3221 <title>Using CSV-Format Log Output
</title>
3224 Including
<literal>csvlog<
/> in the
<varname>log_destination<
/> list
3225 provides a convenient way to import log files into a database table.
3226 This option emits log lines in comma-separated-value format,
3227 with these columns: timestamp with milliseconds, user name, database
3228 name, process ID, host:port number, session ID, per-session or -process line
3229 number, command tag, session start time, virtual transaction ID,
3230 regular transaction id, error severity, SQL state code, error message,
3231 error message detail, hint, internal query that led to the error (if
3232 any), character count of the error position thereof, error context,
3233 user query that led to the error (if any and enabled by
3234 <varname>log_min_error_statement<
/>), character count of the error
3235 position thereof, location of the error in the PostgreSQL source code
3236 (if
<varname>log_error_verbosity<
/> is set to
<literal>verbose<
/>).
3237 Here is a sample table definition for storing CSV-format log output:
3240 CREATE TABLE postgres_log
3242 log_time timestamp(
3) with time zone,
3246 connection_from text,
3248 session_line_num bigint,
3250 session_start_time timestamp with time zone,
3251 virtual_transaction_id text,
3252 transaction_id bigint,
3253 error_severity text,
3254 sql_state_code text,
3258 internal_query text,
3259 internal_query_pos integer,
3264 PRIMARY KEY (session_id, session_line_num)
3270 To import a log file into this table, use the
<command>COPY FROM<
/>
3274 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
3279 There are a few things you need to do to simplify importing CSV log
3280 files easily and automatically:
3285 Set
<varname>log_filename
</varname> and
3286 <varname>log_rotation_age<
/> to provide a consistent,
3287 predictable naming scheme for your log files. This lets you
3288 predict what the file name will be and know when an individual log
3289 file is complete and therefore ready to be imported.
3295 Set
<varname>log_rotation_size
</varname> to
0 to disable
3296 size-based log rotation, as it makes the log file name difficult
3303 Set
<varname>log_truncate_on_rotation
</varname> to
<literal>on<
/> so
3304 that old log data isn't mixed with the new in the same file.
3310 The table definition above includes a primary key specification.
3311 This is useful to protect against accidentally importing the same
3312 information twice. The
<command>COPY<
/> command commits all of the
3313 data it imports at one time, so any error will cause the entire
3314 import to fail. If you import a partial log file and later import
3315 the file again when it is complete, the primary key violation will
3316 cause the import to fail. Wait until the log is complete and
3317 closed before importing. This procedure will also protect against
3318 accidentally importing a partial line that hasn't been completely
3319 written, which would also cause
<command>COPY<
/> to fail.
3328 <sect1 id=
"runtime-config-statistics">
3329 <title>Run-Time Statistics
</title>
3331 <sect2 id=
"runtime-config-statistics-collector">
3332 <title>Query and Index Statistics Collector
</title>
3335 These parameters control server-wide statistics collection features.
3336 When statistics collection is enabled, the data that is produced can be
3337 accessed via the
<structname>pg_stat
</structname> and
3338 <structname>pg_statio
</structname> family of system views.
3339 Refer to
<xref linkend=
"monitoring"> for more information.
3344 <varlistentry id=
"guc-track-activities" xreflabel=
"track_activities">
3345 <term><varname>track_activities
</varname> (
<type>boolean
</type>)
</term>
3347 <primary><varname>track_activities<
/> configuration parameter
</primary>
3351 Enables the collection of information on the currently
3352 executing command of each session, along with the time at
3353 which that command began execution. This parameter is on by
3354 default. Note that even when enabled, this information is not
3355 visible to all users, only to superusers and the user owning
3356 the session being reported on; so it should not represent a
3358 Only superusers can change this setting.
3363 <varlistentry id=
"guc-track-activity-query-size" xreflabel=
"track_activity_query_size">
3364 <term><varname>track_activity_query_size
</varname> (
<type>integer
</type>)
</term>
3366 <primary><varname>track_activity_query_size<
/> configuration parameter
</primary>
3370 Specifies the number of bytes reserved to track the currently
3371 executing command for each active session, for the
3372 <structname>pg_stat_activity<
/>.
<structfield>current_query<
/> field.
3373 The default value is
1024. This parameter can only be set at server
3379 <varlistentry id=
"guc-track-counts" xreflabel=
"track_counts">
3380 <term><varname>track_counts
</varname> (
<type>boolean
</type>)
</term>
3382 <primary><varname>track_counts<
/> configuration parameter
</primary>
3386 Enables collection of statistics on database activity.
3387 This parameter is on by default, because the autovacuum
3388 daemon needs the collected information.
3389 Only superusers can change this setting.
3394 <varlistentry id=
"guc-track-functions" xreflabel=
"track_functions">
3395 <term><varname>track_functions
</varname> (
<type>enum
</type>)
</term>
3397 <primary><varname>track_functions<
/> configuration parameter
</primary>
3401 Enables tracking of function call counts and time used. Specify
3402 <literal>pl
</literal> to track only procedural-language functions,
3403 <literal>all
</literal> to also track SQL and C language functions.
3404 The default is
<literal>none
</literal>, which disables function
3405 statistics tracking. Only superusers can change this setting.
3410 SQL-language functions that are simple enough to be
<quote>inlined<
/>
3411 into the calling query will not be tracked, regardless of this
3418 <varlistentry id=
"guc-update-process-title" xreflabel=
"update_process_title">
3419 <term><varname>update_process_title
</varname> (
<type>boolean
</type>)
</term>
3421 <primary><varname>update_process_title<
/> configuration parameter
</primary>
3425 Enables updating of the process title every time a new SQL command
3426 is received by the server. The process title is typically viewed
3427 by the
<command>ps<
/> command,
3428 or in Windows by using the
<application>Process Explorer<
/>.
3429 Only superusers can change this setting.
3434 <varlistentry id=
"guc-stats-temp-directory" xreflabel=
"stats_temp_directory">
3435 <term><varname>stats_temp_directory
</varname> (
<type>string
</type>)
</term>
3437 <primary><varname>stats_temp_directory<
/> configuration parameter
</primary>
3441 Sets the directory to store temporary statistics data in. This can be
3442 a path relative to the data directory or an absolute path. The default
3443 is
<filename>pg_stat_tmp
</filename>. Pointing this at a RAM based
3444 filesystem will decrease physical I/O requirements and can lead to
3445 improved performance.
3446 This parameter can only be set in the
<filename>postgresql.conf<
/>
3447 file or on the server command line.
3455 <sect2 id=
"runtime-config-statistics-monitor">
3456 <title>Statistics Monitoring
</title>
3460 <term><varname>log_statement_stats
</varname> (
<type>boolean
</type>)
</term>
3461 <term><varname>log_parser_stats
</varname> (
<type>boolean
</type>)
</term>
3462 <term><varname>log_planner_stats
</varname> (
<type>boolean
</type>)
</term>
3463 <term><varname>log_executor_stats
</varname> (
<type>boolean
</type>)
</term>
3465 <primary><varname>log_statement_stats<
/> configuration parameter
</primary>
3468 <primary><varname>log_parser_stats<
/> configuration parameter
</primary>
3471 <primary><varname>log_planner_stats<
/> configuration parameter
</primary>
3474 <primary><varname>log_executor_stats<
/> configuration parameter
</primary>
3478 For each query, write performance statistics of the respective
3479 module to the server log. This is a crude profiling
3480 instrument.
<varname>log_statement_stats
</varname> reports total
3481 statement statistics, while the others report per-module statistics.
3482 <varname>log_statement_stats
</varname> cannot be enabled together with
3483 any of the per-module options. All of these options are disabled by
3484 default. Only superusers can change these settings.
3494 <sect1 id=
"runtime-config-autovacuum">
3495 <title>Automatic Vacuuming
</title>
3498 <primary>autovacuum
</primary>
3499 <secondary>configuration parameters
</secondary>
3503 These settings control the behavior of the
<firstterm>autovacuum<
/>
3504 feature. Refer to
<xref linkend=
"autovacuum"> for
3510 <varlistentry id=
"guc-autovacuum" xreflabel=
"autovacuum">
3511 <term><varname>autovacuum
</varname> (
<type>boolean
</type>)
</term>
3513 <primary><varname>autovacuum<
/> configuration parameter
</primary>
3517 Controls whether the server should run the
3518 autovacuum launcher daemon. This is on by default; however,
3519 <xref linkend=
"guc-track-counts"> must also be turned on for
3521 This parameter can only be set in the
<filename>postgresql.conf<
/>
3522 file or on the server command line.
3525 Note that even when this parameter is disabled, the system
3526 will launch autovacuum processes if necessary to
3527 prevent transaction ID wraparound. See
<xref
3528 linkend=
"vacuum-for-wraparound"> for more information.
3533 <varlistentry id=
"guc-log-autovacuum-min-duration" xreflabel=
"log_autovacuum_min_duration">
3534 <term><varname>log_autovacuum_min_duration
</varname> (
<type>integer
</type>)
</term>
3536 <primary><varname>log_autovacuum_min_duration<
/> configuration parameter
</primary>
3540 Causes each action executed by autovacuum to be logged if it ran for at
3541 least the specified number of milliseconds. Setting this to zero logs
3542 all autovacuum actions. Minus-one (the default) disables logging
3543 autovacuum actions. For example, if you set this to
3544 <literal>250ms
</literal> then all automatic vacuums and analyzes that run
3545 250ms or longer will be logged. Enabling this parameter can be helpful
3546 in tracking autovacuum activity. This setting can only be set in
3547 the
<filename>postgresql.conf<
/> file or on the server command line.
3552 <varlistentry id=
"guc-autovacuum-max-workers" xreflabel=
"autovacuum_max_workers">
3553 <term><varname>autovacuum_max_workers
</varname> (
<type>integer
</type>)
</term>
3555 <primary><varname>autovacuum_max_workers<
/> configuration parameter
</primary>
3559 Specifies the maximum number of autovacuum processes (other than the
3560 autovacuum launcher) which may be running at any one time. The default
3561 is three. This parameter can only be set in
3562 the
<filename>postgresql.conf<
/> file or on the server command line.
3567 <varlistentry id=
"guc-autovacuum-naptime" xreflabel=
"autovacuum_naptime">
3568 <term><varname>autovacuum_naptime
</varname> (
<type>integer
</type>)
</term>
3570 <primary><varname>autovacuum_naptime<
/> configuration parameter
</primary>
3574 Specifies the minimum delay between autovacuum runs on any given
3575 database. In each round the daemon examines the
3576 database and issues
<command>VACUUM<
/> and
<command>ANALYZE<
/> commands
3577 as needed for tables in that database. The delay is measured
3578 in seconds, and the default is one minute (
<literal>1m<
/>).
3579 This parameter can only be set in the
<filename>postgresql.conf<
/>
3580 file or on the server command line.
3585 <varlistentry id=
"guc-autovacuum-vacuum-threshold" xreflabel=
"autovacuum_vacuum_threshold">
3586 <term><varname>autovacuum_vacuum_threshold
</varname> (
<type>integer
</type>)
</term>
3588 <primary><varname>autovacuum_vacuum_threshold<
/> configuration parameter
</primary>
3592 Specifies the minimum number of updated or deleted tuples needed
3593 to trigger a
<command>VACUUM<
/> in any one table.
3594 The default is
50 tuples.
3595 This parameter can only be set in the
<filename>postgresql.conf<
/>
3596 file or on the server command line.
3597 This setting can be overridden for individual tables by
3598 changing storage parameters.
3603 <varlistentry id=
"guc-autovacuum-analyze-threshold" xreflabel=
"autovacuum_analyze_threshold">
3604 <term><varname>autovacuum_analyze_threshold
</varname> (
<type>integer
</type>)
</term>
3606 <primary><varname>autovacuum_analyze_threshold<
/> configuration parameter
</primary>
3610 Specifies the minimum number of inserted, updated or deleted tuples
3611 needed to trigger an
<command>ANALYZE<
/> in any one table.
3612 The default is
50 tuples.
3613 This parameter can only be set in the
<filename>postgresql.conf<
/>
3614 file or on the server command line.
3615 This setting can be overridden for individual tables by
3616 changing storage parameters.
3621 <varlistentry id=
"guc-autovacuum-vacuum-scale-factor" xreflabel=
"autovacuum_vacuum_scale_factor">
3622 <term><varname>autovacuum_vacuum_scale_factor
</varname> (
<type>floating point
</type>)
</term>
3624 <primary><varname>autovacuum_vacuum_scale_factor<
/> configuration parameter
</primary>
3628 Specifies a fraction of the table size to add to
3629 <varname>autovacuum_vacuum_threshold
</varname>
3630 when deciding whether to trigger a
<command>VACUUM<
/>.
3631 The default is
0.2 (
20% of table size).
3632 This parameter can only be set in the
<filename>postgresql.conf<
/>
3633 file or on the server command line.
3634 This setting can be overridden for individual tables by
3635 changing storage parameters.
3640 <varlistentry id=
"guc-autovacuum-analyze-scale-factor" xreflabel=
"autovacuum_analyze_scale_factor">
3641 <term><varname>autovacuum_analyze_scale_factor
</varname> (
<type>floating point
</type>)
</term>
3643 <primary><varname>autovacuum_analyze_scale_factor<
/> configuration parameter
</primary>
3647 Specifies a fraction of the table size to add to
3648 <varname>autovacuum_analyze_threshold
</varname>
3649 when deciding whether to trigger an
<command>ANALYZE<
/>.
3650 The default is
0.1 (
10% of table size).
3651 This parameter can only be set in the
<filename>postgresql.conf<
/>
3652 file or on the server command line.
3653 This setting can be overridden for individual tables by
3654 changing storage parameters.
3659 <varlistentry id=
"guc-autovacuum-freeze-max-age" xreflabel=
"autovacuum_freeze_max_age">
3660 <term><varname>autovacuum_freeze_max_age
</varname> (
<type>integer
</type>)
</term>
3662 <primary><varname>autovacuum_freeze_max_age<
/> configuration parameter
</primary>
3666 Specifies the maximum age (in transactions) that a table's
3667 <structname>pg_class<
/>.
<structfield>relfrozenxid<
/> field can
3668 attain before a
<command>VACUUM<
/> operation is forced to prevent
3669 transaction ID wraparound within the table. Note that the system
3670 will launch autovacuum processes to prevent wraparound even when
3671 autovacuum is otherwise disabled.
3672 The default is
200 million transactions.
3673 This parameter can only be set at server start, but the setting
3674 can be reduced for individual tables by
3675 changing storage parameters.
3676 For more information see
<xref linkend=
"vacuum-for-wraparound">.
3681 <varlistentry id=
"guc-autovacuum-vacuum-cost-delay" xreflabel=
"autovacuum_vacuum_cost_delay">
3682 <term><varname>autovacuum_vacuum_cost_delay
</varname> (
<type>integer
</type>)
</term>
3684 <primary><varname>autovacuum_vacuum_cost_delay<
/> configuration parameter
</primary>
3688 Specifies the cost delay value that will be used in automatic
3689 <command>VACUUM<
/> operations. If
<literal>-
1<
/> is
3690 specified, the regular
3691 <xref linkend=
"guc-vacuum-cost-delay"> value will be used.
3692 The default value is
20 milliseconds.
3693 This parameter can only be set in the
<filename>postgresql.conf<
/>
3694 file or on the server command line.
3695 This setting can be overridden for individual tables by
3696 changing storage parameters.
3701 <varlistentry id=
"guc-autovacuum-vacuum-cost-limit" xreflabel=
"autovacuum_vacuum_cost_limit">
3702 <term><varname>autovacuum_vacuum_cost_limit
</varname> (
<type>integer
</type>)
</term>
3704 <primary><varname>autovacuum_vacuum_cost_limit<
/> configuration parameter
</primary>
3708 Specifies the cost limit value that will be used in automatic
3709 <command>VACUUM<
/> operations. If
<literal>-
1<
/> is specified (which is the
3710 default), the regular
3711 <xref linkend=
"guc-vacuum-cost-limit"> value will be used. Note that
3712 the value is distributed proportionally among the running autovacuum
3713 workers, if there is more than one, so that the sum of the limits of
3714 each worker never exceeds the limit on this variable.
3715 This parameter can only be set in the
<filename>postgresql.conf<
/>
3716 file or on the server command line.
3717 This setting can be overridden for individual tables by
3718 changing storage parameters.
3726 <sect1 id=
"runtime-config-client">
3727 <title>Client Connection Defaults
</title>
3729 <sect2 id=
"runtime-config-client-statement">
3730 <title>Statement Behavior
</title>
3733 <varlistentry id=
"guc-search-path" xreflabel=
"search_path">
3734 <term><varname>search_path
</varname> (
<type>string
</type>)
</term>
3736 <primary><varname>search_path<
/> configuration parameter
</primary>
3738 <indexterm><primary>path<
/><secondary>for schemas<
/><
/>
3741 This variable specifies the order in which schemas are searched
3742 when an object (table, data type, function, etc.) is referenced by a
3743 simple name with no schema component. When there are objects of
3744 identical names in different schemas, the one found first
3745 in the search path is used. An object that is not in any of the
3746 schemas in the search path can only be referenced by specifying
3747 its containing schema with a qualified (dotted) name.
3751 The value for
<varname>search_path
</varname> has to be a comma-separated
3752 list of schema names. If one of the list items is
3753 the special value
<literal>$user
</literal>, then the schema
3754 having the name returned by
<function>SESSION_USER<
/> is substituted, if there
3755 is such a schema. (If not,
<literal>$user
</literal> is ignored.)
3759 The system catalog schema,
<literal>pg_catalog<
/>, is always
3760 searched, whether it is mentioned in the path or not. If it is
3761 mentioned in the path then it will be searched in the specified
3762 order. If
<literal>pg_catalog<
/> is not in the path then it will
3763 be searched
<emphasis>before<
/> searching any of the path items.
3767 Likewise, the current session's temporary-table schema,
3768 <literal>pg_temp_
<replaceable>nnn<
/><
/>, is always searched if it
3769 exists. It can be explicitly listed in the path by using the
3770 alias
<literal>pg_temp<
/>. If it is not listed in the path then
3771 it is searched first (before even
<literal>pg_catalog<
/>). However,
3772 the temporary schema is only searched for relation (table, view,
3773 sequence, etc) and data type names. It will never be searched for
3774 function or operator names.
3778 When objects are created without specifying a particular target
3779 schema, they will be placed in the first schema listed
3780 in the search path. An error is reported if the search path is
3785 The default value for this parameter is
3786 <literal>'
"$user", public'
</literal> (where the second part will be
3787 ignored if there is no schema named
<literal>public<
/>).
3788 This supports shared use of a database (where no users
3789 have private schemas, and all share use of
<literal>public<
/>),
3790 private per-user schemas, and combinations of these. Other
3791 effects can be obtained by altering the default search path
3792 setting, either globally or per-user.
3796 The current effective value of the search path can be examined
3797 via the
<acronym>SQL
</acronym> function
3798 <function>current_schemas()<
/>. This is not quite the same as
3799 examining the value of
<varname>search_path
</varname>, since
3800 <function>current_schemas()<
/> shows how the requests
3801 appearing in
<varname>search_path
</varname> were resolved.
3805 For more information on schema handling, see
<xref linkend=
"ddl-schemas">.
3810 <varlistentry id=
"guc-default-tablespace" xreflabel=
"default_tablespace">
3811 <term><varname>default_tablespace
</varname> (
<type>string
</type>)
</term>
3813 <primary><varname>default_tablespace<
/> configuration parameter
</primary>
3815 <indexterm><primary>tablespace<
/><secondary>default<
/><
/>
3818 This variable specifies the default tablespace in which to create
3819 objects (tables and indexes) when a
<command>CREATE<
/> command does
3820 not explicitly specify a tablespace.
3824 The value is either the name of a tablespace, or an empty string
3825 to specify using the default tablespace of the current database.
3826 If the value does not match the name of any existing tablespace,
3827 <productname>PostgreSQL<
/> will automatically use the default
3828 tablespace of the current database. If a nondefault tablespace
3829 is specified, the user must have
<literal>CREATE<
/> privilege
3830 for it, or creation attempts will fail.
3834 This variable is not used for temporary tables; for them,
3835 <xref linkend=
"guc-temp-tablespaces"> is consulted instead.
3839 For more information on tablespaces,
3840 see
<xref linkend=
"manage-ag-tablespaces">.
3845 <varlistentry id=
"guc-temp-tablespaces" xreflabel=
"temp_tablespaces">
3846 <term><varname>temp_tablespaces
</varname> (
<type>string
</type>)
</term>
3848 <primary><varname>temp_tablespaces<
/> configuration parameter
</primary>
3850 <indexterm><primary>tablespace<
/><secondary>temporary<
/><
/>
3853 This variable specifies tablespace(s) in which to create temporary
3854 objects (temp tables and indexes on temp tables) when a
3855 <command>CREATE<
/> command does not explicitly specify a tablespace.
3856 Temporary files for purposes such as sorting large data sets
3857 are also created in these tablespace(s).
3861 The value is a list of names of tablespaces. When there is more than
3862 one name in the list,
<productname>PostgreSQL<
/> chooses a random
3863 member of the list each time a temporary object is to be created;
3864 except that within a transaction, successively created temporary
3865 objects are placed in successive tablespaces from the list.
3866 If the selected element of the list is an empty string,
3867 <productname>PostgreSQL<
/> will automatically use the default
3868 tablespace of the current database instead.
3872 When
<varname>temp_tablespaces<
/> is set interactively, specifying a
3873 nonexistent tablespace is an error, as is specifying a tablespace for
3874 which the user does not have
<literal>CREATE<
/> privilege. However,
3875 when using a previously set value, nonexistent tablespaces are
3876 ignored, as are tablespaces for which the user lacks
3877 <literal>CREATE<
/> privilege. In particular, this rule applies when
3878 using a value set in
<filename>postgresql.conf<
/>.
3882 The default value is an empty string, which results in all temporary
3883 objects being created in the default tablespace of the current
3888 See also
<xref linkend=
"guc-default-tablespace">.
3893 <varlistentry id=
"guc-check-function-bodies" xreflabel=
"check_function_bodies">
3894 <term><varname>check_function_bodies
</varname> (
<type>boolean
</type>)
</term>
3896 <primary><varname>check_function_bodies<
/> configuration parameter
</primary>
3900 This parameter is normally on. When set to
<literal>off<
/>, it
3901 disables validation of the function body string during
<xref
3902 linkend=
"sql-createfunction"
3903 endterm=
"sql-createfunction-title">. Disabling validation is
3904 occasionally useful to avoid problems such as forward references
3905 when restoring function definitions from a dump.
3910 <varlistentry id=
"guc-default-transaction-isolation" xreflabel=
"default_transaction_isolation">
3912 <primary>transaction isolation level
</primary>
3915 <primary><varname>default_transaction_isolation<
/> configuration parameter
</primary>
3917 <term><varname>default_transaction_isolation
</varname> (
<type>enum
</type>)
</term>
3920 Each SQL transaction has an isolation level, which can be
3921 either
<quote>read uncommitted
</quote>,
<quote>read
3922 committed
</quote>,
<quote>repeatable read
</quote>, or
3923 <quote>serializable
</quote>. This parameter controls the
3924 default isolation level of each new transaction. The default
3925 is
<quote>read committed
</quote>.
3929 Consult
<xref linkend=
"mvcc"> and
<xref
3930 linkend=
"sql-set-transaction"
3931 endterm=
"sql-set-transaction-title"> for more information.
3936 <varlistentry id=
"guc-default-transaction-read-only" xreflabel=
"default_transaction_read_only">
3938 <primary>read-only transaction
</primary>
3941 <primary><varname>default_transaction_read_only<
/> configuration parameter
</primary>
3944 <term><varname>default_transaction_read_only
</varname> (
<type>boolean
</type>)
</term>
3947 A read-only SQL transaction cannot alter non-temporary tables.
3948 This parameter controls the default read-only status of each new
3949 transaction. The default is
<literal>off<
/> (read/write).
3953 Consult
<xref linkend=
"sql-set-transaction"
3954 endterm=
"sql-set-transaction-title"> for more information.
3959 <varlistentry id=
"guc-session-replication-role" xreflabel=
"session_replication_role">
3960 <term><varname>session_replication_role
</varname> (
<type>enum
</type>)
</term>
3962 <primary><varname>session_replication_role<
/> configuration parameter
</primary>
3966 Controls firing of replication-related triggers and rules for the
3967 current session. Setting this variable requires
3968 superuser privilege and results in discarding any previously cached
3969 query plans. Possible values are
<literal>origin<
/> (the default),
3970 <literal>replica<
/> and
<literal>local<
/>.
3971 See
<xref linkend=
"sql-altertable" endterm=
"sql-altertable-title"> for
3977 <varlistentry id=
"guc-statement-timeout" xreflabel=
"statement_timeout">
3978 <term><varname>statement_timeout
</varname> (
<type>integer
</type>)
</term>
3980 <primary><varname>statement_timeout<
/> configuration parameter
</primary>
3984 Abort any statement that takes over the specified number of
3985 milliseconds, starting from the time the command arrives at the server
3986 from the client. If
<varname>log_min_error_statement<
/> is set to
3987 <literal>ERROR<
/> or lower, the statement that timed out will also be
3988 logged. A value of zero (the default) turns off the
3993 Setting
<varname>statement_timeout<
/> in
3994 <filename>postgresql.conf<
/> is not recommended because it
3995 affects all sessions.
4000 <varlistentry id=
"guc-vacuum-freeze-table-age" xreflabel=
"vacuum_freeze_table_age">
4001 <term><varname>vacuum_freeze_table_age
</varname> (
<type>integer
</type>)
</term>
4003 <primary><varname>vacuum_freeze_table_age<
/> configuration parameter
</primary>
4007 <command>VACUUM<
/> performs a whole-table scan if the table's
4008 <structname>pg_class<
/>.
<structfield>relfrozenxid<
/> field has reached
4009 the age specified by this setting. The default is
150 million
4010 transactions. Although users can set this value anywhere from zero to
4011 one billion,
<command>VACUUM<
/> will silently limit the effective value
4012 to
95% of
<xref linkend=
"guc-autovacuum-freeze-max-age">, so that a
4013 periodical manual
<command>VACUUM<
/> has a chance to run before an
4014 anti-wraparound autovacuum is launched for the table. For more
4016 <xref linkend=
"vacuum-for-wraparound">.
4021 <varlistentry id=
"guc-vacuum-freeze-min-age" xreflabel=
"vacuum_freeze_min_age">
4022 <term><varname>vacuum_freeze_min_age
</varname> (
<type>integer
</type>)
</term>
4024 <primary><varname>vacuum_freeze_min_age<
/> configuration parameter
</primary>
4028 Specifies the cutoff age (in transactions) that
<command>VACUUM<
/>
4029 should use to decide whether to replace transaction IDs with
4030 <literal>FrozenXID<
/> while scanning a table.
4031 The default is
50 million transactions. Although
4032 users can set this value anywhere from zero to one billion,
4033 <command>VACUUM<
/> will silently limit the effective value to half
4034 the value of
<xref linkend=
"guc-autovacuum-freeze-max-age">, so
4035 that there is not an unreasonably short time between forced
4036 autovacuums. For more information see
<xref
4037 linkend=
"vacuum-for-wraparound">.
4042 <varlistentry id=
"guc-xmlbinary" xreflabel=
"xmlbinary">
4043 <term><varname>xmlbinary
</varname> (
<type>enum
</type>)
</term>
4045 <primary><varname>xmlbinary<
/> configuration parameter
</primary>
4049 Sets how binary values are to be encoded in XML. This applies
4050 for example when
<type>bytea
</type> values are converted to
4051 XML by the functions
<function>xmlelement
</function> or
4052 <function>xmlforest
</function>. Possible values are
4053 <literal>base64
</literal> and
<literal>hex
</literal>, which
4054 are both defined in the XML Schema standard. The default is
4055 <literal>base64
</literal>. For further information about
4056 XML-related functions, see
<xref linkend=
"functions-xml">.
4060 The actual choice here is mostly a matter of taste,
4061 constrained only by possible restrictions in client
4062 applications. Both methods support all possible values,
4063 although the hex encoding will be somewhat larger than the
4069 <varlistentry id=
"guc-xmloption" xreflabel=
"xmloption">
4070 <term><varname>xmloption
</varname> (
<type>enum
</type>)
</term>
4072 <primary><varname>xmloption<
/> configuration parameter
</primary>
4075 <primary><varname>SET XML OPTION<
/></primary>
4078 <primary>XML option
</primary>
4082 Sets whether
<literal>DOCUMENT
</literal> or
4083 <literal>CONTENT
</literal> is implicit when converting between
4084 XML and character string values. See
<xref
4085 linkend=
"datatype-xml"> for a description of this. Valid
4086 values are
<literal>DOCUMENT
</literal> and
4087 <literal>CONTENT
</literal>. The default is
4088 <literal>CONTENT
</literal>.
4092 According to the SQL standard, the command to set this option is
4094 SET XML OPTION { DOCUMENT | CONTENT };
4096 This syntax is also available in PostgreSQL.
4103 <sect2 id=
"runtime-config-client-format">
4104 <title>Locale and Formatting
</title>
4108 <varlistentry id=
"guc-datestyle" xreflabel=
"DateStyle">
4109 <term><varname>DateStyle
</varname> (
<type>string
</type>)
</term>
4111 <primary><varname>DateStyle<
/> configuration parameter
</primary>
4115 Sets the display format for date and time values, as well as the
4116 rules for interpreting ambiguous date input values. For
4117 historical reasons, this variable contains two independent
4118 components: the output format specification (
<literal>ISO<
/>,
4119 <literal>Postgres<
/>,
<literal>SQL<
/>, or
<literal>German<
/>)
4120 and the input/output specification for year/month/day ordering
4121 (
<literal>DMY<
/>,
<literal>MDY<
/>, or
<literal>YMD<
/>). These
4122 can be set separately or together. The keywords
<literal>Euro<
/>
4123 and
<literal>European<
/> are synonyms for
<literal>DMY<
/>; the
4124 keywords
<literal>US<
/>,
<literal>NonEuro<
/>, and
4125 <literal>NonEuropean<
/> are synonyms for
<literal>MDY<
/>. See
4126 <xref linkend=
"datatype-datetime"> for more information. The
4127 built-in default is
<literal>ISO, MDY<
/>, but
4128 <application>initdb
</application> will initialize the
4129 configuration file with a setting that corresponds to the
4130 behavior of the chosen
<varname>lc_time
</varname> locale.
4135 <varlistentry id=
"guc-intervalstyle" xreflabel=
"IntervalStyle">
4136 <term><varname>IntervalStyle
</varname> (
<type>enum
</type>)
</term>
4138 <primary><varname>IntervalStyle<
/> configuration parameter
</primary>
4142 Sets the display format for interval values.
4143 The value
<literal>sql_standard<
/> will produce
4144 output matching
<acronym>SQL
</acronym> standard interval literals.
4145 The value
<literal>postgres<
/> (which is the default) will produce
4146 output matching
<productname>PostgreSQL<
/> releases prior to
8.4
4147 when the
<xref linkend=
"guc-datestyle">
4148 parameter was set to
<literal>ISO<
/>.
4149 The value
<literal>postgres_verbose<
/> will produce output
4150 matching
<productname>PostgreSQL<
/> releases prior to
8.4
4151 when the
<varname>DateStyle<
/>
4152 parameter was set to non-
<literal>ISO<
/> output.
4153 The value
<literal>iso_8601<
/> will produce output matching the time
4154 interval
<quote>format with designators<
/> defined in section
4155 4.4.3.2 of ISO
8601.
4158 The
<varname>IntervalStyle<
/> parameter also affects the
4159 interpretation of ambiguous interval input. See
4160 <xref linkend=
"datatype-interval-input"> for more information.
4165 <varlistentry id=
"guc-timezone" xreflabel=
"timezone">
4166 <term><varname>timezone
</varname> (
<type>string
</type>)
</term>
4168 <primary><varname>timezone<
/> configuration parameter
</primary>
4170 <indexterm><primary>time zone<
/><
/>
4173 Sets the time zone for displaying and interpreting time stamps.
4174 The default is
<literal>unknown<
/>, which means to use whatever
4175 the system environment specifies as the time zone. See
<xref
4176 linkend=
"datatype-timezones"> for more
4182 <varlistentry id=
"guc-timezone-abbreviations" xreflabel=
"timezone_abbreviations">
4183 <term><varname>timezone_abbreviations
</varname> (
<type>string
</type>)
</term>
4185 <primary><varname>timezone_abbreviations<
/> configuration parameter
</primary>
4187 <indexterm><primary>time zone names<
/><
/>
4190 Sets the collection of time zone abbreviations that will be accepted
4191 by the server for datetime input. The default is
<literal>'Default'<
/>,
4192 which is a collection that works in most of the world; there are
4193 also 'Australia' and 'India', and other collections can be defined
4194 for a particular installation. See
<xref
4195 linkend=
"datetime-appendix"> for more information.
4200 <varlistentry id=
"guc-extra-float-digits" xreflabel=
"extra_float_digits">
4202 <primary>significant digits
</primary>
4205 <primary>floating-point
</primary>
4206 <secondary>display
</secondary>
4209 <primary><varname>extra_float_digits<
/> configuration parameter
</primary>
4212 <term><varname>extra_float_digits
</varname> (
<type>integer
</type>)
</term>
4215 This parameter adjusts the number of digits displayed for
4216 floating-point values, including
<type>float4<
/>,
<type>float8<
/>,
4217 and geometric data types. The parameter value is added to the
4218 standard number of digits (
<literal>FLT_DIG<
/> or
<literal>DBL_DIG<
/>
4219 as appropriate). The value can be set as high as
2, to include
4220 partially-significant digits; this is especially useful for dumping
4221 float data that needs to be restored exactly. Or it can be set
4222 negative to suppress unwanted digits.
4227 <varlistentry id=
"guc-client-encoding" xreflabel=
"client_encoding">
4228 <term><varname>client_encoding
</varname> (
<type>string
</type>)
</term>
4230 <primary><varname>client_encoding<
/> configuration parameter
</primary>
4232 <indexterm><primary>character set<
/><
/>
4235 Sets the client-side encoding (character set).
4236 The default is to use the database encoding.
4241 <varlistentry id=
"guc-lc-messages" xreflabel=
"lc_messages">
4242 <term><varname>lc_messages
</varname> (
<type>string
</type>)
</term>
4244 <primary><varname>lc_messages<
/> configuration parameter
</primary>
4248 Sets the language in which messages are displayed. Acceptable
4249 values are system-dependent; see
<xref linkend=
"locale"> for
4250 more information. If this variable is set to the empty string
4251 (which is the default) then the value is inherited from the
4252 execution environment of the server in a system-dependent way.
4256 On some systems, this locale category does not exist. Setting
4257 this variable will still work, but there will be no effect.
4258 Also, there is a chance that no translated messages for the
4259 desired language exist. In that case you will continue to see
4260 the English messages.
4264 Only superusers can change this setting, because it affects the
4265 messages sent to the server log as well as to the client.
4270 <varlistentry id=
"guc-lc-monetary" xreflabel=
"lc_monetary">
4271 <term><varname>lc_monetary
</varname> (
<type>string
</type>)
</term>
4273 <primary><varname>lc_monetary<
/> configuration parameter
</primary>
4277 Sets the locale to use for formatting monetary amounts, for
4278 example with the
<function>to_char
</function> family of
4279 functions. Acceptable values are system-dependent; see
<xref
4280 linkend=
"locale"> for more information. If this variable is
4281 set to the empty string (which is the default) then the value
4282 is inherited from the execution environment of the server in a
4283 system-dependent way.
4288 <varlistentry id=
"guc-lc-numeric" xreflabel=
"lc_numeric">
4289 <term><varname>lc_numeric
</varname> (
<type>string
</type>)
</term>
4291 <primary><varname>lc_numeric<
/> configuration parameter
</primary>
4295 Sets the locale to use for formatting numbers, for example
4296 with the
<function>to_char
</function> family of
4297 functions. Acceptable values are system-dependent; see
<xref
4298 linkend=
"locale"> for more information. If this variable is
4299 set to the empty string (which is the default) then the value
4300 is inherited from the execution environment of the server in a
4301 system-dependent way.
4306 <varlistentry id=
"guc-lc-time" xreflabel=
"lc_time">
4307 <term><varname>lc_time
</varname> (
<type>string
</type>)
</term>
4309 <primary><varname>lc_time<
/> configuration parameter
</primary>
4313 Sets the locale to use for formatting dates and times, for example
4314 with the
<function>to_char
</function> family of
4315 functions. Acceptable values are system-dependent; see
<xref
4316 linkend=
"locale"> for more information. If this variable is
4317 set to the empty string (which is the default) then the value
4318 is inherited from the execution environment of the server in a
4319 system-dependent way.
4324 <varlistentry id=
"guc-default-text-search-config" xreflabel=
"default_text_search_config">
4325 <term><varname>default_text_search_config
</varname> (
<type>string
</type>)
</term>
4327 <primary><varname>default_text_search_config<
/> configuration parameter
</primary>
4331 Selects the text search configuration that is used by those variants
4332 of the text search functions that do not have an explicit argument
4333 specifying the configuration.
4334 See
<xref linkend=
"textsearch"> for further information.
4335 The built-in default is
<literal>pg_catalog.simple<
/>, but
4336 <application>initdb
</application> will initialize the
4337 configuration file with a setting that corresponds to the
4338 chosen
<varname>lc_ctype
</varname> locale, if a configuration
4339 matching that locale can be identified.
4347 <sect2 id=
"runtime-config-client-other">
4348 <title>Other Defaults
</title>
4352 <varlistentry id=
"guc-dynamic-library-path" xreflabel=
"dynamic_library_path">
4353 <term><varname>dynamic_library_path
</varname> (
<type>string
</type>)
</term>
4355 <primary><varname>dynamic_library_path<
/> configuration parameter
</primary>
4357 <indexterm><primary>dynamic loading<
/><
/>
4360 If a dynamically loadable module needs to be opened and the
4361 file name specified in the
<command>CREATE FUNCTION
</command> or
4362 <command>LOAD
</command> command
4363 does not have a directory component (i.e., the
4364 name does not contain a slash), the system will search this
4365 path for the required file.
4369 The value for
<varname>dynamic_library_path
</varname> has to be a
4370 list of absolute directory paths separated by colons (or semi-colons
4371 on Windows). If a list element starts
4372 with the special string
<literal>$libdir
</literal>, the
4373 compiled-in
<productname>PostgreSQL
</productname> package
4374 library directory is substituted for
<literal>$libdir
</literal>. This
4375 is where the modules provided by the standard
4376 <productname>PostgreSQL
</productname> distribution are installed.
4377 (Use
<literal>pg_config --pkglibdir
</literal> to find out the name of
4378 this directory.) For example:
4380 dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
4382 or, in a Windows environment:
4384 dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
4389 The default value for this parameter is
4390 <literal>'$libdir'
</literal>. If the value is set to an empty
4391 string, the automatic path search is turned off.
4395 This parameter can be changed at run time by superusers, but a
4396 setting done that way will only persist until the end of the
4397 client connection, so this method should be reserved for
4398 development purposes. The recommended way to set this parameter
4399 is in the
<filename>postgresql.conf
</filename> configuration
4405 <varlistentry id=
"guc-gin-fuzzy-search-limit" xreflabel=
"gin_fuzzy_search_limit">
4406 <term><varname>gin_fuzzy_search_limit
</varname> (
<type>integer
</type>)
</term>
4408 <primary><varname>gin_fuzzy_search_limit<
/> configuration parameter
</primary>
4412 Soft upper limit of the size of the set returned by GIN index. For more
4413 information see
<xref linkend=
"gin-tips">.
4418 <varlistentry id=
"guc-local-preload-libraries" xreflabel=
"local_preload_libraries">
4419 <term><varname>local_preload_libraries
</varname> (
<type>string
</type>)
</term>
4421 <primary><varname>local_preload_libraries<
/> configuration parameter
</primary>
4424 <primary><filename>$libdir/plugins<
/></primary>
4428 This variable specifies one or more shared libraries that are
4429 to be preloaded at connection start. If more than one library
4430 is to be loaded, separate their names with commas.
4431 This parameter cannot be changed after the start of a particular
4436 Because this is not a superuser-only option, the libraries
4437 that can be loaded are restricted to those appearing in the
4438 <filename>plugins<
/> subdirectory of the installation's
4439 standard library directory. (It is the database administrator's
4440 responsibility to ensure that only
<quote>safe<
/> libraries
4441 are installed there.) Entries in
<varname>local_preload_libraries<
/>
4442 can specify this directory explicitly, for example
4443 <literal>$libdir/plugins/mylib
</literal>, or just specify
4444 the library name
— <literal>mylib
</literal> would have
4445 the same effect as
<literal>$libdir/plugins/mylib
</literal>.
4449 There is no performance advantage to loading a library at session
4450 start rather than when it is first used. Rather, the intent of
4451 this feature is to allow debugging or performance-measurement
4452 libraries to be loaded into specific sessions without an explicit
4453 <command>LOAD<
/> command being given. For example, debugging could
4454 be enabled for all sessions under a given user name by setting
4455 this parameter with
<command>ALTER USER SET<
/>.
4459 If a specified library is not found,
4460 the connection attempt will fail.
4464 Every PostgreSQL-supported library has a
<quote>magic
4465 block<
/> that is checked to guarantee compatibility.
4466 For this reason, non-PostgreSQL libraries cannot be
4476 <sect1 id=
"runtime-config-locks">
4477 <title>Lock Management
</title>
4481 <varlistentry id=
"guc-deadlock-timeout" xreflabel=
"deadlock_timeout">
4483 <primary>deadlock
</primary>
4484 <secondary>timeout during
</secondary>
4487 <primary>timeout
</primary>
4488 <secondary>deadlock
</secondary>
4491 <primary><varname>deadlock_timeout<
/> configuration parameter
</primary>
4494 <term><varname>deadlock_timeout
</varname> (
<type>integer
</type>)
</term>
4497 This is the amount of time, in milliseconds, to wait on a lock
4498 before checking to see if there is a deadlock condition. The
4499 check for deadlock is relatively slow, so the server doesn't run
4500 it every time it waits for a lock. We optimistically assume
4501 that deadlocks are not common in production applications and
4502 just wait on the lock for a while before starting the check for a
4503 deadlock. Increasing this value reduces the amount of time
4504 wasted in needless deadlock checks, but slows down reporting of
4505 real deadlock errors. The default is one second (
<literal>1s<
/>),
4506 which is probably about the smallest value you would want in
4507 practice. On a heavily loaded server you might want to raise it.
4508 Ideally the setting should exceed your typical transaction time,
4509 so as to improve the odds that a lock will be released before
4510 the waiter decides to check for deadlock.
4514 When
<xref linkend=
"guc-log-lock-waits"> is set,
4515 this parameter also determines the length of time to wait before
4516 a log message is issued about the lock wait. If you are trying
4517 to investigate locking delays you might want to set a shorter than
4518 normal
<varname>deadlock_timeout
</varname>.
4523 <varlistentry id=
"guc-max-locks-per-transaction" xreflabel=
"max_locks_per_transaction">
4524 <term><varname>max_locks_per_transaction
</varname> (
<type>integer
</type>)
</term>
4526 <primary><varname>max_locks_per_transaction<
/> configuration parameter
</primary>
4530 The shared lock table is created to track locks on
4531 <varname>max_locks_per_transaction
</varname> * (
<xref
4532 linkend=
"guc-max-connections"> +
<xref
4533 linkend=
"guc-max-prepared-transactions">) objects (e.g., tables);
4534 hence, no more than this many distinct objects can be locked at
4535 any one time. This parameter controls the average number of object
4536 locks allocated for each transaction; individual transactions
4537 can lock more objects as long as the locks of all transactions
4538 fit in the lock table. This is
<emphasis>not<
/> the number of
4539 rows that can be locked; that value is unlimited. The default,
4540 64, has historically proven sufficient, but you might need to
4541 raise this value if you have clients that touch many different
4542 tables in a single transaction. This parameter can only be set at
4547 Increasing this parameter might cause
<productname>PostgreSQL<
/>
4548 to request more
<systemitem class=
"osname">System V<
/> shared
4549 memory than your operating system's default configuration
4550 allows. See
<xref linkend=
"sysvipc"> for information on how to
4551 adjust those parameters, if necessary.
4559 <sect1 id=
"runtime-config-compatible">
4560 <title>Version and Platform Compatibility
</title>
4562 <sect2 id=
"runtime-config-compatible-version">
4563 <title>Previous PostgreSQL Versions
</title>
4567 <varlistentry id=
"guc-add-missing-from" xreflabel=
"add_missing_from">
4568 <term><varname>add_missing_from
</varname> (
<type>boolean
</type>)
</term>
4569 <indexterm><primary>FROM<
/><secondary>missing<
/><
/>
4571 <primary><varname>add_missing_from<
/> configuration parameter
</primary>
4575 When on, tables that are referenced by a query will be
4576 automatically added to the
<literal>FROM<
/> clause if not
4577 already present. This behavior does not comply with the SQL
4578 standard and many people dislike it because it can mask mistakes
4579 (such as referencing a table where you should have referenced
4580 its alias). The default is
<literal>off<
/>. This variable can be
4581 enabled for compatibility with releases of
4582 <productname>PostgreSQL<
/> prior to
8.1, where this behavior was
4587 Note that even when this variable is enabled, a warning
4588 message will be emitted for each implicit
<literal>FROM<
/>
4589 entry referenced by a query. Users are encouraged to update
4590 their applications to not rely on this behavior, by adding all
4591 tables referenced by a query to the query's
<literal>FROM<
/>
4592 clause (or its
<literal>USING<
/> clause in the case of
4593 <command>DELETE<
/>).
4598 <varlistentry id=
"guc-array-nulls" xreflabel=
"array_nulls">
4599 <term><varname>array_nulls
</varname> (
<type>boolean
</type>)
</term>
4601 <primary><varname>array_nulls<
/> configuration parameter
</primary>
4605 This controls whether the array input parser recognizes
4606 unquoted
<literal>NULL<
/> as specifying a null array element.
4607 By default, this is
<literal>on<
/>, allowing array values containing
4608 null values to be entered. However,
<productname>PostgreSQL<
/> versions
4609 before
8.2 did not support null values in arrays, and therefore would
4610 treat
<literal>NULL<
/> as specifying a normal array element with
4611 the string value
<quote>NULL<
/>. For backwards compatibility with
4612 applications that require the old behavior, this variable can be
4613 turned
<literal>off<
/>.
4617 Note that it is possible to create array values containing null values
4618 even when this variable is
<literal>off<
/>.
4623 <varlistentry id=
"guc-backslash-quote" xreflabel=
"backslash_quote">
4624 <term><varname>backslash_quote
</varname> (
<type>enum
</type>)
</term>
4625 <indexterm><primary>strings<
/><secondary>backslash quotes<
/><
/>
4627 <primary><varname>backslash_quote<
/> configuration parameter
</primary>
4631 This controls whether a quote mark can be represented by
4632 <literal>\'<
/> in a string literal. The preferred, SQL-standard way
4633 to represent a quote mark is by doubling it (
<literal>''<
/>) but
4634 <productname>PostgreSQL<
/> has historically also accepted
4635 <literal>\'<
/>. However, use of
<literal>\'<
/> creates security risks
4636 because in some client character set encodings, there are multibyte
4637 characters in which the last byte is numerically equivalent to ASCII
4638 <literal>\<
/>. If client-side code does escaping incorrectly then a
4639 SQL-injection attack is possible. This risk can be prevented by
4640 making the server reject queries in which a quote mark appears to be
4641 escaped by a backslash.
4642 The allowed values of
<varname>backslash_quote<
/> are
4643 <literal>on<
/> (allow
<literal>\'<
/> always),
4644 <literal>off<
/> (reject always), and
4645 <literal>safe_encoding<
/> (allow only if client encoding does not
4646 allow ASCII
<literal>\<
/> within a multibyte character).
4647 <literal>safe_encoding<
/> is the default setting.
4651 Note that in a standard-conforming string literal,
<literal>\<
/> just
4652 means
<literal>\<
/> anyway. This parameter affects the handling of
4653 non-standard-conforming literals, including
4654 escape string syntax (
<literal>E'...'<
/>).
4659 <varlistentry id=
"guc-default-with-oids" xreflabel=
"default_with_oids">
4660 <term><varname>default_with_oids
</varname> (
<type>boolean
</type>)
</term>
4662 <primary><varname>default_with_oids<
/> configuration parameter
</primary>
4666 This controls whether
<command>CREATE TABLE
</command> and
4667 <command>CREATE TABLE AS
</command> include an OID column in
4668 newly-created tables, if neither
<literal>WITH OIDS
</literal>
4669 nor
<literal>WITHOUT OIDS
</literal> is specified. It also
4670 determines whether OIDs will be included in tables created by
4671 <command>SELECT INTO
</command>. In
<productname>PostgreSQL<
/>
4672 8.1 <varname>default_with_oids<
/> is
<literal>off<
/> by default; in
4673 prior versions of
<productname>PostgreSQL
</productname>, it
4678 The use of OIDs in user tables is considered deprecated, so
4679 most installations should leave this variable disabled.
4680 Applications that require OIDs for a particular table should
4681 specify
<literal>WITH OIDS
</literal> when creating the
4682 table. This variable can be enabled for compatibility with old
4683 applications that do not follow this behavior.
4688 <varlistentry id=
"guc-escape-string-warning" xreflabel=
"escape_string_warning">
4689 <term><varname>escape_string_warning
</varname> (
<type>boolean
</type>)
</term>
4690 <indexterm><primary>strings<
/><secondary>escape warning<
/><
/>
4692 <primary><varname>escape_string_warning<
/> configuration parameter
</primary>
4696 When on, a warning is issued if a backslash (
<literal>\<
/>)
4697 appears in an ordinary string literal (
<literal>'...'<
/>
4698 syntax) and
<varname>standard_conforming_strings
</varname> is off.
4699 The default is
<literal>on<
/>.
4702 Applications that wish to use backslash as escape should be
4703 modified to use escape string syntax (
<literal>E'...'<
/>),
4704 because the default behavior of ordinary strings will change
4705 in a future release for SQL compatibility. This variable can
4706 be enabled to help detect applications that will break.
4711 <varlistentry id=
"guc-regex-flavor" xreflabel=
"regex_flavor">
4712 <term><varname>regex_flavor
</varname> (
<type>enum
</type>)
</term>
4713 <indexterm><primary>regular expressions<
/><
/>
4715 <primary><varname>regex_flavor<
/> configuration parameter
</primary>
4719 The regular expression
<quote>flavor<
/> can be set to
4720 <literal>advanced<
/>,
<literal>extended<
/>, or
<literal>basic<
/>.
4721 The default is
<literal>advanced<
/>. The
<literal>extended<
/>
4722 setting might be useful for exact backwards compatibility with
4723 pre-
7.4 releases of
<productname>PostgreSQL<
/>. See
4724 <xref linkend=
"posix-syntax-details"> for details.
4729 <varlistentry id=
"guc-sql-inheritance" xreflabel=
"sql_inheritance">
4730 <term><varname>sql_inheritance
</varname> (
<type>boolean
</type>)
</term>
4732 <primary><varname>sql_inheritance<
/> configuration parameter
</primary>
4734 <indexterm><primary>inheritance<
/><
/>
4737 This controls the inheritance semantics. If turned
<literal>off<
/>,
4738 subtables are not included by various commands by default; basically
4739 an implied
<literal>ONLY
</literal> key word. This was added for
4740 compatibility with releases prior to
7.1. See
4741 <xref linkend=
"ddl-inherit"> for more information.
4746 <varlistentry id=
"guc-standard-conforming-strings" xreflabel=
"standard_conforming_strings">
4747 <term><varname>standard_conforming_strings
</varname> (
<type>boolean
</type>)
</term>
4748 <indexterm><primary>strings<
/><secondary>standard conforming<
/><
/>
4750 <primary><varname>standard_conforming_strings<
/> configuration parameter
</primary>
4754 This controls whether ordinary string literals
4755 (
<literal>'...'<
/>) treat backslashes literally, as specified in
4757 The default is currently
<literal>off<
/>, causing
4758 <productname>PostgreSQL
</productname> to have its historical
4759 behavior of treating backslashes as escape characters.
4760 The default will change to
<literal>on<
/> in a future release
4761 to improve compatibility with the standard.
4762 Applications can check this
4763 parameter to determine how string literals will be processed.
4764 The presence of this parameter can also be taken as an indication
4765 that the escape string syntax (
<literal>E'...'<
/>) is supported.
4766 Escape string syntax should be used if an application desires
4767 backslashes to be treated as escape characters.
4772 <varlistentry id=
"guc-synchronize-seqscans" xreflabel=
"synchronize_seqscans">
4773 <term><varname>synchronize_seqscans
</varname> (
<type>boolean
</type>)
</term>
4775 <primary><varname>synchronize_seqscans<
/> configuration parameter
</primary>
4779 This allows sequential scans of large tables to synchronize with each
4780 other, so that concurrent scans read the same block at about the
4781 same time and hence share the I/O workload. When this is enabled,
4782 a scan might start in the middle of the table and then
<quote>wrap
4783 around<
/> the end to cover all rows, so as to synchronize with the
4784 activity of scans already in progress. This can result in
4785 unpredictable changes in the row ordering returned by queries that
4786 have no
<literal>ORDER BY<
/> clause. Setting this parameter to
4787 <literal>off<
/> ensures the pre-
8.3 behavior in which a sequential
4788 scan always starts from the beginning of the table. The default
4797 <sect2 id=
"runtime-config-compatible-clients">
4798 <title>Platform and Client Compatibility
</title>
4801 <varlistentry id=
"guc-transform-null-equals" xreflabel=
"transform_null_equals">
4802 <term><varname>transform_null_equals
</varname> (
<type>boolean
</type>)
</term>
4803 <indexterm><primary>IS NULL<
/><
/>
4805 <primary><varname>transform_null_equals<
/> configuration parameter
</primary>
4809 When on, expressions of the form
<literal><replaceable>expr<
/> =
4810 NULL
</literal> (or
<literal>NULL =
4811 <replaceable>expr<
/></literal>) are treated as
4812 <literal><replaceable>expr<
/> IS NULL
</literal>, that is, they
4813 return true if
<replaceable>expr<
/> evaluates to the null value,
4814 and false otherwise. The correct SQL-spec-compliant behavior of
4815 <literal><replaceable>expr<
/> = NULL
</literal> is to always
4816 return null (unknown). Therefore this parameter defaults to
4821 However, filtered forms in
<productname>Microsoft
4822 Access
</productname> generate queries that appear to use
4823 <literal><replaceable>expr<
/> = NULL
</literal> to test for
4824 null values, so if you use that interface to access the database you
4825 might want to turn this option on. Since expressions of the
4826 form
<literal><replaceable>expr<
/> = NULL
</literal> always
4827 return the null value (using the correct interpretation) they are not
4828 very useful and do not appear often in normal applications, so
4829 this option does little harm in practice. But new users are
4830 frequently confused about the semantics of expressions
4831 involving null values, so this option is not on by default.
4835 Note that this option only affects the exact form
<literal>= NULL<
/>,
4836 not other comparison operators or other expressions
4837 that are computationally equivalent to some expression
4838 involving the equals operator (such as
<literal>IN
</literal>).
4839 Thus, this option is not a general fix for bad programming.
4843 Refer to
<xref linkend=
"functions-comparison"> for related information.
4852 <sect1 id=
"runtime-config-preset">
4853 <title>Preset Options
</title>
4856 The following
<quote>parameters<
/> are read-only, and are determined
4857 when
<productname>PostgreSQL
</productname> is compiled or when it is
4858 installed. As such, they have been excluded from the sample
4859 <filename>postgresql.conf<
/> file. These options report
4860 various aspects of
<productname>PostgreSQL
</productname> behavior
4861 that might be of interest to certain applications, particularly
4862 administrative front-ends.
4867 <varlistentry id=
"guc-block-size" xreflabel=
"block_size">
4868 <term><varname>block_size
</varname> (
<type>integer
</type>)
</term>
4870 <primary><varname>block_size<
/> configuration parameter
</primary>
4874 Reports the size of a disk block. It is determined by the value
4875 of
<literal>BLCKSZ<
/> when building the server. The default
4876 value is
8192 bytes. The meaning of some configuration
4877 variables (such as
<xref linkend=
"guc-shared-buffers">) is
4878 influenced by
<varname>block_size
</varname>. See
<xref
4879 linkend=
"runtime-config-resource"> for information.
4884 <varlistentry id=
"guc-integer-datetimes" xreflabel=
"integer_datetimes">
4885 <term><varname>integer_datetimes
</varname> (
<type>boolean
</type>)
</term>
4887 <primary><varname>integer_datetimes<
/> configuration parameter
</primary>
4891 Reports whether
<productname>PostgreSQL<
/> was built with
4892 support for
64-bit-integer dates and times. This can be
4893 disabled by configuring with
<literal>--disable-integer-datetimes<
/>
4894 when building
<productname>PostgreSQL<
/>. The default value is
4895 <literal>on
</literal>.
4900 <varlistentry id=
"guc-lc-collate" xreflabel=
"lc_collate">
4901 <term><varname>lc_collate
</varname> (
<type>string
</type>)
</term>
4903 <primary><varname>lc_collate<
/> configuration parameter
</primary>
4907 Reports the locale in which sorting of textual data is done.
4908 See
<xref linkend=
"locale"> for more information.
4909 This value is determined when a database is created.
4914 <varlistentry id=
"guc-lc-ctype" xreflabel=
"lc_ctype">
4915 <term><varname>lc_ctype
</varname> (
<type>string
</type>)
</term>
4917 <primary><varname>lc_ctype<
/> configuration parameter
</primary>
4921 Reports the locale that determines character classifications.
4922 See
<xref linkend=
"locale"> for more information.
4923 This value is determined when a database is created.
4924 Ordinarily this will be the same as
<varname>lc_collate
</varname>,
4925 but for special applications it might be set differently.
4930 <varlistentry id=
"guc-max-function-args" xreflabel=
"max_function_args">
4931 <term><varname>max_function_args
</varname> (
<type>integer
</type>)
</term>
4933 <primary><varname>max_function_args<
/> configuration parameter
</primary>
4937 Reports the maximum number of function arguments. It is determined by
4938 the value of
<literal>FUNC_MAX_ARGS<
/> when building the server. The
4939 default value is
100 arguments.
4944 <varlistentry id=
"guc-max-identifier-length" xreflabel=
"max_identifier_length">
4945 <term><varname>max_identifier_length
</varname> (
<type>integer
</type>)
</term>
4947 <primary><varname>max_identifier_length<
/> configuration parameter
</primary>
4951 Reports the maximum identifier length. It is determined as one
4952 less than the value of
<literal>NAMEDATALEN<
/> when building
4953 the server. The default value of
<literal>NAMEDATALEN<
/> is
4954 64; therefore the default
4955 <varname>max_identifier_length
</varname> is
63 bytes.
4960 <varlistentry id=
"guc-max-index-keys" xreflabel=
"max_index_keys">
4961 <term><varname>max_index_keys
</varname> (
<type>integer
</type>)
</term>
4963 <primary><varname>max_index_keys<
/> configuration parameter
</primary>
4967 Reports the maximum number of index keys. It is determined by
4968 the value of
<literal>INDEX_MAX_KEYS<
/> when building the server. The
4969 default value is
32 keys.
4974 <varlistentry id=
"guc-segment-size" xreflabel=
"segment_size">
4975 <term><varname>segment_size
</varname> (
<type>integer
</type>)
</term>
4977 <primary><varname>segment_size<
/> configuration parameter
</primary>
4981 Reports the number of blocks (pages) that can be stored within a file
4982 segment. It is determined by the value of
<literal>RELSEG_SIZE<
/>
4983 when building the server. The maximum size of a segment file in bytes
4984 is equal to
<varname>segment_size<
/> multiplied by
4985 <varname>block_size<
/>; by default this is
1GB.
4990 <varlistentry id=
"guc-server-encoding" xreflabel=
"server_encoding">
4991 <term><varname>server_encoding
</varname> (
<type>string
</type>)
</term>
4993 <primary><varname>server_encoding<
/> configuration parameter
</primary>
4995 <indexterm><primary>character set<
/><
/>
4998 Reports the database encoding (character set).
4999 It is determined when the database is created. Ordinarily,
5000 clients need only be concerned with the value of
<xref
5001 linkend=
"guc-client-encoding">.
5006 <varlistentry id=
"guc-server-version" xreflabel=
"server_version">
5007 <term><varname>server_version
</varname> (
<type>string
</type>)
</term>
5009 <primary><varname>server_version<
/> configuration parameter
</primary>
5013 Reports the version number of the server. It is determined by the
5014 value of
<literal>PG_VERSION<
/> when building the server.
5019 <varlistentry id=
"guc-server-version-num" xreflabel=
"server_version_num">
5020 <term><varname>server_version_num
</varname> (
<type>integer
</type>)
</term>
5022 <primary><varname>server_version_num<
/> configuration parameter
</primary>
5026 Reports the version number of the server as an integer. It is determined
5027 by the value of
<literal>PG_VERSION_NUM<
/> when building the server.
5032 <varlistentry id=
"guc-wal-block-size" xreflabel=
"wal_block_size">
5033 <term><varname>wal_block_size
</varname> (
<type>integer
</type>)
</term>
5035 <primary><varname>wal_block_size<
/> configuration parameter
</primary>
5039 Reports the size of a WAL disk block. It is determined by the value
5040 of
<literal>XLOG_BLCKSZ<
/> when building the server. The default value
5046 <varlistentry id=
"guc-wal-segment-size" xreflabel=
"wal_segment_size">
5047 <term><varname>wal_segment_size
</varname> (
<type>integer
</type>)
</term>
5049 <primary><varname>wal_segment_size<
/> configuration parameter
</primary>
5053 Reports the number of blocks (pages) in a WAL segment file.
5054 The total size of a WAL segment file in bytes is equal to
5055 <varname>wal_segment_size<
/> multiplied by
<varname>wal_block_size<
/>;
5056 by default this is
16MB. See
<xref linkend=
"wal-configuration"> for
5065 <sect1 id=
"runtime-config-custom">
5066 <title>Customized Options
</title>
5069 This feature was designed to allow parameters not normally known to
5070 <productname>PostgreSQL
</productname> to be added by add-on modules
5071 (such as procedural languages). This allows add-on modules to be
5072 configured in the standard ways.
5077 <varlistentry id=
"guc-custom-variable-classes" xreflabel=
"custom_variable_classes">
5078 <term><varname>custom_variable_classes
</varname> (
<type>string
</type>)
</term>
5080 <primary><varname>custom_variable_classes<
/> configuration parameter
</primary>
5084 This variable specifies one or several class names to be used for
5085 custom variables, in the form of a comma-separated list. A custom
5086 variable is a variable not normally known
5087 to
<productname>PostgreSQL
</productname> proper but used by some
5088 add-on module. Such variables must have names consisting of a class
5089 name, a dot, and a variable name.
<varname>custom_variable_classes<
/>
5090 specifies all the class names in use in a particular installation.
5091 This parameter can only be set in the
<filename>postgresql.conf<
/>
5092 file or on the server command line.
5100 The difficulty with setting custom variables in
5101 <filename>postgresql.conf<
/> is that the file must be read before add-on
5102 modules have been loaded, and so custom variables would ordinarily be
5103 rejected as unknown. When
<varname>custom_variable_classes<
/> is set,
5104 the server will accept definitions of arbitrary variables within each
5105 specified class. These variables will be treated as placeholders and
5106 will have no function until the module that defines them is loaded. When a
5107 module for a specific class is loaded, it will add the proper variable
5108 definitions for its class name, convert any placeholder
5109 values according to those definitions, and issue warnings for any
5110 placeholders of its class that remain (which presumably would be
5111 misspelled configuration variables).
5115 Here is an example of what
<filename>postgresql.conf<
/> might contain
5116 when using custom variables:
5119 custom_variable_classes = 'plr,plperl'
5120 plr.path = '/usr/lib/R'
5121 plperl.use_strict = true
5122 plruby.use_strict = true # generates error: unknown class name
5127 <sect1 id=
"runtime-config-developer">
5128 <title>Developer Options
</title>
5131 The following parameters are intended for work on the
5132 <productname>PostgreSQL
</productname> source, and in some cases
5133 to assist with recovery of severely damaged databases. There
5134 should be no reason to use them in a production database setup.
5135 As such, they have been excluded from the sample
5136 <filename>postgresql.conf<
/> file. Note that many of these
5137 parameters require special source compilation flags to work at all.
5141 <varlistentry id=
"guc-allow-system-table-mods" xreflabel=
"allow_system_table_mods">
5142 <term><varname>allow_system_table_mods
</varname> (
<type>boolean
</type>)
</term>
5144 <primary><varname>allow_system_table_mods
</varname> configuration parameter
</primary>
5148 Allows modification of the structure of system tables.
5149 This is used by
<command>initdb
</command>.
5150 This parameter can only be set at server start.
5155 <varlistentry id=
"guc-debug-assertions" xreflabel=
"debug_assertions">
5156 <term><varname>debug_assertions
</varname> (
<type>boolean
</type>)
</term>
5158 <primary><varname>debug_assertions<
/> configuration parameter
</primary>
5162 Turns on various assertion checks. This is a debugging aid. If
5163 you are experiencing strange problems or crashes you might want
5164 to turn this on, as it might expose programming mistakes. To use
5165 this parameter, the macro
<symbol>USE_ASSERT_CHECKING
</symbol>
5166 must be defined when
<productname>PostgreSQL
</productname> is
5167 built (accomplished by the
<command>configure
</command> option
5168 <option>--enable-cassert
</option>). Note that
5169 <varname>debug_assertions
</varname> defaults to
<literal>on<
/>
5170 if
<productname>PostgreSQL
</productname> has been built with
5176 <varlistentry id=
"guc-ignore-system-indexes" xreflabel=
"ignore_system_indexes">
5177 <term><varname>ignore_system_indexes
</varname> (
<type>boolean
</type>)
</term>
5179 <primary><varname>ignore_system_indexes
</varname> configuration parameter
</primary>
5183 Ignore system indexes when reading system tables (but still
5184 update the indexes when modifying the tables). This is useful
5185 when recovering from damaged system indexes.
5186 This parameter cannot be changed after session start.
5191 <varlistentry id=
"guc-post-auth-delay" xreflabel=
"post_auth_delay">
5192 <term><varname>post_auth_delay
</varname> (
<type>integer
</type>)
</term>
5194 <primary><varname>post_auth_delay<
/> configuration parameter
</primary>
5198 If nonzero, a delay of this many seconds occurs when a new
5199 server process is started, after it conducts the
5200 authentication procedure. This is intended to give an
5201 opportunity to attach to the server process with a debugger.
5202 This parameter cannot be changed after session start.
5207 <varlistentry id=
"guc-pre-auth-delay" xreflabel=
"pre_auth_delay">
5208 <term><varname>pre_auth_delay
</varname> (
<type>integer
</type>)
</term>
5210 <primary><varname>pre_auth_delay<
/> configuration parameter
</primary>
5214 If nonzero, a delay of this many seconds occurs just after a
5215 new server process is forked, before it conducts the
5216 authentication procedure. This is intended to give an
5217 opportunity to attach to the server process with a debugger to
5218 trace down misbehavior in authentication.
5219 This parameter can only be set in the
<filename>postgresql.conf<
/>
5220 file or on the server command line.
5225 <varlistentry id=
"guc-trace-notify" xreflabel=
"trace_notify">
5226 <term><varname>trace_notify
</varname> (
<type>boolean
</type>)
</term>
5228 <primary><varname>trace_notify<
/> configuration parameter
</primary>
5232 Generates a great amount of debugging output for the
5233 <command>LISTEN
</command> and
<command>NOTIFY
</command>
5234 commands.
<xref linkend=
"guc-client-min-messages"> or
5235 <xref linkend=
"guc-log-min-messages"> must be
5236 <literal>DEBUG1
</literal> or lower to send this output to the
5237 client or server log, respectively.
5242 <varlistentry id=
"guc-trace-sort" xreflabel=
"trace_sort">
5243 <term><varname>trace_sort
</varname> (
<type>boolean
</type>)
</term>
5245 <primary><varname>trace_sort<
/> configuration parameter
</primary>
5249 If on, emit information about resource usage during sort operations.
5250 This parameter is only available if the
<symbol>TRACE_SORT
</symbol> macro
5251 was defined when
<productname>PostgreSQL
</productname> was compiled.
5252 (However,
<symbol>TRACE_SORT
</symbol> is currently defined by default.)
5258 <term><varname>trace_locks
</varname> (
<type>boolean
</type>)
</term>
5260 <primary><varname>trace_locks<
/> configuration parameter
</primary>
5264 If on, emit information about lock usage. Information dumped
5265 includes the type of lock operation, the type of lock and the unique
5266 identifier of the object being locked or unlocked. Also included
5267 are bitmasks for the lock types already granted on this object as
5268 well as for the lock types awaited on this object. For each lock
5269 type a count of the number of granted locks and waiting locks is
5270 also dumped as well as the totals. An example of the log file output
5274 LOG: LockAcquire: new: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5275 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
5276 wait(
0) type(AccessShareLock)
5279 LOG: GrantLock: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5280 grantMask(
2) req(
1,
0,
0,
0,
0,
0,
0)=
1 grant(
1,
0,
0,
0,
0,
0,
0)=
1
5281 wait(
0) type(AccessShareLock)
5285 LOG: UnGrantLock: updated: lock(
0xb7acd844) id(
24688,
24696,
0,
0,
0,
1)
5286 grantMask(
0) req(
0,
0,
0,
0,
0,
0,
0)=
0 grant(
0,
0,
0,
0,
0,
0,
0)=
0
5287 wait(
0) type(AccessShareLock)
5290 LOG: CleanUpLock: deleting: 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(INVALID)
5295 Details of the structure being dumped may be found in
5296 src/include/storage/lock.h
5299 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5300 macro was defined when
<productname>PostgreSQL
</productname> was
5307 <term><varname>trace_lwlocks
</varname> (
<type>boolean
</type>)
</term>
5309 <primary><varname>trace_lwlocks<
/> configuration parameter
</primary>
5313 If on, emit information about lightweight lock usage. Lightweight
5314 locks are intended primarily to provide mutual exclusion of access
5315 to shared-memory data structures.
5318 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5319 macro was defined when
<productname>PostgreSQL
</productname> was
5326 <term><varname>trace_userlocks
</varname> (
<type>boolean
</type>)
</term>
5328 <primary><varname>trace_userlocks<
/> configuration parameter
</primary>
5332 If on, emit information about user lock usage. Output is the same
5333 as for
<symbol>trace_locks
</symbol>, only for user locks.
5336 User locks were removed as of PostgreSQL version
8.2. This option
5337 currently has no effect.
5340 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5341 macro was defined when
<productname>PostgreSQL
</productname> was
5348 <term><varname>trace_lock_oidmin
</varname> (
<type>integer
</type>)
</term>
5350 <primary><varname>trace_lock_oidmin<
/> configuration parameter
</primary>
5354 If set, do not trace locks for tables below this OID. (use to avoid
5355 output on system tables)
5358 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5359 macro was defined when
<productname>PostgreSQL
</productname> was
5366 <term><varname>trace_lock_table
</varname> (
<type>integer
</type>)
</term>
5368 <primary><varname>trace_lock_table<
/> configuration parameter
</primary>
5372 Unconditionally trace locks on this table (OID).
5375 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5376 macro was defined when
<productname>PostgreSQL
</productname> was
5383 <term><varname>debug_deadlocks
</varname> (
<type>boolean
</type>)
</term>
5385 <primary><varname>debug_deadlocks<
/> configuration parameter
</primary>
5389 If set, dumps information about all current locks when a
5390 DeadLockTimeout occurs.
5393 This parameter is only available if the
<symbol>LOCK_DEBUG
</symbol>
5394 macro was defined when
<productname>PostgreSQL
</productname> was
5401 <term><varname>log_btree_build_stats
</varname> (
<type>boolean
</type>)
</term>
5403 <primary><varname>log_btree_build_stats<
/> configuration parameter
</primary>
5407 If set, logs system resource usage statistics (memory and CPU) on
5408 various btree operations.
5411 This parameter is only available if the
<symbol>BTREE_BUILD_STATS
</symbol>
5412 macro was defined when
<productname>PostgreSQL
</productname> was
5418 <varlistentry id=
"guc-wal-debug" xreflabel=
"wal_debug">
5419 <term><varname>wal_debug
</varname> (
<type>boolean
</type>)
</term>
5421 <primary><varname>wal_debug<
/> configuration parameter
</primary>
5425 If on, emit WAL-related debugging output. This parameter is
5426 only available if the
<symbol>WAL_DEBUG
</symbol> macro was
5427 defined when
<productname>PostgreSQL
</productname> was
5433 <varlistentry id=
"guc-zero-damaged-pages" xreflabel=
"zero_damaged_pages">
5434 <term><varname>zero_damaged_pages
</varname> (
<type>boolean
</type>)
</term>
5436 <primary><varname>zero_damaged_pages<
/> configuration parameter
</primary>
5440 Detection of a damaged page header normally causes
5441 <productname>PostgreSQL<
/> to report an error, aborting the current
5442 command. Setting
<varname>zero_damaged_pages<
/> to on causes
5443 the system to instead report a warning, zero out the damaged page,
5444 and continue processing. This behavior
<emphasis>will destroy data<
/>,
5445 namely all the rows on the damaged page. But it allows you to get
5446 past the error and retrieve rows from any undamaged pages that might
5447 be present in the table. So it is useful for recovering data if
5448 corruption has occurred due to hardware or software error. You should
5449 generally not set this on until you have given up hope of recovering
5450 data from the damaged page(s) of a table. The
5451 default setting is
<literal>off<
/>, and it can only be changed
5458 <sect1 id=
"runtime-config-short">
5459 <title>Short Options
</title>
5462 For convenience there are also single letter command-line option
5463 switches available for some parameters. They are described in
5464 <xref linkend=
"runtime-config-short-table">. Some of these
5465 options exist for historical reasons, and their presence as a
5466 single-letter option does not necessarily indicate an endorsement
5467 to use the option heavily.
5470 <table id=
"runtime-config-short-table">
5471 <title>Short option key
</title>
5475 <entry>Short option
</entry>
5476 <entry>Equivalent
</entry>
5482 <entry><option>-A
<replaceable>x
</replaceable></option></entry>
5483 <entry><literal>debug_assertions =
<replaceable>x
</replaceable><
/></entry>
5486 <entry><option>-B
<replaceable>x
</replaceable></option></entry>
5487 <entry><literal>shared_buffers =
<replaceable>x
</replaceable><
/></entry>
5490 <entry><option>-d
<replaceable>x
</replaceable></option></entry>
5491 <entry><literal>log_min_messages = DEBUG
<replaceable>x
</replaceable><
/></entry>
5494 <entry><option>-e
</option></entry>
5495 <entry><literal>datestyle = euro<
/></entry>
5499 <option>-fb
</option>,
<option>-fh
</option>,
<option>-fi
</option>,
5500 <option>-fm
</option>,
<option>-fn
</option>,
5501 <option>-fs
</option>,
<option>-ft
</option>
5504 <literal>enable_bitmapscan = off<
/>,
5505 <literal>enable_hashjoin = off<
/>,
5506 <literal>enable_indexscan = off<
/>,
5507 <literal>enable_mergejoin = off<
/>,
5508 <literal>enable_nestloop = off<
/>,
5509 <literal>enable_seqscan = off<
/>,
5510 <literal>enable_tidscan = off<
/>
5514 <entry><option>-F
</option></entry>
5515 <entry><literal>fsync = off<
/></entry>
5518 <entry><option>-h
<replaceable>x
</replaceable></option></entry>
5519 <entry><literal>listen_addresses =
<replaceable>x
</replaceable><
/></entry>
5522 <entry><option>-i
</option></entry>
5523 <entry><literal>listen_addresses = '*'<
/></entry>
5526 <entry><option>-k
<replaceable>x
</replaceable></option></entry>
5527 <entry><literal>unix_socket_directory =
<replaceable>x
</replaceable><
/></entry>
5530 <entry><option>-l
</option></entry>
5531 <entry><literal>ssl = on<
/></entry>
5534 <entry><option>-N
<replaceable>x
</replaceable></option></entry>
5535 <entry><literal>max_connections =
<replaceable>x
</replaceable><
/></entry>
5538 <entry><option>-O
</option></entry>
5539 <entry><literal>allow_system_table_mods = on<
/></entry>
5542 <entry><option>-p
<replaceable>x
</replaceable></option></entry>
5543 <entry><literal>port =
<replaceable>x
</replaceable><
/></entry>
5546 <entry><option>-P
</option></entry>
5547 <entry><literal>ignore_system_indexes = on<
/></entry>
5550 <entry><option>-s
</option></entry>
5551 <entry><literal>log_statement_stats = on<
/></entry>
5554 <entry><option>-S
<replaceable>x
</replaceable></option></entry>
5555 <entry><literal>work_mem =
<replaceable>x
</replaceable><
/></entry>
5558 <entry><option>-tpa
</option>,
<option>-tpl
</option>,
<option>-te
</option></entry>
5559 <entry><literal>log_parser_stats = on<
/>,
5560 <literal>log_planner_stats = on<
/>,
5561 <literal>log_executor_stats = on<
/></entry>
5564 <entry><option>-W
<replaceable>x
</replaceable></option></entry>
5565 <entry><literal>post_auth_delay =
<replaceable>x
</replaceable><
/></entry>