<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Run-time Configuration</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 8.0.11 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Server Run-time Environment" HREF="runtime.html"><LINK REL="PREVIOUS" TITLE="Starting the Database Server" HREF="postmaster-start.html"><LINK REL="NEXT" TITLE="Managing Kernel Resources" HREF="kernel-resources.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2007-02-02T03:57:22"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" >PostgreSQL 8.0.11 Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="postmaster-start.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="runtime.html" >Fast Backward</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 16. Server Run-time Environment</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="runtime.html" >Fast Forward</A ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="kernel-resources.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="RUNTIME-CONFIG" >16.4. Run-time Configuration</A ></H1 ><A NAME="AEN16617" ></A ><P > There are a lot of configuration parameters that affect the behavior of the database system. In this subsection, we describe how to set configuration parameters; the following subsections discuss each parameter in detail. </P ><P > All parameter names are case-insensitive. Every parameter takes a value of one of four types: boolean, integer, floating point, or string. Boolean values may be written as <TT CLASS="LITERAL" >ON</TT >, <TT CLASS="LITERAL" >OFF</TT >, <TT CLASS="LITERAL" >TRUE</TT >, <TT CLASS="LITERAL" >FALSE</TT >, <TT CLASS="LITERAL" >YES</TT >, <TT CLASS="LITERAL" >NO</TT >, <TT CLASS="LITERAL" >1</TT >, <TT CLASS="LITERAL" >0</TT > (all case-insensitive) or any unambiguous prefix of these. </P ><P > One way to set these parameters is to edit the file <TT CLASS="FILENAME" >postgresql.conf</TT ><A NAME="AEN16632" ></A >, which is normally kept in the data directory. (<TT CLASS="COMMAND" >initdb</TT > installs a default copy there.) An example of what this file might look like is: </P><PRE CLASS="PROGRAMLISTING" ># This is a comment log_connections = yes log_destination = 'syslog' search_path = '$user, public'</PRE ><P> One parameter is specified per line. The equal sign between name and value is optional. Whitespace is insignificant and blank lines are ignored. Hash marks (<TT CLASS="LITERAL" >#</TT >) introduce comments anywhere. Parameter values that are not simple identifiers or numbers must be single-quoted. </P ><P > <A NAME="AEN16638" ></A > The configuration file is reread whenever the <TT CLASS="COMMAND" >postmaster</TT > process receives a <SPAN CLASS="SYSTEMITEM" >SIGHUP</SPAN > signal (which is most easily sent by means of <TT CLASS="LITERAL" >pg_ctl reload</TT >). The <TT CLASS="COMMAND" >postmaster</TT > also propagates this signal to all currently running server processes so that existing sessions also get the new value. Alternatively, you can send the signal to a single server process directly. Some parameters can only be set at server start; any changes to their entries in the configuration file will be ignored until the server is restarted. </P ><P > A second way to set these configuration parameters is to give them as a command line option to the <TT CLASS="COMMAND" >postmaster</TT >, such as: </P><PRE CLASS="PROGRAMLISTING" >postmaster -c log_connections=yes -c log_destination='syslog'</PRE ><P> Command-line options override any conflicting settings in <TT CLASS="FILENAME" >postgresql.conf</TT >. Note that this means you won't be able to change the value on-the-fly by editing <TT CLASS="FILENAME" >postgresql.conf</TT >, so while the command-line method may be convenient, it can cost you flexibility later. </P ><P > Occasionally it is useful to give a command line option to one particular session only. The environment variable <TT CLASS="ENVAR" >PGOPTIONS</TT > can be used for this purpose on the client side: </P><PRE CLASS="PROGRAMLISTING" >env PGOPTIONS='-c geqo=off' psql</PRE ><P> (This works for any <SPAN CLASS="APPLICATION" >libpq</SPAN >-based client application, not just <SPAN CLASS="APPLICATION" >psql</SPAN >.) Note that this won't work for parameters that are fixed when the server is started or that must be specified in <TT CLASS="FILENAME" >postgresql.conf</TT >. </P ><P > Furthermore, it is possible to assign a set of option settings to a user or a database. Whenever a session is started, the default settings for the user and database involved are loaded. The commands <A HREF="sql-alteruser.html" ><I >ALTER USER</I ></A > and <A HREF="sql-alterdatabase.html" ><I >ALTER DATABASE</I ></A >, respectively, are used to configure these settings. Per-database settings override anything received from the <TT CLASS="COMMAND" >postmaster</TT > command-line or the configuration file, and in turn are overridden by per-user settings; both are overridden by per-session options. </P ><P > Some parameters can be changed in individual <ACRONYM CLASS="ACRONYM" >SQL</ACRONYM > sessions with the <A HREF="sql-set.html" ><I >SET</I ></A > command, for example: </P><PRE CLASS="SCREEN" >SET ENABLE_SEQSCAN TO OFF;</PRE ><P> If <TT CLASS="COMMAND" >SET</TT > is allowed, it overrides all other sources of values for the parameter. Some parameters cannot be changed via <TT CLASS="COMMAND" >SET</TT >: for example, if they control behavior that cannot reasonably be changed without restarting <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. Also, some parameters can be modified via <TT CLASS="COMMAND" >SET</TT > or <TT CLASS="COMMAND" >ALTER</TT > by superusers, but not by ordinary users. </P ><P > The <A HREF="sql-show.html" ><I >SHOW</I ></A > command allows inspection of the current values of all parameters. </P ><P > The virtual table <TT CLASS="STRUCTNAME" >pg_settings</TT > (described in <A HREF="view-pg-settings.html" >Section 41.35</A >) also allows displaying and updating session run-time parameters. It is equivalent to <TT CLASS="COMMAND" >SHOW</TT > and <TT CLASS="COMMAND" >SET</TT >, but can be more convenient to use because it can be joined with other tables, or selected from using any desired selection condition. </P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-FILE-LOCATIONS" >16.4.1. File Locations</A ></H2 ><P > In addition to the <TT CLASS="FILENAME" >postgresql.conf</TT > file already mentioned, <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > uses two other manually-edited configuration files, which control client authentication (their use is discussed in <A HREF="client-authentication.html" >Chapter 19</A >). By default, all three configuration files are stored in the database cluster's data directory. The options described in this subsection allow the configuration files to be placed elsewhere. (Doing so can ease administration. In particular it is often easier to ensure that the configuration files are properly backed-up when they are kept separate.) </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-DATA-DIRECTORY" ></A ><TT CLASS="VARNAME" >data_directory</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the directory to use for data storage. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-CONFIG-FILE" ></A ><TT CLASS="VARNAME" >config_file</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the main server configuration file (customarily called <TT CLASS="FILENAME" >postgresql.conf</TT >). This option can only be set on the postmaster command line. </P ></DD ><DT ><A NAME="GUC-HBA-FILE" ></A ><TT CLASS="VARNAME" >hba_file</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the configuration file for host-based authentication (customarily called <TT CLASS="FILENAME" >pg_hba.conf</TT >). This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-IDENT-FILE" ></A ><TT CLASS="VARNAME" >ident_file</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the configuration file for <SPAN CLASS="APPLICATION" >ident</SPAN > authentication (customarily called <TT CLASS="FILENAME" >pg_ident.conf</TT >). This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-EXTERNAL-PID-FILE" ></A ><TT CLASS="VARNAME" >external_pid_file</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the name of an additional process-id (PID) file that the <SPAN CLASS="APPLICATION" >postmaster</SPAN > should create for use by server administration programs. This option can only be set at server start. </P ></DD ></DL ></DIV ><P > In a default installation, none of the above options are set explicitly. Instead, the data directory is specified by the <TT CLASS="OPTION" >-D</TT > command-line option or the <TT CLASS="ENVAR" >PGDATA</TT > environment variable, and the configuration files are all found within the data directory. </P ><P > If you wish to keep the configuration files elsewhere than the data directory, the postmaster's <TT CLASS="OPTION" >-D</TT > command-line option or <TT CLASS="ENVAR" >PGDATA</TT > environment variable must point to the directory containing the configuration files, and the <TT CLASS="VARNAME" >data_directory</TT > option must be set in <TT CLASS="FILENAME" >postgresql.conf</TT > (or on the command line) to show where the data directory is actually located. Notice that <TT CLASS="VARNAME" >data_directory</TT > overrides <TT CLASS="OPTION" >-D</TT > and <TT CLASS="ENVAR" >PGDATA</TT > for the location of the data directory, but not for the location of the configuration files. </P ><P > If you wish, you can specify the configuration file names and locations individually using the options <TT CLASS="VARNAME" >config_file</TT >, <TT CLASS="VARNAME" >hba_file</TT > and/or <TT CLASS="VARNAME" >ident_file</TT >. <TT CLASS="VARNAME" >config_file</TT > can only be specified on the <TT CLASS="COMMAND" >postmaster</TT > command line, but the others can be set within the main configuration file. If all three options plus <TT CLASS="VARNAME" >data_directory</TT > are explicitly set, then it is not necessary to specify <TT CLASS="OPTION" >-D</TT > or <TT CLASS="ENVAR" >PGDATA</TT >. </P ><P > When setting any of these options, a relative path will be interpreted with respect to the directory in which the <TT CLASS="COMMAND" >postmaster</TT > is started. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-CONNECTION" >16.4.2. Connections and Authentication</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-CONNECTION-SETTINGS" >16.4.2.1. Connection Settings</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-LISTEN-ADDRESSES" ></A ><TT CLASS="VARNAME" >listen_addresses</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications. The value takes the form of a comma-separated list of host names and/or numeric IP addresses. The special entry <TT CLASS="LITERAL" >*</TT > corresponds to all available IP interfaces. If the list is empty, the server does not listen on any IP interface at all, in which case only Unix-domain sockets can be used to connect to it. The default value is <SPAN CLASS="SYSTEMITEM" >localhost</SPAN >, which allows only local <SPAN CLASS="QUOTE" >"loopback"</SPAN > connections to be made. This parameter can only be set at server start. </P ></DD ><DT ><A NAME="GUC-PORT" ></A ><TT CLASS="VARNAME" >port</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The TCP port the server listens on; 5432 by default. Note that the same port number is used for all IP addresses the server listens on. This parameter can only be set at server start. </P ></DD ><DT ><A NAME="GUC-MAX-CONNECTIONS" ></A ><TT CLASS="VARNAME" >max_connections</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Determines the maximum number of concurrent connections to the database server. The default is typically 100, but may be less if your kernel settings will not support it (as determined during <SPAN CLASS="APPLICATION" >initdb</SPAN >). This parameter can only be set at server start. </P ><P > Increasing this parameter may cause <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > to request more <SPAN CLASS="SYSTEMITEM" >System V</SPAN > shared memory or semaphores than your operating system's default configuration allows. See <A HREF="kernel-resources.html#SYSVIPC" >Section 16.5.1</A > for information on how to adjust those parameters, if necessary. </P ></DD ><DT ><A NAME="GUC-SUPERUSER-RESERVED-CONNECTIONS" ></A ><TT CLASS="VARNAME" >superuser_reserved_connections</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Determines the number of connection <SPAN CLASS="QUOTE" >"slots"</SPAN > that are reserved for connections by <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > superusers. At most <A HREF="runtime-config.html#GUC-MAX-CONNECTIONS" >max_connections</A > connections can ever be active simultaneously. Whenever the number of active concurrent connections is at least <TT CLASS="VARNAME" >max_connections</TT > minus <TT CLASS="VARNAME" >superuser_reserved_connections</TT >, new connections will be accepted only for superusers. </P ><P > The default value is 2. The value must be less than the value of <TT CLASS="VARNAME" >max_connections</TT >. This parameter can only be set at server start. </P ></DD ><DT ><A NAME="GUC-UNIX-SOCKET-DIRECTORY" ></A ><TT CLASS="VARNAME" >unix_socket_directory</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the directory of the Unix-domain socket on which the server is to listen for connections from client applications. The default is normally <TT CLASS="FILENAME" >/tmp</TT >, but can be changed at build time. This parameter can only be set at server start. </P ></DD ><DT ><A NAME="GUC-UNIX-SOCKET-GROUP" ></A ><TT CLASS="VARNAME" >unix_socket_group</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the owning group of the Unix-domain socket. (The owning user of the socket is always the user that starts the server.) In combination with the option <TT CLASS="VARNAME" >unix_socket_permissions</TT > this can be used as an additional access control mechanism for Unix-domain connections. By default this is the empty string, which uses the default group for the current user. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-UNIX-SOCKET-PERMISSIONS" ></A ><TT CLASS="VARNAME" >unix_socket_permissions</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the access permissions of the Unix-domain socket. Unix-domain sockets use the usual Unix file system permission set. The option value is expected to be a numeric mode specification in the form accepted by the <CODE CLASS="FUNCTION" >chmod</CODE > and <CODE CLASS="FUNCTION" >umask</CODE > system calls. (To use the customary octal format the number must start with a <TT CLASS="LITERAL" >0</TT > (zero).) </P ><P > The default permissions are <TT CLASS="LITERAL" >0777</TT >, meaning anyone can connect. Reasonable alternatives are <TT CLASS="LITERAL" >0770</TT > (only user and group, see also <TT CLASS="VARNAME" >unix_socket_group</TT >) and <TT CLASS="LITERAL" >0700</TT > (only user). (Note that for a Unix-domain socket, only write permission matters and so there is no point in setting or revoking read or execute permissions.) </P ><P > This access control mechanism is independent of the one described in <A HREF="client-authentication.html" >Chapter 19</A >. </P ><P > This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-RENDEZVOUS-NAME" ></A ><TT CLASS="VARNAME" >rendezvous_name</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Specifies the <SPAN CLASS="PRODUCTNAME" >Rendezvous</SPAN > broadcast name. By default, the computer name is used, specified as an empty string ''. This option is ignored if the server was not compiled with <SPAN CLASS="PRODUCTNAME" >Rendezvous</SPAN > support. This option can only be set at server start. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-CONNECTION-SECURITY" >16.4.2.2. Security and Authentication</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-AUTHENTICATION-TIMEOUT" ></A ><TT CLASS="VARNAME" >authentication_timeout</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Maximum time to complete client authentication, in seconds. If a would-be client has not completed the authentication protocol in this much time, the server breaks the connection. This prevents hung clients from occupying a connection indefinitely. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. The default is 60. </P ></DD ><DT ><A NAME="GUC-SSL" ></A ><TT CLASS="VARNAME" >ssl</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables <ACRONYM CLASS="ACRONYM" >SSL</ACRONYM > connections. Please read <A HREF="ssl-tcp.html" >Section 16.8</A > before using this. The default is off. This parameter can only be set at server start. </P ></DD ><DT ><A NAME="GUC-PASSWORD-ENCRYPTION" ></A ><TT CLASS="VARNAME" >password_encryption</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > When a password is specified in <A HREF="sql-createuser.html" ><I >CREATE USER</I ></A > or <A HREF="sql-alteruser.html" ><I >ALTER USER</I ></A > without writing either <TT CLASS="LITERAL" >ENCRYPTED</TT > or <TT CLASS="LITERAL" >UNENCRYPTED</TT >, this option determines whether the password is to be encrypted. The default is on (encrypt the password). </P ></DD ><DT ><A NAME="GUC-KRB-SERVER-KEYFILE" ></A ><TT CLASS="VARNAME" >krb_server_keyfile</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the location of the Kerberos server key file. See <A HREF="auth-methods.html#KERBEROS-AUTH" >Section 19.2.3</A > for details. </P ></DD ><DT ><A NAME="GUC-DB-USER-NAMESPACE" ></A ><TT CLASS="VARNAME" >db_user_namespace</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This allows per-database user names. It is off by default. </P ><P > If this is on, you should create users as <TT CLASS="LITERAL" >username@dbname</TT >. When <TT CLASS="LITERAL" >username</TT > is passed by a connecting client, <TT CLASS="LITERAL" >@</TT > and the database name is appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing <TT CLASS="LITERAL" >@</TT > within the SQL environment, you will need to quote the user name. </P ><P > With this option enabled, you can still create ordinary global users. Simply append <TT CLASS="LITERAL" >@</TT > when specifying the user name in the client. The <TT CLASS="LITERAL" >@</TT > will be stripped off before the user name is looked up by the server. </P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed. </P ></BLOCKQUOTE ></DIV ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-RESOURCE" >16.4.3. Resource Consumption</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-RESOURCE-MEMORY" >16.4.3.1. Memory</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-SHARED-BUFFERS" ></A ><TT CLASS="VARNAME" >shared_buffers</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the number of shared memory buffers used by the database server. The default is typically 1000, but may be less if your kernel settings will not support it (as determined during <SPAN CLASS="APPLICATION" >initdb</SPAN >). Each buffer is 8192 bytes, unless a different value of <TT CLASS="SYMBOL" >BLCKSZ</TT > was chosen when building the server. This setting must be at least 16, as well as at least twice the value of <A HREF="runtime-config.html#GUC-MAX-CONNECTIONS" >max_connections</A >; however, settings significantly higher than the minimum are usually needed for good performance. Values of a few thousand are recommended for production installations. This option can only be set at server start. </P ><P > Increasing this parameter may cause <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > to request more <SPAN CLASS="SYSTEMITEM" >System V</SPAN > shared memory than your operating system's default configuration allows. See <A HREF="kernel-resources.html#SYSVIPC" >Section 16.5.1</A > for information on how to adjust those parameters, if necessary. </P ></DD ><DT ><A NAME="GUC-WORK-MEM" ></A ><TT CLASS="VARNAME" >work_mem</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Specifies the amount of memory to be used by internal sort operations and hash tables before switching to temporary disk files. The value is specified in kilobytes, and defaults to 1024 kilobytes (1 MB). Note that for a complex query, several sort or hash operations might be running in parallel; each one will be allowed to use as much memory as this value specifies before it starts to put data into temporary files. Also, several running sessions could be doing such operations concurrently. So the total memory used could be many times the value of <TT CLASS="VARNAME" >work_mem</TT >; it is necessary to keep this fact in mind when choosing the value. Sort operations are used for <TT CLASS="LITERAL" >ORDER BY</TT >, <TT CLASS="LITERAL" >DISTINCT</TT >, and merge joins. Hash tables are used in hash joins, hash-based aggregation, and hash-based processing of <TT CLASS="LITERAL" >IN</TT > subqueries. </P ></DD ><DT ><A NAME="GUC-MAINTENANCE-WORK-MEM" ></A ><TT CLASS="VARNAME" >maintenance_work_mem</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Specifies the maximum amount of memory to be used in maintenance operations, such as <TT CLASS="COMMAND" >VACUUM</TT >, <TT CLASS="COMMAND" >CREATE INDEX</TT >, and <TT CLASS="COMMAND" >ALTER TABLE ADD FOREIGN KEY</TT >. The value is specified in kilobytes, and defaults to 16384 kilobytes (16 MB). Since only one of these operations can be executed at a time by a database session, and an installation normally doesn't have very many of them happening concurrently, it's safe to set this value significantly larger than <TT CLASS="VARNAME" >work_mem</TT >. Larger settings may improve performance for vacuuming and for restoring database dumps. </P ></DD ><DT ><A NAME="GUC-MAX-STACK-DEPTH" ></A ><TT CLASS="VARNAME" >max_stack_depth</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Specifies the maximum safe depth of the server's execution stack. The ideal setting for this parameter is the actual stack size limit enforced by the kernel (as set by <TT CLASS="LITERAL" >ulimit -s</TT > or local equivalent), less a safety margin of a megabyte or so. The safety margin is needed because the stack depth is not checked in every routine in the server, but only in key potentially-recursive routines such as expression evaluation. Setting the parameter higher than the actual kernel limit will mean that a runaway recursive function can crash an individual backend process. The default setting is 2048 KB (two megabytes), which is conservatively small and unlikely to risk crashes. However, it may be too small to allow execution of complex functions. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-RESOURCE-FSM" >16.4.3.2. Free Space Map</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-MAX-FSM-PAGES" ></A ><TT CLASS="VARNAME" >max_fsm_pages</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the maximum number of disk pages for which free space will be tracked in the shared free-space map. Six bytes of shared memory are consumed for each page slot. This setting must be more than 16 * <TT CLASS="VARNAME" >max_fsm_relations</TT >. The default is 20000. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-MAX-FSM-RELATIONS" ></A ><TT CLASS="VARNAME" >max_fsm_relations</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the maximum number of relations (tables and indexes) for which free space will be tracked in the shared free-space map. Roughly fifty bytes of shared memory are consumed for each slot. The default is 1000. This option can only be set at server start. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-RESOURCE-KERNEL" >16.4.3.3. Kernel Resource Usage</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-MAX-FILES-PER-PROCESS" ></A ><TT CLASS="VARNAME" >max_files_per_process</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the maximum number of simultaneously open files allowed to each server subprocess. The default is 1000. If the kernel is enforcing a safe per-process limit, you don't need to worry about this setting. But on some platforms (notably, most BSD systems), the kernel will allow individual processes to open many more files than the system can really support when a large number of processes all try to open that many files. If you find yourself seeing <SPAN CLASS="QUOTE" >"Too many open files"</SPAN > failures, try reducing this setting. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-PRELOAD-LIBRARIES" ></A ><TT CLASS="VARNAME" >preload_libraries</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This variable specifies one or more shared libraries that are to be preloaded at server start. A parameterless initialization function can optionally be called for each library. To specify that, add a colon and the name of the initialization function after the library name. For example <TT CLASS="LITERAL" >'$libdir/mylib:mylib_init'</TT > would cause <TT CLASS="LITERAL" >mylib</TT > to be preloaded and <TT CLASS="LITERAL" >mylib_init</TT > to be executed. If more than one library is to be loaded, separate their names with commas. </P ><P > If a specified library or initialization function is not found, the server will fail to start. </P ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > procedural language libraries may be preloaded in this way, typically by using the syntax <TT CLASS="LITERAL" >'$libdir/plXXX:plXXX_init'</TT > where <TT CLASS="LITERAL" >XXX</TT > is <TT CLASS="LITERAL" >pgsql</TT >, <TT CLASS="LITERAL" >perl</TT >, <TT CLASS="LITERAL" >tcl</TT >, or <TT CLASS="LITERAL" >python</TT >. </P ><P > By preloading a shared library (and initializing it if applicable), the library startup time is avoided when the library is first used. However, the time to start each new server process may increase slightly, even if that process never uses the library. So this option is recommended only for libraries that will be used in most sessions. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-RESOURCE-VACUUM-COST" >16.4.3.4. Cost-Based Vacuum Delay</A ></H3 ><P > During the execution of <A HREF="sql-vacuum.html" ><I >VACUUM</I ></A > and <A HREF="sql-analyze.html" ><I >ANALYZE</I ></A > commands, the system maintains an internal counter that keeps track of the estimated cost of the various I/O operations that are performed. When the accumulated cost reaches a limit (specified by <TT CLASS="VARNAME" >vacuum_cost_limit</TT >), the process performing the operation will sleep for a while (specified by <TT CLASS="VARNAME" >vacuum_cost_delay</TT >). Then it will reset the counter and continue execution. </P ><P > The intent of this feature is to allow administrators to reduce the I/O impact of these commands on concurrent database activity. There are many situations in which it is not very important that maintenance commands like <TT CLASS="COMMAND" >VACUUM</TT > and <TT CLASS="COMMAND" >ANALYZE</TT > finish quickly; however, it is usually very important that these commands do not significantly interfere with the ability of the system to perform other database operations. Cost-based vacuum delay provides a way for administrators to achieve this. </P ><P > This feature is disabled by default. To enable it, set the <TT CLASS="VARNAME" >vacuum_cost_delay</TT > variable to a nonzero value. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-VACUUM-COST-DELAY" ></A ><TT CLASS="VARNAME" >vacuum_cost_delay</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The length of time, in milliseconds, that the process will sleep when the cost limit has been exceeded. The default value is 0, which disables the cost-based vacuum delay feature. Positive values enable cost-based vacuuming. Note that on many systems, the effective resolution of sleep delays is 10 milliseconds; setting <TT CLASS="VARNAME" >vacuum_cost_delay</TT > to a value that is not a multiple of 10 may have the same results as setting it to the next higher multiple of 10. </P ></DD ><DT ><A NAME="GUC-VACUUM-COST-PAGE-HIT" ></A ><TT CLASS="VARNAME" >vacuum_cost_page_hit</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The estimated cost for vacuuming a buffer found in the shared buffer cache. It represents the cost to lock the buffer pool, lookup the shared hash table and scan the content of the page. The default value is 1. </P ></DD ><DT ><A NAME="GUC-VACUUM-COST-PAGE-MISS" ></A ><TT CLASS="VARNAME" >vacuum_cost_page_miss</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The estimated cost for vacuuming a buffer that has to be read from disk. This represents the effort to lock the buffer pool, lookup the shared hash table, read the desired block in from the disk and scan its content. The default value is 10. </P ></DD ><DT ><A NAME="GUC-VACUUM-COST-PAGE-DIRTY" ></A ><TT CLASS="VARNAME" >vacuum_cost_page_dirty</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The estimated cost charged when vacuum modifies a block that was previously clean. It represents the extra I/O required to flush the dirty block out to disk again. The default value is 20. </P ></DD ><DT ><A NAME="GUC-VACUUM-COST-LIMIT" ></A ><TT CLASS="VARNAME" >vacuum_cost_limit</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The accumulated cost that will cause the vacuuming process to sleep. The default value is 200. </P ></DD ></DL ></DIV ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > There are certain operations that hold critical locks and should therefore complete as quickly as possible. Cost-based vacuum delays do not occur during such operations. Therefore it is possible that the cost accumulates far higher than the specified limit. To avoid uselessly long delays in such cases, the actual delay is calculated as <TT CLASS="VARNAME" >vacuum_cost_delay</TT > * <TT CLASS="VARNAME" >accumulated_balance</TT > / <TT CLASS="VARNAME" >vacuum_cost_limit</TT > with a maximum of <TT CLASS="VARNAME" >vacuum_cost_delay</TT > * 4. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-RESOURCE-BACKGROUND-WRITER" >16.4.3.5. Background Writer</A ></H3 ><P > Beginning in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 8.0, there is a separate server process called the <I CLASS="FIRSTTERM" >background writer</I >, whose sole function is to issue writes of <SPAN CLASS="QUOTE" >"dirty"</SPAN > shared buffers. The intent is that server processes handling user queries should seldom or never have to wait for a write to occur, because the background writer will do it. This arrangement also reduces the performance penalty associated with checkpoints. The background writer will continuously trickle out dirty pages to disk, so that only a few pages will need to be forced out when checkpoint time arrives, instead of the storm of dirty-buffer writes that formerly occurred at each checkpoint. However there is a net overall increase in I/O load, because where a repeatedly-dirtied page might before have been written only once per checkpoint interval, the background writer might write it several times in the same interval. In most situations a continuous low load is preferable to periodic spikes, but the parameters discussed in this section can be used to tune the behavior for local needs. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-BGWRITER-DELAY" ></A ><TT CLASS="VARNAME" >bgwriter_delay</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Specifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the following parameters). The selected buffers will always be the least recently used ones among the currently dirty buffers. It then sleeps for <TT CLASS="VARNAME" >bgwriter_delay</TT > milliseconds, and repeats. The default value is 200. Note that on many systems, the effective resolution of sleep delays is 10 milliseconds; setting <TT CLASS="VARNAME" >bgwriter_delay</TT > to a value that is not a multiple of 10 may have the same results as setting it to the next higher multiple of 10. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-BGWRITER-PERCENT" ></A ><TT CLASS="VARNAME" >bgwriter_percent</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > In each round, no more than this percentage of the currently dirty buffers will be written (rounding up any fraction to the next whole number of buffers). The default value is 1. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-BGWRITER-MAXPAGES" ></A ><TT CLASS="VARNAME" >bgwriter_maxpages</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > In each round, no more than this many dirty buffers will be written. The default value is 100. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ></DL ></DIV ><P > Smaller values of <TT CLASS="VARNAME" >bgwriter_percent</TT > and <TT CLASS="VARNAME" >bgwriter_maxpages</TT > reduce the extra I/O load caused by the background writer, but leave more work to be done at checkpoint time. To reduce load spikes at checkpoints, increase the values. To disable background writing entirely, set <TT CLASS="VARNAME" >bgwriter_percent</TT > and/or <TT CLASS="VARNAME" >bgwriter_maxpages</TT > to zero. </P ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-WAL" >16.4.4. Write Ahead Log</A ></H2 ><P > See also <A HREF="wal-configuration.html" >Section 25.2</A > for details on WAL tuning. </P ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-WAL-SETTINGS" >16.4.4.1. Settings</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-FSYNC" ></A ><TT CLASS="VARNAME" >fsync</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > If this option is on, the <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > server will use the <CODE CLASS="FUNCTION" >fsync()</CODE > system call in several places to make sure that updates are physically written to disk. This insures that a database cluster will recover to a consistent state after an operating system or hardware crash. </P ><P > However, using <CODE CLASS="FUNCTION" >fsync()</CODE > results in a performance penalty: when a transaction is committed, <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > must wait for the operating system to flush the write-ahead log to disk. When <TT CLASS="VARNAME" >fsync</TT > is disabled, the operating system is allowed to do its best in buffering, ordering, and delaying writes. This can result in significantly improved performance. However, if the system crashes, the results of the last few committed transactions may be lost in part or whole. In the worst case, unrecoverable data corruption may occur. (Crashes of the database server itself are <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >not</I ></SPAN > a risk factor here. Only an operating-system-level crash creates a risk of corruption.) </P ><P > Due to the risks involved, there is no universally correct setting for <TT CLASS="VARNAME" >fsync</TT >. Some administrators always disable <TT CLASS="VARNAME" >fsync</TT >, while others only turn it off for bulk loads, where there is a clear restart point if something goes wrong, whereas some administrators always leave <TT CLASS="VARNAME" >fsync</TT > enabled. The default is to enable <TT CLASS="VARNAME" >fsync</TT >, for maximum reliability. If you trust your operating system, your hardware, and your utility company (or your battery backup), you can consider disabling <TT CLASS="VARNAME" >fsync</TT >. </P ><P > This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-WAL-SYNC-METHOD" ></A ><TT CLASS="VARNAME" >wal_sync_method</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Method used for forcing WAL updates out to disk. Possible values are <TT CLASS="LITERAL" >fsync</TT > (call <CODE CLASS="FUNCTION" >fsync()</CODE > at each commit), <TT CLASS="LITERAL" >fdatasync</TT > (call <CODE CLASS="FUNCTION" >fdatasync()</CODE > at each commit), <TT CLASS="LITERAL" >fsync_writethrough</TT > (call <CODE CLASS="FUNCTION" >_commit()</CODE > at each commit on Windows), <TT CLASS="LITERAL" >open_sync</TT > (write WAL files with <CODE CLASS="FUNCTION" >open()</CODE > option <TT CLASS="SYMBOL" >O_SYNC</TT >), and <TT CLASS="LITERAL" >open_datasync</TT > (write WAL files with <CODE CLASS="FUNCTION" >open()</CODE > option <TT CLASS="SYMBOL" >O_DSYNC</TT >). Not all of these choices are available on all platforms. If <TT CLASS="VARNAME" >fsync</TT > is off then this setting is irrelevant. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-WAL-BUFFERS" ></A ><TT CLASS="VARNAME" >wal_buffers</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Number of disk-page buffers allocated in shared memory for WAL data. The default is 8. The setting need only be large enough to hold the amount of WAL data generated by one typical transaction. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-COMMIT-DELAY" ></A ><TT CLASS="VARNAME" >commit_delay</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Time delay between writing a commit record to the WAL buffer and flushing the buffer out to disk, in microseconds. A nonzero delay can allow multiple transactions to be committed with only one <CODE CLASS="FUNCTION" >fsync()</CODE > system call, if system load is high enough that additional transactions become ready to commit within the given interval. But the delay is just wasted if no other transactions become ready to commit. Therefore, the delay is only performed if at least <TT CLASS="VARNAME" >commit_siblings</TT > other transactions are active at the instant that a server process has written its commit record. The default is zero (no delay). </P ></DD ><DT ><A NAME="GUC-COMMIT-SIBLINGS" ></A ><TT CLASS="VARNAME" >commit_siblings</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Minimum number of concurrent open transactions to require before performing the <TT CLASS="VARNAME" >commit_delay</TT > delay. A larger value makes it more probable that at least one other transaction will become ready to commit during the delay interval. The default is five. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-WAL-CHECKPOINTS" >16.4.4.2. Checkpoints</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-CHECKPOINT-SEGMENTS" ></A ><TT CLASS="VARNAME" >checkpoint_segments</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Maximum distance between automatic WAL checkpoints, in log file segments (each segment is normally 16 megabytes). The default is three. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-CHECKPOINT-TIMEOUT" ></A ><TT CLASS="VARNAME" >checkpoint_timeout</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Maximum time between automatic WAL checkpoints, in seconds. The default is 300 seconds. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ><DT ><A NAME="GUC-CHECKPOINT-WARNING" ></A ><TT CLASS="VARNAME" >checkpoint_warning</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Write a message to the server log if checkpoints caused by the filling of checkpoint segment files happen closer together than this many seconds. The default is 30 seconds. Zero turns off the warning. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-WAL-ARCHIVING" >16.4.4.3. Archiving</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-ARCHIVE-COMMAND" ></A ><TT CLASS="VARNAME" >archive_command</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > The shell command to execute to archive a completed segment of the WAL file series. If this is an empty string (the default), WAL archiving is disabled. Any <TT CLASS="LITERAL" >%p</TT > in the string is replaced by the absolute path of the file to archive, and any <TT CLASS="LITERAL" >%f</TT > is replaced by the file name only. Use <TT CLASS="LITERAL" >%%</TT > to embed an actual <TT CLASS="LITERAL" >%</TT > character in the command. For more information see <A HREF="backup-online.html#BACKUP-ARCHIVING-WAL" >Section 22.3.1</A >. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ><P > It is important for the command to return a zero exit status if and only if it succeeds. Examples: </P><PRE CLASS="PROGRAMLISTING" >archive_command = 'cp "%p" /mnt/server/archivedir/"%f"' archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows</PRE ><P> </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-QUERY" >16.4.5. Query Planning</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-QUERY-ENABLE" >16.4.5.1. Planner Method Configuration</A ></H3 ><P > These configuration parameters provide a crude method of influencing the query plans chosen by the query optimizer. If the default plan chosen by the optimizer for a particular query is not optimal, a temporary solution may be found by using one of these configuration parameters to force the optimizer to choose a different plan. Turning one of these settings off permanently is seldom a good idea, however. Better ways to improve the quality of the plans chosen by the optimizer include adjusting the <A HREF="runtime-config.html#RUNTIME-CONFIG-QUERY-CONSTANTS" ><I >Planner Cost Constants</I ></A >, running <A HREF="sql-analyze.html" ><I >ANALYZE</I ></A > more frequently, increasing the value of the <A HREF="runtime-config.html#GUC-DEFAULT-STATISTICS-TARGET" >default_statistics_target</A > configuration parameter, and increasing the amount of statistics collected for specific columns using <TT CLASS="COMMAND" >ALTER TABLE SET STATISTICS</TT >. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-ENABLE-HASHAGG" ></A ><TT CLASS="VARNAME" >enable_hashagg</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of hashed aggregation plan types. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-HASHJOIN" ></A ><TT CLASS="VARNAME" >enable_hashjoin</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of hash-join plan types. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-INDEXSCAN" ></A ><TT CLASS="VARNAME" >enable_indexscan</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of index-scan plan types. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-MERGEJOIN" ></A ><TT CLASS="VARNAME" >enable_mergejoin</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of merge-join plan types. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-NESTLOOP" ></A ><TT CLASS="VARNAME" >enable_nestloop</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of nested-loop join plans. It's not possible to suppress nested-loop joins entirely, but turning this variable off discourages the planner from using one if there are other methods available. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-SEQSCAN" ></A ><TT CLASS="VARNAME" >enable_seqscan</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of sequential scan plan types. It's not possible to suppress sequential scans entirely, but turning this variable off discourages the planner from using one if there are other methods available. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-SORT" ></A ><TT CLASS="VARNAME" >enable_sort</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of explicit sort steps. It's not possible to suppress explicit sorts entirely, but turning this variable off discourages the planner from using one if there are other methods available. The default is on. </P ></DD ><DT ><A NAME="GUC-ENABLE-TIDSCAN" ></A ><TT CLASS="VARNAME" >enable_tidscan</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables the query planner's use of <ACRONYM CLASS="ACRONYM" >TID</ACRONYM > scan plan types. The default is on. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-QUERY-CONSTANTS" >16.4.5.2. Planner Cost Constants</A ></H3 ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > Unfortunately, there is no well-defined method for determining ideal values for the family of <SPAN CLASS="QUOTE" >"cost"</SPAN > variables that appear below. You are encouraged to experiment and share your findings. </P ></BLOCKQUOTE ></DIV ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-EFFECTIVE-CACHE-SIZE" ></A ><TT CLASS="VARNAME" >effective_cache_size</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Sets the planner's assumption about the effective size of the disk cache that is available to a single index scan. This is factored into estimates of the cost of using an index; a higher value makes it more likely index scans will be used, a lower value makes it more likely sequential scans will be used. When setting this parameter you should consider both <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >'s shared buffers and the portion of the kernel's disk cache that will be used for <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > data files. Also, take into account the expected number of concurrent queries using different indexes, since they will have to share the available space. This parameter has no effect on the size of shared memory allocated by PostgreSQL, nor does it reserve kernel disk cache; it is used only for estimation purposes. The value is measured in disk pages, which are normally 8192 bytes each. The default is 1000. </P ></DD ><DT ><A NAME="GUC-RANDOM-PAGE-COST" ></A ><TT CLASS="VARNAME" >random_page_cost</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Sets the planner's estimate of the cost of a nonsequentially fetched disk page. This is measured as a multiple of the cost of a sequential page fetch. A higher value makes it more likely a sequential scan will be used, a lower value makes it more likely an index scan will be used. The default is four. </P ></DD ><DT ><A NAME="GUC-CPU-TUPLE-COST" ></A ><TT CLASS="VARNAME" >cpu_tuple_cost</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Sets the planner's estimate of the cost of processing each row during a query. This is measured as a fraction of the cost of a sequential page fetch. The default is 0.01. </P ></DD ><DT ><A NAME="GUC-CPU-INDEX-TUPLE-COST" ></A ><TT CLASS="VARNAME" >cpu_index_tuple_cost</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Sets the planner's estimate of the cost of processing each index row during an index scan. This is measured as a fraction of the cost of a sequential page fetch. The default is 0.001. </P ></DD ><DT ><A NAME="GUC-CPU-OPERATOR-COST" ></A ><TT CLASS="VARNAME" >cpu_operator_cost</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Sets the planner's estimate of the cost of processing each operator in a <TT CLASS="LITERAL" >WHERE</TT > clause. This is measured as a fraction of the cost of a sequential page fetch. The default is 0.0025. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-QUERY-GEQO" >16.4.5.3. Genetic Query Optimizer</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-GEQO" ></A ><TT CLASS="VARNAME" >geqo</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables or disables genetic query optimization, which is an algorithm that attempts to do query planning without exhaustive searching. This is on by default. The <TT CLASS="VARNAME" >geqo_threshold</TT > variable provides a more granular way to disable GEQO for certain classes of queries. </P ></DD ><DT ><A NAME="GUC-GEQO-THRESHOLD" ></A ><TT CLASS="VARNAME" >geqo_threshold</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Use genetic query optimization to plan queries with at least this many <TT CLASS="LITERAL" >FROM</TT > items involved. (Note that an outer <TT CLASS="LITERAL" >JOIN</TT > construct counts as only one <TT CLASS="LITERAL" >FROM</TT > item.) The default is 12. For simpler queries it is usually best to use the deterministic, exhaustive planner, but for queries with many tables the deterministic planner takes too long. </P ></DD ><DT ><A NAME="GUC-GEQO-EFFORT" ></A ><TT CLASS="VARNAME" >geqo_effort</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Controls the trade off between planning time and query plan efficiency in GEQO. This variable must be an integer in the range from 1 to 10. The default value is 5. Larger values increase the time spent doing query planning, but also increase the likelihood that an efficient query plan will be chosen. </P ><P > <TT CLASS="VARNAME" >geqo_effort</TT > doesn't actually do anything directly; it is only used to compute the default values for the other variables that influence GEQO behavior (described below). If you prefer, you can set the other parameters by hand instead. </P ></DD ><DT ><A NAME="GUC-GEQO-POOL-SIZE" ></A ><TT CLASS="VARNAME" >geqo_pool_size</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Controls the pool size used by GEQO. The pool size is the number of individuals in the genetic population. It must be at least two, and useful values are typically 100 to 1000. If it is set to zero (the default setting) then a suitable default is chosen based on <TT CLASS="VARNAME" >geqo_effort</TT > and the number of tables in the query. </P ></DD ><DT ><A NAME="GUC-GEQO-GENERATIONS" ></A ><TT CLASS="VARNAME" >geqo_generations</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Controls the number of generations used by GEQO. Generations specifies the number of iterations of the algorithm. It must be at least one, and useful values are in the same range as the pool size. If it is set to zero (the default setting) then a suitable default is chosen based on <TT CLASS="VARNAME" >geqo_pool_size</TT >. </P ></DD ><DT ><A NAME="GUC-GEQO-SELECTION-BIAS" ></A ><TT CLASS="VARNAME" >geqo_selection_bias</TT > (<TT CLASS="TYPE" >floating point</TT >)</DT ><DD ><P > Controls the selection bias used by GEQO. The selection bias is the selective pressure within the population. Values can be from 1.50 to 2.00; the latter is the default. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-QUERY-OTHER" >16.4.5.4. Other Planner Options</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-DEFAULT-STATISTICS-TARGET" ></A ><TT CLASS="VARNAME" >default_statistics_target</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets the default statistics target for table columns that have not had a column-specific target set via <TT CLASS="COMMAND" >ALTER TABLE SET STATISTICS</TT >. Larger values increase the time needed to do <TT CLASS="COMMAND" >ANALYZE</TT >, but may improve the quality of the planner's estimates. The default is 10. For more information on the use of statistics by the <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > query planner, refer to <A HREF="planner-stats.html" >Section 13.2</A >. </P ></DD ><DT ><A NAME="GUC-FROM-COLLAPSE-LIMIT" ></A ><TT CLASS="VARNAME" >from_collapse_limit</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The planner will merge sub-queries into upper queries if the resulting <TT CLASS="LITERAL" >FROM</TT > list would have no more than this many items. Smaller values reduce planning time but may yield inferior query plans. The default is 8. It is usually wise to keep this less than <A HREF="runtime-config.html#GUC-GEQO-THRESHOLD" >geqo_threshold</A >. </P ></DD ><DT ><A NAME="GUC-JOIN-COLLAPSE-LIMIT" ></A ><TT CLASS="VARNAME" >join_collapse_limit</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The planner will rewrite explicit inner <TT CLASS="LITERAL" >JOIN</TT > constructs into lists of <TT CLASS="LITERAL" >FROM</TT > items whenever a list of no more than this many items in total would result. Prior to <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 7.4, joins specified via the <TT CLASS="LITERAL" >JOIN</TT > construct would never be reordered by the query planner. The query planner has subsequently been improved so that inner joins written in this form can be reordered; this configuration parameter controls the extent to which this reordering is performed. </P><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > At present, the order of outer joins specified via the <TT CLASS="LITERAL" >JOIN</TT > construct is never adjusted by the query planner; therefore, <TT CLASS="VARNAME" >join_collapse_limit</TT > has no effect on this behavior. The planner may be improved to reorder some classes of outer joins in a future release of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. </P ></BLOCKQUOTE ></DIV ><P> </P ><P > By default, this variable is set the same as <TT CLASS="VARNAME" >from_collapse_limit</TT >, which is appropriate for most uses. Setting it to 1 prevents any reordering of inner <TT CLASS="LITERAL" >JOIN</TT >s. Thus, the explicit join order specified in the query will be the actual order in which the relations are joined. The query planner does not always choose the optimal join order; advanced users may elect to temporarily set this variable to 1, and then specify the join order they desire explicitly. Another consequence of setting this variable to 1 is that the query planner will behave more like the <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 7.3 query planner, which some users might find useful for backward compatibility reasons. </P ><P > Setting this variable to a value between 1 and <TT CLASS="VARNAME" >from_collapse_limit</TT > might be useful to trade off planning time against the quality of the chosen plan (higher values produce better plans). </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-LOGGING" >16.4.6. Error Reporting and Logging</A ></H2 ><A NAME="AEN17556" ></A ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-LOGGING-WHERE" >16.4.6.1. Where to log</A ></H3 ><A NAME="AEN17560" ></A ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-LOG-DESTINATION" ></A ><TT CLASS="VARNAME" >log_destination</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > supports several methods for logging server messages, including <SPAN CLASS="SYSTEMITEM" >stderr</SPAN > and <SPAN CLASS="SYSTEMITEM" >syslog</SPAN >. On Windows, <SPAN CLASS="SYSTEMITEM" >eventlog</SPAN > is also supported. Set this option to a list of desired log destinations separated by commas. The default is to log to <SPAN CLASS="SYSTEMITEM" >stderr</SPAN > only. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-REDIRECT-STDERR" ></A ><TT CLASS="VARNAME" >redirect_stderr</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This option allows messages sent to <SPAN CLASS="APPLICATION" >stderr</SPAN > to be captured and redirected into log files. This option, in combination with logging to <SPAN CLASS="APPLICATION" >stderr</SPAN >, is often more useful than logging to <SPAN CLASS="APPLICATION" >syslog</SPAN >, since some types of messages may not appear in <SPAN CLASS="APPLICATION" >syslog</SPAN > output (a common example is dynamic-linker failure messages). This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-LOG-DIRECTORY" ></A ><TT CLASS="VARNAME" >log_directory</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > When <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, this option determines the directory in which log files will be created. It may be specified as an absolute path, or relative to the cluster data directory. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-FILENAME" ></A ><TT CLASS="VARNAME" >log_filename</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > When <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, this option sets the file names of the created log files. The value is treated as a <SPAN CLASS="SYSTEMITEM" >strftime</SPAN > pattern, so <TT CLASS="LITERAL" >%</TT >-escapes can be used to specify time-varying file names. If no <TT CLASS="LITERAL" >%</TT >-escapes are present, <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > will append the epoch of the new log file's open time. For example, if <TT CLASS="VARNAME" >log_filename</TT > were <TT CLASS="LITERAL" >server_log</TT >, then the chosen file name would be <TT CLASS="LITERAL" >server_log.1093827753</TT > for a log starting at Sun Aug 29 19:02:33 2004 MST. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-ROTATION-AGE" ></A ><TT CLASS="VARNAME" >log_rotation_age</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > When <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, this option determines the maximum lifetime of an individual log file. After this many minutes have elapsed, a new log file will be created. Set to zero to disable time-based creation of new log files. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-ROTATION-SIZE" ></A ><TT CLASS="VARNAME" >log_rotation_size</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > When <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, this option determines the maximum size of an individual log file. After this many kilobytes have been emitted into a log file, a new log file will be created. Set to zero to disable size-based creation of new log files. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-TRUNCATE-ON-ROTATION" ></A ><TT CLASS="VARNAME" >log_truncate_on_rotation</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > When <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, this option will cause <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > to truncate (overwrite), rather than append to, any existing log file of the same name. However, truncation will occur only when a new file is being opened due to time-based rotation, not during server startup or size-based rotation. When false, pre-existing files will be appended to in all cases. For example, using this option in combination with a <TT CLASS="VARNAME" >log_filename</TT > like <TT CLASS="LITERAL" >postgresql-%H.log</TT > would result in generating twenty-four hourly log files and then cyclically overwriting them. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ><P > Example: To keep 7 days of logs, one log file per day named <TT CLASS="LITERAL" >server_log.Mon</TT >, <TT CLASS="LITERAL" >server_log.Tue</TT >, etc, and automatically overwrite last week's log with this week's log, set <TT CLASS="VARNAME" >log_filename</TT > to <TT CLASS="LITERAL" >server_log.%a</TT >, <TT CLASS="VARNAME" >log_truncate_on_rotation</TT > to <TT CLASS="LITERAL" >true</TT >, and <TT CLASS="VARNAME" >log_rotation_age</TT > to <TT CLASS="LITERAL" >1440</TT >. </P ><P > Example: To keep 24 hours of logs, one log file per hour, but also rotate sooner if the log file size exceeds 1GB, set <TT CLASS="VARNAME" >log_filename</TT > to <TT CLASS="LITERAL" >server_log.%H%M</TT >, <TT CLASS="VARNAME" >log_truncate_on_rotation</TT > to <TT CLASS="LITERAL" >true</TT >, <TT CLASS="VARNAME" >log_rotation_age</TT > to <TT CLASS="LITERAL" >60</TT >, and <TT CLASS="VARNAME" >log_rotation_size</TT > to <TT CLASS="LITERAL" >1000000</TT >. Including <TT CLASS="LITERAL" >%M</TT > in <TT CLASS="VARNAME" >log_filename</TT > allows any size-driven rotations that may occur to select a filename different from the hour's initial filename. </P ></DD ><DT ><A NAME="GUC-SYSLOG-FACILITY" ></A ><TT CLASS="VARNAME" >syslog_facility</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > When logging to <SPAN CLASS="APPLICATION" >syslog</SPAN > is enabled, this option determines the <SPAN CLASS="APPLICATION" >syslog</SPAN > <SPAN CLASS="QUOTE" >"facility"</SPAN > to be used. You may choose from <TT CLASS="LITERAL" >LOCAL0</TT >, <TT CLASS="LITERAL" >LOCAL1</TT >, <TT CLASS="LITERAL" >LOCAL2</TT >, <TT CLASS="LITERAL" >LOCAL3</TT >, <TT CLASS="LITERAL" >LOCAL4</TT >, <TT CLASS="LITERAL" >LOCAL5</TT >, <TT CLASS="LITERAL" >LOCAL6</TT >, <TT CLASS="LITERAL" >LOCAL7</TT >; the default is <TT CLASS="LITERAL" >LOCAL0</TT >. See also the documentation of your system's <SPAN CLASS="APPLICATION" >syslog</SPAN > daemon. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-SYSLOG-IDENT" ></A ><TT CLASS="VARNAME" >syslog_ident</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > When logging to <SPAN CLASS="APPLICATION" >syslog</SPAN > is enabled, this option determines the program name used to identify <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > messages in <SPAN CLASS="APPLICATION" >syslog</SPAN > logs. The default is <TT CLASS="LITERAL" >postgres</TT >. This option can only be set at server start. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-LOGGING-WHEN" >16.4.6.2. When To Log</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-CLIENT-MIN-MESSAGES" ></A ><TT CLASS="VARNAME" >client_min_messages</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Controls which message levels are sent to the client. Valid values are <TT CLASS="LITERAL" >DEBUG5</TT >, <TT CLASS="LITERAL" >DEBUG4</TT >, <TT CLASS="LITERAL" >DEBUG3</TT >, <TT CLASS="LITERAL" >DEBUG2</TT >, <TT CLASS="LITERAL" >DEBUG1</TT >, <TT CLASS="LITERAL" >LOG</TT >, <TT CLASS="LITERAL" >NOTICE</TT >, <TT CLASS="LITERAL" >WARNING</TT >, and <TT CLASS="LITERAL" >ERROR</TT >. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. The default is <TT CLASS="LITERAL" >NOTICE</TT >. Note that <TT CLASS="LITERAL" >LOG</TT > has a different rank here than in <TT CLASS="VARNAME" >log_min_messages</TT >. </P ></DD ><DT ><A NAME="GUC-LOG-MIN-MESSAGES" ></A ><TT CLASS="VARNAME" >log_min_messages</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Controls which message levels are written to the server log. Valid values are <TT CLASS="LITERAL" >DEBUG5</TT >, <TT CLASS="LITERAL" >DEBUG4</TT >, <TT CLASS="LITERAL" >DEBUG3</TT >, <TT CLASS="LITERAL" >DEBUG2</TT >, <TT CLASS="LITERAL" >DEBUG1</TT >, <TT CLASS="LITERAL" >INFO</TT >, <TT CLASS="LITERAL" >NOTICE</TT >, <TT CLASS="LITERAL" >WARNING</TT >, <TT CLASS="LITERAL" >ERROR</TT >, <TT CLASS="LITERAL" >LOG</TT >, <TT CLASS="LITERAL" >FATAL</TT >, and <TT CLASS="LITERAL" >PANIC</TT >. Each level includes all the levels that follow it. The later the level, the fewer messages are sent to the log. The default is <TT CLASS="LITERAL" >NOTICE</TT >. Note that <TT CLASS="LITERAL" >LOG</TT > has a different rank here than in <TT CLASS="VARNAME" >client_min_messages</TT >. Only superusers can change this setting. </P ></DD ><DT ><A NAME="GUC-LOG-ERROR-VERBOSITY" ></A ><TT CLASS="VARNAME" >log_error_verbosity</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Controls the amount of detail written in the server log for each message that is logged. Valid values are <TT CLASS="LITERAL" >TERSE</TT >, <TT CLASS="LITERAL" >DEFAULT</TT >, and <TT CLASS="LITERAL" >VERBOSE</TT >, each adding more fields to displayed messages. Only superusers can change this setting. </P ></DD ><DT ><A NAME="GUC-LOG-MIN-ERROR-STATEMENT" ></A ><TT CLASS="VARNAME" >log_min_error_statement</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Controls whether or not the SQL statement that causes an error condition will also be recorded in the server log. All SQL statements that cause an error of the specified level or higher are logged. The default is <TT CLASS="LITERAL" >PANIC</TT > (effectively turning this feature off for normal use). Valid values are <TT CLASS="LITERAL" >DEBUG5</TT >, <TT CLASS="LITERAL" >DEBUG4</TT >, <TT CLASS="LITERAL" >DEBUG3</TT >, <TT CLASS="LITERAL" >DEBUG2</TT >, <TT CLASS="LITERAL" >DEBUG1</TT >, <TT CLASS="LITERAL" >INFO</TT >, <TT CLASS="LITERAL" >NOTICE</TT >, <TT CLASS="LITERAL" >WARNING</TT >, <TT CLASS="LITERAL" >ERROR</TT >, <TT CLASS="LITERAL" >FATAL</TT >, and <TT CLASS="LITERAL" >PANIC</TT >. For example, if you set this to <TT CLASS="LITERAL" >ERROR</TT > then all SQL statements causing errors, fatal errors, or panics will be logged. Enabling this option can be helpful in tracking down the source of any errors that appear in the server log. Only superusers can change this setting. </P ></DD ><DT ><A NAME="GUC-LOG-MIN-DURATION-STATEMENT" ></A ><TT CLASS="VARNAME" >log_min_duration_statement</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Sets a minimum statement execution time (in milliseconds) that causes a statement to be logged. All SQL statements that run for the time specified or longer will be logged with their duration. Setting this to zero will print all queries and their durations. Minus-one (the default) disables the feature. For example, if you set it to <TT CLASS="LITERAL" >250</TT > then all SQL statements that run 250ms or longer will be logged. Enabling this option can be useful in tracking down unoptimized queries in your applications. Only superusers can change this setting. </P ></DD ><DT ><A NAME="GUC-SILENT-MODE" ></A ><TT CLASS="VARNAME" >silent_mode</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Runs the server silently. If this option is set, the server will automatically run in background and any controlling terminals are disassociated (same effect as <TT CLASS="COMMAND" >postmaster</TT >'s <TT CLASS="OPTION" >-S</TT > option). The server's standard output and standard error are redirected to <TT CLASS="LITERAL" >/dev/null</TT >, so any messages sent to them will be lost. Unless <SPAN CLASS="APPLICATION" >syslog</SPAN > logging is selected or <TT CLASS="VARNAME" >redirect_stderr</TT > is enabled, using this option is discouraged because it makes it impossible to see error messages. </P ></DD ></DL ></DIV ><P > Here is a list of the various message severity levels used in these settings: <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >DEBUG[1-5]</TT ></DT ><DD ><P > Provides information for use by developers. </P ></DD ><DT ><TT CLASS="LITERAL" >INFO</TT ></DT ><DD ><P > Provides information implicitly requested by the user, e.g., during <TT CLASS="COMMAND" >VACUUM VERBOSE</TT >. </P ></DD ><DT ><TT CLASS="LITERAL" >NOTICE</TT ></DT ><DD ><P > Provides information that may be helpful to users, e.g., truncation of long identifiers and the creation of indexes as part of primary keys. </P ></DD ><DT ><TT CLASS="LITERAL" >WARNING</TT ></DT ><DD ><P > Provides warnings to the user, e.g., <TT CLASS="COMMAND" >COMMIT</TT > outside a transaction block. </P ></DD ><DT ><TT CLASS="LITERAL" >ERROR</TT ></DT ><DD ><P > Reports an error that caused the current command to abort. </P ></DD ><DT ><TT CLASS="LITERAL" >LOG</TT ></DT ><DD ><P > Reports information of interest to administrators, e.g., checkpoint activity. </P ></DD ><DT ><TT CLASS="LITERAL" >FATAL</TT ></DT ><DD ><P > Reports an error that caused the current session to abort. </P ></DD ><DT ><TT CLASS="LITERAL" >PANIC</TT ></DT ><DD ><P > Reports an error that caused all sessions to abort. </P ></DD ></DL ></DIV ><P> </P ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-LOGGING-WHAT" >16.4.6.3. What To Log</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="VARNAME" >debug_print_parse</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >debug_print_rewritten</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >debug_print_plan</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >debug_pretty_print</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > These options enable various debugging output to be emitted. For each executed query, they print the resulting parse tree, the query rewriter output, or the execution plan. <TT CLASS="VARNAME" >debug_pretty_print</TT > indents these displays to produce a more readable but much longer output format. <TT CLASS="VARNAME" >client_min_messages</TT > or <TT CLASS="VARNAME" >log_min_messages</TT > must be <TT CLASS="LITERAL" >DEBUG1</TT > or lower to actually send this output to the client or the server log, respectively. These options are off by default. </P ></DD ><DT ><A NAME="GUC-LOG-CONNECTIONS" ></A ><TT CLASS="VARNAME" >log_connections</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This outputs a line to the server log detailing each successful connection. This is off by default, although it is probably very useful. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-DISCONNECTIONS" ></A ><TT CLASS="VARNAME" >log_disconnections</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This outputs a line in the server log similar to <TT CLASS="VARNAME" >log_connections</TT > but at session termination, and includes the duration of the session. This is off by default. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ><DT ><A NAME="GUC-LOG-DURATION" ></A ><TT CLASS="VARNAME" >log_duration</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Causes the duration of every completed statement which satisfies <TT CLASS="VARNAME" >log_statement</TT > to be logged. When using this option, if you are not using <SPAN CLASS="APPLICATION" >syslog</SPAN >, it is recommended that you log the PID or session ID using <TT CLASS="VARNAME" >log_line_prefix</TT > so that you can link the statement to the duration using the process ID or session ID. The default is off. Only superusers can change this setting. </P ></DD ><DT ><A NAME="GUC-LOG-LINE-PREFIX" ></A ><TT CLASS="VARNAME" >log_line_prefix</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This is a <CODE CLASS="FUNCTION" >printf</CODE >-style string that is output at the beginning of each log line. The default is an empty string. Each recognized escape is replaced as outlined below - anything else that looks like an escape is ignored. Other characters are copied straight to the log line. Some escapes are only recognised by session processes, and do not apply to background processes such as the postmaster. <SPAN CLASS="APPLICATION" >Syslog</SPAN > produces its own time stamp and process ID information, so you probably do not want to use those escapes if you are using <SPAN CLASS="APPLICATION" >syslog</SPAN >. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. <DIV CLASS="INFORMALTABLE" ><P ></P ><A NAME="AEN17941" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Escape</TH ><TH >Effect</TH ><TH >Session only</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="LITERAL" >%u</TT ></TD ><TD >User name</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%d</TT ></TD ><TD >Database name</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%r</TT ></TD ><TD >Remote host name or IP address, and remote port</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%p</TT ></TD ><TD >Process ID</TD ><TD >no</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%t</TT ></TD ><TD >Time stamp</TD ><TD >no</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%i</TT ></TD ><TD >Command tag: This is the command that generated the log line.</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%c</TT ></TD ><TD >Session ID: A unique identifier for each session. It is 2 4-byte hexadecimal numbers (without leading zeros) separated by a dot. The numbers are the session start time and the process ID, so this can also be used as a space saving way of printing these items.</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%l</TT ></TD ><TD >Number of the log line for each process, starting at 1</TD ><TD >no</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%s</TT ></TD ><TD >Session start time stamp</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%x</TT ></TD ><TD >Transaction ID</TD ><TD >yes</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%q</TT ></TD ><TD >Does not produce any output, but tells non-session processes to stop at this point in the string. Ignored by session processes.</TD ><TD >no</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >%%</TT ></TD ><TD >Literal <TT CLASS="LITERAL" >%</TT ></TD ><TD >no</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DD ><DT ><A NAME="GUC-LOG-STATEMENT" ></A ><TT CLASS="VARNAME" >log_statement</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Controls which SQL statements are logged. Valid values are <TT CLASS="LITERAL" >none</TT >, <TT CLASS="LITERAL" >ddl</TT >, <TT CLASS="LITERAL" >mod</TT >, and <TT CLASS="LITERAL" >all</TT >. <TT CLASS="LITERAL" >ddl</TT > logs all data definition commands like <TT CLASS="LITERAL" >CREATE</TT >, <TT CLASS="LITERAL" >ALTER</TT >, and <TT CLASS="LITERAL" >DROP</TT > commands. <TT CLASS="LITERAL" >mod</TT > logs all <TT CLASS="LITERAL" >ddl</TT > statements, plus <TT CLASS="LITERAL" >INSERT</TT >, <TT CLASS="LITERAL" >UPDATE</TT >, <TT CLASS="LITERAL" >DELETE</TT >, <TT CLASS="LITERAL" >TRUNCATE</TT >, and <TT CLASS="LITERAL" >COPY FROM</TT >. <TT CLASS="LITERAL" >PREPARE</TT > and <TT CLASS="LITERAL" >EXPLAIN ANALYZE</TT > statements are also logged if their contained command is of an appropriate type. </P ><P > The default is <TT CLASS="LITERAL" >none</TT >. Only superusers can change this setting. </P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > The <TT CLASS="COMMAND" >EXECUTE</TT > statement is not considered a <TT CLASS="LITERAL" >ddl</TT > or <TT CLASS="LITERAL" >mod</TT > statement. When it is logged, only the name of the prepared statement is reported, not the actual prepared statement. </P ><P > When a function is defined in the <SPAN CLASS="APPLICATION" >PL/pgSQL</SPAN >server-side language, any queries executed by the function will only be logged the first time that the function is invoked in a particular session. This is because <SPAN CLASS="APPLICATION" >PL/pgSQL</SPAN > keeps a cache of the query plans produced for the SQL statements in the function. </P ></BLOCKQUOTE ></DIV ></DD ><DT ><A NAME="GUC-LOG-HOSTNAME" ></A ><TT CLASS="VARNAME" >log_hostname</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > By default, connection log messages only show the IP address of the connecting host. Turning on this option causes logging of the host name as well. Note that depending on your host name resolution setup this might impose a non-negligible performance penalty. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > file. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-STATISTICS" >16.4.7. Runtime Statistics</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-STATISTICS-MONITOR" >16.4.7.1. Statistics Monitoring</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="VARNAME" >log_statement_stats</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >log_parser_stats</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >log_planner_stats</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >log_executor_stats</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > For each query, write performance statistics of the respective module to the server log. This is a crude profiling instrument. <TT CLASS="VARNAME" >log_statement_stats</TT > reports total statement statistics, while the others report per-module statistics. <TT CLASS="VARNAME" >log_statement_stats</TT > cannot be enabled together with any of the per-module options. All of these options are disabled by default. Only superusers can change these settings. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-STATISTICS-COLLECTOR" >16.4.7.2. Query and Index Statistics Collector</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-STATS-START-COLLECTOR" ></A ><TT CLASS="VARNAME" >stats_start_collector</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Controls whether the server should start the statistics-collection subprocess. This is on by default, but may be turned off if you know you have no interest in collecting statistics. This option can only be set at server start. </P ></DD ><DT ><A NAME="GUC-STATS-COMMAND-STRING" ></A ><TT CLASS="VARNAME" >stats_command_string</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables the collection of statistics on the currently executing command of each session, along with the time at which that command began execution. This option is off by default. Note that even when enabled, this information is not visible to all users, only to superusers and the user owning the session being reported on; so it should not represent a security risk. This data can be accessed via the <TT CLASS="STRUCTNAME" >pg_stat_activity</TT > system view; refer to <A HREF="monitoring.html" >Chapter 23</A > for more information. </P ></DD ><DT ><A NAME="GUC-STATS-BLOCK-LEVEL" ></A ><TT CLASS="VARNAME" >stats_block_level</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables the collection of block-level statistics on database activity. This option is disabled by default. If this option is enabled, the data that is produced can be accessed via the <TT CLASS="STRUCTNAME" >pg_stat</TT > and <TT CLASS="STRUCTNAME" >pg_statio</TT > family of system views; refer to <A HREF="monitoring.html" >Chapter 23</A > for more information. </P ></DD ><DT ><A NAME="GUC-STATS-ROW-LEVEL" ></A ><TT CLASS="VARNAME" >stats_row_level</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Enables the collection of row-level statistics on database activity. This option is disabled by default. If this option is enabled, the data that is produced can be accessed via the <TT CLASS="STRUCTNAME" >pg_stat</TT > and <TT CLASS="STRUCTNAME" >pg_statio</TT > family of system views; refer to <A HREF="monitoring.html" >Chapter 23</A > for more information. </P ></DD ><DT ><A NAME="GUC-STATS-RESET-ON-SERVER-START" ></A ><TT CLASS="VARNAME" >stats_reset_on_server_start</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > If on, collected statistics are zeroed out whenever the server is restarted. If off, statistics are accumulated across server restarts. The default is on. This option can only be set at server start. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-CLIENT" >16.4.8. Client Connection Defaults</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-CLIENT-STATEMENT" >16.4.8.1. Statement Behavior</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-SEARCH-PATH" ></A ><TT CLASS="VARNAME" >search_path</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This variable specifies the order in which schemas are searched when an object (table, data type, function, etc.) is referenced by a simple name with no schema component. When there are objects of identical names in different schemas, the one found first in the search path is used. An object that is not in any of the schemas in the search path can only be referenced by specifying its containing schema with a qualified (dotted) name. </P ><P > The value for <TT CLASS="VARNAME" >search_path</TT > has to be a comma-separated list of schema names. If one of the list items is the special value <TT CLASS="LITERAL" >$user</TT >, then the schema having the name returned by <CODE CLASS="FUNCTION" >SESSION_USER</CODE > is substituted, if there is such a schema. (If not, <TT CLASS="LITERAL" >$user</TT > is ignored.) </P ><P > The system catalog schema, <TT CLASS="LITERAL" >pg_catalog</TT >, is always searched, whether it is mentioned in the path or not. If it is mentioned in the path then it will be searched in the specified order. If <TT CLASS="LITERAL" >pg_catalog</TT > is not in the path then it will be searched <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >before</I ></SPAN > searching any of the path items. It should also be noted that the temporary-table schema, <TT CLASS="LITERAL" >pg_temp_<TT CLASS="REPLACEABLE" ><I >nnn</I ></TT ></TT >, is implicitly searched before any of these. </P ><P > When objects are created without specifying a particular target schema, they will be placed in the first schema listed in the search path. An error is reported if the search path is empty. </P ><P > The default value for this parameter is <TT CLASS="LITERAL" >'$user, public'</TT > (where the second part will be ignored if there is no schema named <TT CLASS="LITERAL" >public</TT >). This supports shared use of a database (where no users have private schemas, and all share use of <TT CLASS="LITERAL" >public</TT >), private per-user schemas, and combinations of these. Other effects can be obtained by altering the default search path setting, either globally or per-user. </P ><P > The current effective value of the search path can be examined via the <ACRONYM CLASS="ACRONYM" >SQL</ACRONYM > function <CODE CLASS="FUNCTION" >current_schemas()</CODE >. This is not quite the same as examining the value of <TT CLASS="VARNAME" >search_path</TT >, since <CODE CLASS="FUNCTION" >current_schemas()</CODE > shows how the requests appearing in <TT CLASS="VARNAME" >search_path</TT > were resolved. </P ><P > For more information on schema handling, see <A HREF="ddl-schemas.html" >Section 5.8</A >. </P ></DD ><DT ><A NAME="GUC-DEFAULT-TABLESPACE" ></A ><TT CLASS="VARNAME" >default_tablespace</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This variable specifies the default tablespace in which to create objects (tables and indexes) when a <TT CLASS="COMMAND" >CREATE</TT > command does not explicitly specify a tablespace. </P ><P > The value is either the name of a tablespace, or an empty string to specify using the default tablespace of the current database. If the value does not match the name of any existing tablespace, <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > will automatically use the default tablespace of the current database. </P ><P > For more information on tablespaces, see <A HREF="manage-ag-tablespaces.html" >Section 18.6</A >. </P ></DD ><DT ><A NAME="GUC-CHECK-FUNCTION-BODIES" ></A ><TT CLASS="VARNAME" >check_function_bodies</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This parameter is normally true. When set to false, it disables validation of the function body string during <A HREF="sql-createfunction.html" ><I >CREATE FUNCTION</I ></A >. Disabling validation is occasionally useful to avoid problems such as forward references when restoring function definitions from a dump. </P ></DD ><DT ><A NAME="GUC-DEFAULT-TRANSACTION-ISOLATION" ></A ><TT CLASS="VARNAME" >default_transaction_isolation</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Each SQL transaction has an isolation level, which can be either <SPAN CLASS="QUOTE" >"read uncommitted"</SPAN >, <SPAN CLASS="QUOTE" >"read committed"</SPAN >, <SPAN CLASS="QUOTE" >"repeatable read"</SPAN >, or <SPAN CLASS="QUOTE" >"serializable"</SPAN >. This parameter controls the default isolation level of each new transaction. The default is <SPAN CLASS="QUOTE" >"read committed"</SPAN >. </P ><P > Consult <A HREF="mvcc.html" >Chapter 12</A > and <A HREF="sql-set-transaction.html" >SET TRANSACTION</A > for more information. </P ></DD ><DT ><A NAME="GUC-DEFAULT-TRANSACTION-READ-ONLY" ></A ><TT CLASS="VARNAME" >default_transaction_read_only</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > A read-only SQL transaction cannot alter non-temporary tables. This parameter controls the default read-only status of each new transaction. The default is false (read/write). </P ><P > Consult <A HREF="sql-set-transaction.html" >SET TRANSACTION</A > for more information. </P ></DD ><DT ><A NAME="GUC-STATEMENT-TIMEOUT" ></A ><TT CLASS="VARNAME" >statement_timeout</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Abort any statement that takes over the specified number of milliseconds. A value of zero (the default) turns off the limitation. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-CLIENT-FORMAT" >16.4.8.2. Locale and Formatting</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-DATESTYLE" ></A ><TT CLASS="VARNAME" >DateStyle</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the display format for date and time values, as well as the rules for interpreting ambiguous date input values. For historical reasons, this variable contains two independent components: the output format specification (<TT CLASS="LITERAL" >ISO</TT >, <TT CLASS="LITERAL" >Postgres</TT >, <TT CLASS="LITERAL" >SQL</TT >, or <TT CLASS="LITERAL" >German</TT >) and the input/output specification for year/month/day ordering (<TT CLASS="LITERAL" >DMY</TT >, <TT CLASS="LITERAL" >MDY</TT >, or <TT CLASS="LITERAL" >YMD</TT >). These can be set separately or together. The keywords <TT CLASS="LITERAL" >Euro</TT > and <TT CLASS="LITERAL" >European</TT > are synonyms for <TT CLASS="LITERAL" >DMY</TT >; the keywords <TT CLASS="LITERAL" >US</TT >, <TT CLASS="LITERAL" >NonEuro</TT >, and <TT CLASS="LITERAL" >NonEuropean</TT > are synonyms for <TT CLASS="LITERAL" >MDY</TT >. See <A HREF="datatype-datetime.html" >Section 8.5</A > for more information. The default is <TT CLASS="LITERAL" >ISO, MDY</TT >. </P ></DD ><DT ><A NAME="GUC-TIMEZONE" ></A ><TT CLASS="VARNAME" >timezone</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the time zone for displaying and interpreting time stamps. The default is 'unknown', which means to use whatever the system environment specifies as the time zone. See <A HREF="datatype-datetime.html" >Section 8.5</A > for more information. </P ></DD ><DT ><A NAME="GUC-AUSTRALIAN-TIMEZONES" ></A ><TT CLASS="VARNAME" >australian_timezones</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > If set to true, <TT CLASS="LITERAL" >ACST</TT >, <TT CLASS="LITERAL" >CST</TT >, <TT CLASS="LITERAL" >EST</TT >, and <TT CLASS="LITERAL" >SAT</TT > are interpreted as Australian time zones rather than as North/South American time zones and Saturday. The default is false. </P ></DD ><DT ><A NAME="GUC-EXTRA-FLOAT-DIGITS" ></A ><TT CLASS="VARNAME" >extra_float_digits</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > This parameter adjusts the number of digits displayed for floating-point values, including <TT CLASS="TYPE" >float4</TT >, <TT CLASS="TYPE" >float8</TT >, and geometric data types. The parameter value is added to the standard number of digits (<TT CLASS="LITERAL" >FLT_DIG</TT > or <TT CLASS="LITERAL" >DBL_DIG</TT > as appropriate). The value can be set as high as 2, to include partially-significant digits; this is especially useful for dumping float data that needs to be restored exactly. Or it can be set negative to suppress unwanted digits. </P ></DD ><DT ><A NAME="GUC-CLIENT-ENCODING" ></A ><TT CLASS="VARNAME" >client_encoding</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the client-side encoding (character set). The default is to use the database encoding. </P ></DD ><DT ><A NAME="GUC-LC-MESSAGES" ></A ><TT CLASS="VARNAME" >lc_messages</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the language in which messages are displayed. Acceptable values are system-dependent; see <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. If this variable is set to the empty string (which is the default) then the value is inherited from the execution environment of the server in a system-dependent way. </P ><P > On some systems, this locale category does not exist. Setting this variable will still work, but there will be no effect. Also, there is a chance that no translated messages for the desired language exist. In that case you will continue to see the English messages. </P ></DD ><DT ><A NAME="GUC-LC-MONETARY" ></A ><TT CLASS="VARNAME" >lc_monetary</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the locale to use for formatting monetary amounts, for example with the <CODE CLASS="FUNCTION" >to_char</CODE > family of functions. Acceptable values are system-dependent; see <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. If this variable is set to the empty string (which is the default) then the value is inherited from the execution environment of the server in a system-dependent way. </P ></DD ><DT ><A NAME="GUC-LC-NUMERIC" ></A ><TT CLASS="VARNAME" >lc_numeric</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the locale to use for formatting numbers, for example with the <CODE CLASS="FUNCTION" >to_char</CODE > family of functions. Acceptable values are system-dependent; see <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. If this variable is set to the empty string (which is the default) then the value is inherited from the execution environment of the server in a system-dependent way. </P ></DD ><DT ><A NAME="GUC-LC-TIME" ></A ><TT CLASS="VARNAME" >lc_time</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Sets the locale to use for formatting date and time values. (Currently, this setting does nothing, but it may in the future.) Acceptable values are system-dependent; see <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. If this variable is set to the empty string (which is the default) then the value is inherited from the execution environment of the server in a system-dependent way. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-CLIENT-OTHER" >16.4.8.3. Other Defaults</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-EXPLAIN-PRETTY-PRINT" ></A ><TT CLASS="VARNAME" >explain_pretty_print</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Determines whether <TT CLASS="COMMAND" >EXPLAIN VERBOSE</TT > uses the indented or non-indented format for displaying detailed query-tree dumps. The default is on. </P ></DD ><DT ><A NAME="GUC-DYNAMIC-LIBRARY-PATH" ></A ><TT CLASS="VARNAME" >dynamic_library_path</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > If a dynamically loadable module needs to be opened and the file name specified in the <TT CLASS="COMMAND" >CREATE FUNCTION</TT > or <TT CLASS="COMMAND" >LOAD</TT > command does not have a directory component (i.e. the name does not contain a slash), the system will search this path for the required file. </P ><P > The value for <TT CLASS="VARNAME" >dynamic_library_path</TT > has to be a list of absolute directory paths separated by colons (or semi-colons on Windows). If a list element starts with the special string <TT CLASS="LITERAL" >$libdir</TT >, the compiled-in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > package library directory is substituted for <TT CLASS="LITERAL" >$libdir</TT >. This is where the modules provided by the standard <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > distribution are installed. (Use <TT CLASS="LITERAL" >pg_config --pkglibdir</TT > to find out the name of this directory.) For example: </P><PRE CLASS="PROGRAMLISTING" >dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'</PRE ><P> or, in a Windows environment: </P><PRE CLASS="PROGRAMLISTING" >dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'</PRE ><P> </P ><P > The default value for this parameter is <TT CLASS="LITERAL" >'$libdir'</TT >. If the value is set to an empty string, the automatic path search is turned off. </P ><P > This parameter can be changed at run time by superusers, but a setting done that way will only persist until the end of the client connection, so this method should be reserved for development purposes. The recommended way to set this parameter is in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-LOCKS" >16.4.9. Lock Management</A ></H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-DEADLOCK-TIMEOUT" ></A ><TT CLASS="VARNAME" >deadlock_timeout</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > This is the amount of time, in milliseconds, to wait on a lock before checking to see if there is a deadlock condition. The check for deadlock is relatively slow, so the server doesn't run it every time it waits for a lock. We (optimistically?) assume that deadlocks are not common in production applications and just wait on the lock for a while before starting the check for a deadlock. Increasing this value reduces the amount of time wasted in needless deadlock checks, but slows down reporting of real deadlock errors. The default is 1000 (i.e., one second), which is probably about the smallest value you would want in practice. On a heavily loaded server you might want to raise it. Ideally the setting should exceed your typical transaction time, so as to improve the odds that a lock will be released before the waiter decides to check for deadlock. </P ></DD ><DT ><A NAME="GUC-MAX-LOCKS-PER-TRANSACTION" ></A ><TT CLASS="VARNAME" >max_locks_per_transaction</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > The shared lock table is sized on the assumption that at most <TT CLASS="VARNAME" >max_locks_per_transaction</TT > * <TT CLASS="VARNAME" >max_connections</TT > distinct objects will need to be locked at any one time. (Thus, this parameter's name may be confusing: it is not a hard limit on the number of locks taken by any one transaction, but rather a maximum average value.) The default, 64, has historically proven sufficient, but you might need to raise this value if you have clients that touch many different tables in a single transaction. This option can only be set at server start. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-COMPATIBLE" >16.4.10. Version and Platform Compatibility</A ></H2 ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-COMPATIBLE-VERSION" >16.4.10.1. Previous PostgreSQL Versions</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-ADD-MISSING-FROM" ></A ><TT CLASS="VARNAME" >add_missing_from</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > When <TT CLASS="LITERAL" >true</TT >, tables that are referenced by a query will be automatically added to the <TT CLASS="LITERAL" >FROM</TT > clause if not already present. The default is <TT CLASS="LITERAL" >true</TT > for compatibility with previous releases of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. However, this behavior is not SQL-standard, and many people dislike it because it can mask mistakes (such as referencing a table where you should have referenced its alias). Set to <TT CLASS="LITERAL" >false</TT > for the SQL-standard behavior of rejecting references to tables that are not listed in <TT CLASS="LITERAL" >FROM</TT >. </P ></DD ><DT ><A NAME="GUC-BACKSLASH-QUOTE" ></A ><TT CLASS="VARNAME" >backslash_quote</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This controls whether a quote mark can be represented by <TT CLASS="LITERAL" >\'</TT > in a string literal. The preferred, SQL-standard way to represent a quote mark is by doubling it (<TT CLASS="LITERAL" >''</TT >) but <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > has historically also accepted <TT CLASS="LITERAL" >\'</TT >. However, use of <TT CLASS="LITERAL" >\'</TT > creates security risks because in some client character set encodings, there are multibyte characters in which the last byte is numerically equivalent to ASCII <TT CLASS="LITERAL" >\</TT >. If client-side code does escaping incorrectly then a SQL-injection attack is possible. This risk can be prevented by making the server reject queries in which a quote mark appears to be escaped by a backslash. The allowed values of <TT CLASS="VARNAME" >backslash_quote</TT > are <TT CLASS="LITERAL" >on</TT > (allow <TT CLASS="LITERAL" >\'</TT > always), <TT CLASS="LITERAL" >off</TT > (reject always), and <TT CLASS="LITERAL" >safe_encoding</TT > (allow only if client encoding does not allow ASCII <TT CLASS="LITERAL" >\</TT > within a multibyte character). <TT CLASS="LITERAL" >safe_encoding</TT > is the default setting. </P ></DD ><DT ><A NAME="GUC-DEFAULT-WITH-OIDS" ></A ><TT CLASS="VARNAME" >default_with_oids</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This controls whether <TT CLASS="COMMAND" >CREATE TABLE</TT > and <TT CLASS="COMMAND" >CREATE TABLE AS</TT > include an OID column in newly-created tables, if neither <TT CLASS="LITERAL" >WITH OIDS</TT > nor <TT CLASS="LITERAL" >WITHOUT OIDS</TT > is specified. It also determines whether OIDs will be included in tables created by <TT CLASS="COMMAND" >SELECT INTO</TT >. In <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 8.0.11 <TT CLASS="VARNAME" >default_with_oids</TT > defaults to true. This is also the behavior of previous versions of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. However, assuming that tables will contain OIDs by default is not encouraged. This option will probably default to false in a future release of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. </P ><P > To ease compatibility with applications that make use of OIDs, this option should left enabled. To ease compatibility with future versions of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >, this option should be disabled, and applications that require OIDs on certain tables should explicitly specify <TT CLASS="LITERAL" >WITH OIDS</TT > when those tables are created. </P ></DD ><DT ><A NAME="GUC-REGEX-FLAVOR" ></A ><TT CLASS="VARNAME" >regex_flavor</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > The regular expression <SPAN CLASS="QUOTE" >"flavor"</SPAN > can be set to <TT CLASS="LITERAL" >advanced</TT >, <TT CLASS="LITERAL" >extended</TT >, or <TT CLASS="LITERAL" >basic</TT >. The default is <TT CLASS="LITERAL" >advanced</TT >. The <TT CLASS="LITERAL" >extended</TT > setting may be useful for exact backwards compatibility with pre-7.4 releases of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. See <A HREF="functions-matching.html#POSIX-SYNTAX-DETAILS" >Section 9.7.3.1</A > for details. </P ></DD ><DT ><A NAME="GUC-SQL-INHERITANCE" ></A ><TT CLASS="VARNAME" >sql_inheritance</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > This controls the inheritance semantics, in particular whether subtables are included by various commands by default. They were not included in versions prior to 7.1. If you need the old behavior you can set this variable to off, but in the long run you are encouraged to change your applications to use the <TT CLASS="LITERAL" >ONLY</TT > key word to exclude subtables. See <A HREF="ddl-inherit.html" >Section 5.5</A > for more information about inheritance. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT3" ><H3 CLASS="SECT3" ><A NAME="RUNTIME-CONFIG-COMPATIBLE-CLIENTS" >16.4.10.2. Platform and Client Compatibility</A ></H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-TRANSFORM-NULL-EQUALS" ></A ><TT CLASS="VARNAME" >transform_null_equals</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > When turned on, expressions of the form <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >expr</I ></TT > = NULL</TT > (or <TT CLASS="LITERAL" >NULL = <TT CLASS="REPLACEABLE" ><I >expr</I ></TT ></TT >) are treated as <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >expr</I ></TT > IS NULL</TT >, that is, they return true if <TT CLASS="REPLACEABLE" ><I >expr</I ></TT > evaluates to the null value, and false otherwise. The correct SQL-spec-compliant behavior of <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >expr</I ></TT > = NULL</TT > is to always return null (unknown). Therefore this option defaults to off. </P ><P > However, filtered forms in <SPAN CLASS="PRODUCTNAME" >Microsoft Access</SPAN > generate queries that appear to use <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >expr</I ></TT > = NULL</TT > to test for null values, so if you use that interface to access the database you might want to turn this option on. Since expressions of the form <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >expr</I ></TT > = NULL</TT > always return the null value (using the correct interpretation) they are not very useful and do not appear often in normal applications, so this option does little harm in practice. But new users are frequently confused about the semantics of expressions involving null values, so this option is not on by default. </P ><P > Note that this option only affects the exact form <TT CLASS="LITERAL" >= NULL</TT >, not other comparison operators or other expressions that are computationally equivalent to some expression involving the equals operator (such as <TT CLASS="LITERAL" >IN</TT >). Thus, this option is not a general fix for bad programming. </P ><P > Refer to <A HREF="functions-comparison.html" >Section 9.2</A > for related information. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-PRESET" >16.4.11. Preset Options</A ></H2 ><P > The following <SPAN CLASS="QUOTE" >"parameters"</SPAN > are read-only, and are determined when <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > is compiled or when it is installed. As such, they have been excluded from the sample <TT CLASS="FILENAME" >postgresql.conf</TT > file. These options report various aspects of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > behavior that may be of interest to certain applications, particularly administrative front-ends. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-BLOCK-SIZE" ></A ><TT CLASS="VARNAME" >block_size</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Shows the size of a disk block. It is determined by the value of <TT CLASS="LITERAL" >BLCKSZ</TT > when building the server. The default value is 8192 bytes. The meaning of some configuration variables (such as <A HREF="runtime-config.html#GUC-SHARED-BUFFERS" >shared_buffers</A >) is influenced by <TT CLASS="VARNAME" >block_size</TT >. See <A HREF="runtime-config.html#RUNTIME-CONFIG-RESOURCE" >Section 16.4.3</A > for information. </P ></DD ><DT ><A NAME="GUC-INTEGER-DATETIMES" ></A ><TT CLASS="VARNAME" >integer_datetimes</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Shows whether <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > was built with support for 64-bit-integer dates and times. It is set by configuring with <TT CLASS="LITERAL" >--enable-integer-datetimes</TT > when building <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. The default value is <TT CLASS="LITERAL" >off</TT >. </P ></DD ><DT ><A NAME="GUC-LC-COLLATE" ></A ><TT CLASS="VARNAME" >lc_collate</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Shows the locale in which sorting of textual data is done. See <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. The value is determined when the database cluster is initialized. </P ></DD ><DT ><A NAME="GUC-LC-CTYPE" ></A ><TT CLASS="VARNAME" >lc_ctype</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Shows the locale that determines character classifications. See <A HREF="charset.html#LOCALE" >Section 20.1</A > for more information. The value is determined when the database cluster is initialized. Ordinarily this will be the same as <TT CLASS="VARNAME" >lc_collate</TT >, but for special applications it might be set differently. </P ></DD ><DT ><A NAME="GUC-MAX-FUNCTION-ARGS" ></A ><TT CLASS="VARNAME" >max_function_args</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Shows the maximum number of function arguments. It is determined by the value of <TT CLASS="LITERAL" >FUNC_MAX_ARGS</TT > when building the server. The default value is 32. </P ></DD ><DT ><A NAME="GUC-MAX-IDENTIFIER-LENGTH" ></A ><TT CLASS="VARNAME" >max_identifier_length</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Shows the maximum identifier length. It is determined as one less than the value of <TT CLASS="LITERAL" >NAMEDATALEN</TT > when building the server. The default value of <TT CLASS="LITERAL" >NAMEDATALEN</TT > is 64; therefore the default <TT CLASS="VARNAME" >max_identifier_length</TT > is 63. </P ></DD ><DT ><A NAME="GUC-MAX-INDEX-KEYS" ></A ><TT CLASS="VARNAME" >max_index_keys</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Shows the maximum number of index keys. It is determined by the value of <TT CLASS="LITERAL" >INDEX_MAX_KEYS</TT > when building the server. The default value is 32. </P ></DD ><DT ><A NAME="GUC-SERVER-ENCODING" ></A ><TT CLASS="VARNAME" >server_encoding</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Shows the database encoding (character set). It is determined when the database is created. Ordinarily, clients need only be concerned with the value of <A HREF="runtime-config.html#GUC-CLIENT-ENCODING" >client_encoding</A >. </P ></DD ><DT ><A NAME="GUC-SERVER-VERSION" ></A ><TT CLASS="VARNAME" >server_version</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > Shows the version number of the server. It is determined by the value of <TT CLASS="LITERAL" >PG_VERSION</TT > when building the server. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-CUSTOM" >16.4.12. Customized Options</A ></H2 ><P > This feature was designed to allow options not normally known to <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > to be added by add-on modules (such as procedural languages). This allows add-on modules to be configured in the standard ways. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-CUSTOM-VARIABLE-CLASSES" ></A ><TT CLASS="VARNAME" >custom_variable_classes</TT > (<TT CLASS="TYPE" >string</TT >)</DT ><DD ><P > This variable specifies one or several class names to be used for custom variables, in the form of a comma-separated list. A custom variable is a variable not normally known to <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > proper but used by some add-on module. Such variables must have names consisting of a class name, a dot, and a variable name. <TT CLASS="VARNAME" >custom_variable_classes</TT > specifies all the class names in use in a particular installation. This option can only be set at server start or in the <TT CLASS="FILENAME" >postgresql.conf</TT > configuration file. </P ></DD ></DL ></DIV ><P > The difficulty with setting custom variables in <TT CLASS="FILENAME" >postgresql.conf</TT > is that the file must be read before add-on modules have been loaded, and so custom variables would ordinarily be rejected as unknown. When <TT CLASS="VARNAME" >custom_variable_classes</TT > is set, the server will accept definitions of arbitrary variables within each specified class. These variables will be treated as placeholders and will have no function until the module that defines them is loaded. When a module for a specific class is loaded, it will add the proper variable definitions for its class name, convert any placeholder values according to those definitions, and issue warnings for any placeholders of its class that remain (which presumably would be misspelled configuration variables). </P ><P > Here is an example of what <TT CLASS="FILENAME" >postgresql.conf</TT > might contain when using custom variables: </P><PRE CLASS="PROGRAMLISTING" >custom_variable_classes = 'plr,pljava' plr.path = '/usr/lib/R' pljava.foo = 1 plruby.bar = true # generates error, unknown class name</PRE ><P> </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-DEVELOPER" >16.4.13. Developer Options</A ></H2 ><P > The following options are intended for work on the <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > source, and in some cases to assist with recovery of severely damaged databases. There should be no reason to use them in a production database setup. As such, they have been excluded from the sample <TT CLASS="FILENAME" >postgresql.conf</TT > file. Note that many of these options require special source compilation flags to work at all. </P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><A NAME="GUC-DEBUG-ASSERTIONS" ></A ><TT CLASS="VARNAME" >debug_assertions</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Turns on various assertion checks. This is a debugging aid. If you are experiencing strange problems or crashes you might want to turn this on, as it might expose programming mistakes. To use this option, the macro <TT CLASS="SYMBOL" >USE_ASSERT_CHECKING</TT > must be defined when <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > is built (accomplished by the <TT CLASS="COMMAND" >configure</TT > option <TT CLASS="OPTION" >--enable-cassert</TT >). Note that <TT CLASS="VARNAME" >debug_assertions</TT > defaults to on if <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > has been built with assertions enabled. </P ></DD ><DT ><A NAME="GUC-DEBUG-SHARED-BUFFERS" ></A ><TT CLASS="VARNAME" >debug_shared_buffers</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > Number of seconds between buffer freelist reports. If set greater than zero, emit freelist statistics to the log every so many seconds. Zero (the default) disables reporting. </P ></DD ><DT ><A NAME="GUC-PRE-AUTH-DELAY" ></A ><TT CLASS="VARNAME" >pre_auth_delay</TT > (<TT CLASS="TYPE" >integer</TT >)</DT ><DD ><P > If nonzero, a delay of this many seconds occurs just after a new server process is forked, before it conducts the authentication process. This is intended to give an opportunity to attach to the server process with a debugger to trace down misbehavior in authentication. </P ></DD ><DT ><A NAME="GUC-TRACE-NOTIFY" ></A ><TT CLASS="VARNAME" >trace_notify</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Generates a great amount of debugging output for the <TT CLASS="COMMAND" >LISTEN</TT > and <TT CLASS="COMMAND" >NOTIFY</TT > commands. <A HREF="runtime-config.html#GUC-CLIENT-MIN-MESSAGES" >client_min_messages</A > or <A HREF="runtime-config.html#GUC-LOG-MIN-MESSAGES" >log_min_messages</A > must be <TT CLASS="LITERAL" >DEBUG1</TT > or lower to send this output to the client or server log, respectively. </P ></DD ><DT ><TT CLASS="VARNAME" >trace_locks</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >trace_lwlocks</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >trace_userlocks</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >trace_lock_oidmin</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >trace_lock_table</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >debug_deadlocks</TT > (<TT CLASS="TYPE" >boolean</TT >)<BR><TT CLASS="VARNAME" >log_btree_build_stats</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Various other code tracing and debugging options. </P ></DD ><DT ><A NAME="GUC-WAL-DEBUG" ></A ><TT CLASS="VARNAME" >wal_debug</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > If true, emit WAL-related debugging output. This option is only available if the <TT CLASS="SYMBOL" >WAL_DEBUG</TT > macro was defined when <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > was compiled. </P ></DD ><DT ><A NAME="GUC-ZERO-DAMAGED-PAGES" ></A ><TT CLASS="VARNAME" >zero_damaged_pages</TT > (<TT CLASS="TYPE" >boolean</TT >)</DT ><DD ><P > Detection of a damaged page header normally causes <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > to report an error, aborting the current command. Setting <TT CLASS="VARNAME" >zero_damaged_pages</TT > to true causes the system to instead report a warning, zero out the damaged page, and continue processing. This behavior <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >will destroy data</I ></SPAN >, namely all the rows on the damaged page. But it allows you to get past the error and retrieve rows from any undamaged pages that may be present in the table. So it is useful for recovering data if corruption has occurred due to hardware or software error. You should generally not set this true until you have given up hope of recovering data from the damaged page(s) of a table. The default setting is off, and it can only be changed by a superuser. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="RUNTIME-CONFIG-SHORT" >16.4.14. Short Options</A ></H2 ><P > For convenience there are also single letter command-line option switches available for some parameters. They are described in <A HREF="runtime-config.html#RUNTIME-CONFIG-SHORT-TABLE" >Table 16-1</A >. </P ><DIV CLASS="TABLE" ><A NAME="RUNTIME-CONFIG-SHORT-TABLE" ></A ><P ><B >Table 16-1. Short option key</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Short option</TH ><TH >Equivalent</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="OPTION" >-B <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >shared_buffers = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-d <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >log_min_messages = DEBUG<TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-F</TT ></TD ><TD ><TT CLASS="LITERAL" >fsync = off</TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-h <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >listen_addresses = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-i</TT ></TD ><TD ><TT CLASS="LITERAL" >listen_addresses = '*'</TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-k <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >unix_socket_directory = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-l</TT ></TD ><TD ><TT CLASS="LITERAL" >ssl = on</TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-N <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >max_connections = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-p <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ><TD ><TT CLASS="LITERAL" >port = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD > <TT CLASS="OPTION" >-fi</TT >, <TT CLASS="OPTION" >-fh</TT >, <TT CLASS="OPTION" >-fm</TT >, <TT CLASS="OPTION" >-fn</TT >, <TT CLASS="OPTION" >-fs</TT >, <TT CLASS="OPTION" >-ft</TT ><A NAME="FN.RUNTIME-CONFIG-SHORT" HREF="#FTN.FN.RUNTIME-CONFIG-SHORT" ><SPAN CLASS="footnote" >[a]</SPAN ></A > </TD ><TD > <TT CLASS="LITERAL" >enable_indexscan = off</TT >, <TT CLASS="LITERAL" >enable_hashjoin = off</TT >, <TT CLASS="LITERAL" >enable_mergejoin = off</TT >, <TT CLASS="LITERAL" >enable_nestloop = off</TT >, <TT CLASS="LITERAL" >enable_seqscan = off</TT >, <TT CLASS="LITERAL" >enable_tidscan = off</TT > </TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-s</TT ><A HREF="runtime-config.html#FTN.FN.RUNTIME-CONFIG-SHORT" ><SPAN CLASS="footnote" >[a]</SPAN ></A ></TD ><TD ><TT CLASS="LITERAL" >log_statement_stats = on</TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-S <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ><A HREF="runtime-config.html#FTN.FN.RUNTIME-CONFIG-SHORT" ><SPAN CLASS="footnote" >[a]</SPAN ></A > </TD ><TD ><TT CLASS="LITERAL" >work_mem = <TT CLASS="REPLACEABLE" ><I >x</I ></TT ></TT ></TD ></TR ><TR ><TD ><TT CLASS="OPTION" >-tpa</TT >, <TT CLASS="OPTION" >-tpl</TT >, <TT CLASS="OPTION" >-te</TT ><A HREF="runtime-config.html#FTN.FN.RUNTIME-CONFIG-SHORT" ><SPAN CLASS="footnote" >[a]</SPAN ></A ></TD ><TD ><TT CLASS="LITERAL" >log_parser_stats = on</TT >, <TT CLASS="LITERAL" >log_planner_stats = on</TT >, <TT CLASS="LITERAL" >log_executor_stats = on</TT ></TD ></TR ></TBODY ><TR ><TD COLSPAN="2" >Notes:<BR><A NAME="FTN.FN.RUNTIME-CONFIG-SHORT" >a. </A > For historical reasons, these options must be passed to the individual server process via the <TT CLASS="OPTION" >-o</TT > <TT CLASS="COMMAND" >postmaster</TT > option, for example, </P><PRE CLASS="SCREEN" >$ <KBD CLASS="USERINPUT" >postmaster -o '-S 1024 -s'</KBD ></PRE ><P> or via <TT CLASS="ENVAR" >PGOPTIONS</TT > from the client side, as explained above. <BR></TD ></TR ></TABLE ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="postmaster-start.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="kernel-resources.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Starting the Database Server</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="runtime.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Managing Kernel Resources</TD ></TR ></TABLE ></DIV ></BODY ></HTML >