Commit fdcb8516 authored by Bruce Momjian's avatar Bruce Momjian

Wording improvements to runtime.sgml. Add mention in postgresql.conf

file that SIGHUP or "pg_ctl reload" are required for changes to take
affect on a running server.
parent db1d7a9a
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.107 2002/03/09 05:11:37 momjian Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -18,22 +18,21 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo ...@@ -18,22 +18,21 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo
</indexterm> </indexterm>
<para> <para>
As with any other server daemon that is connected to the world at As with any other server daemon that is connected to outside world,
large, it is advisable to run <productname>PostgreSQL</productname> under a separate user it is advisable to run <productname>PostgreSQL</productname> under a
account. This user account should only own the data itself that is separate user account. This user account should only own the data
being managed by the server, and should not be shared with other that is managed by the server, and should not be shared with other
daemons. (Thus, using the user <quote>nobody</quote> is a bad daemons. (For example, using the user <quote>nobody</quote> is a bad
idea.) It is not advisable to install the executables as owned by idea.) It is not advisable to install executables owned by
this user account because that runs the risk of user-defined this user because compromised systems could then modify their own
functions gone astray or any other exploits compromising the binaries.
executable programs.
</para> </para>
<para> <para>
To add a user account to your system, look for a command To add a Unix user account to your system, look for a command
<command>useradd</command> or <command>adduser</command>. The user <command>useradd</command> or <command>adduser</command>. The user
name <systemitem>postgres</systemitem> is often used but by no means name <systemitem>postgres</systemitem> is often used but is by no
required. means required.
</para> </para>
</sect1> </sect1>
...@@ -52,10 +51,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo ...@@ -52,10 +51,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo
<para> <para>
Before you can do anything, you must initialize a database storage Before you can do anything, you must initialize a database storage
area on disk. We call this a <firstterm>database cluster</firstterm>. area on disk. We call this a <firstterm>database cluster</firstterm>.
(<acronym>SQL</acronym> speaks of a catalog cluster instead.) A (<acronym>SQL</acronym> uses the term catalog cluster instead.) A
database cluster is a collection of databases that will be accessible database cluster is a collection of databases is accessible by a
through a single instance of a running database server. After single instance of a running database server. After initialization, a
initialization, a database cluster will contain one database named database cluster will contain a database named
<literal>template1</literal>. As the name suggests, this will be used <literal>template1</literal>. As the name suggests, this will be used
as a template for subsequently created databases; it should not be as a template for subsequently created databases; it should not be
used for actual work. used for actual work.
...@@ -76,9 +75,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo ...@@ -76,9 +75,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo
<screen> <screen>
<prompt>$</> <userinput>initdb -D /usr/local/pgsql/data</userinput> <prompt>$</> <userinput>initdb -D /usr/local/pgsql/data</userinput>
</screen> </screen>
Note that you must execute this command while being logged into Note that you must execute this command while logged into the
the <productname>PostgreSQL</productname> user account, which is described in the previous <productname>PostgreSQL</productname> user account, which is
section. described in the previous section.
</para> </para>
<tip> <tip>
...@@ -93,11 +92,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo ...@@ -93,11 +92,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.106 2002/03/06 06:44:32 mo
<para> <para>
<command>initdb</command> will attempt to create the directory you <command>initdb</command> will attempt to create the directory you
specify if it does not already exist. It is likely that it won't specify if it does not already exist. It is likely that it will not
have the permission to do so (if you followed our advice and have the permission to do so (if you followed our advice and created
created an unprivileged account). In that case you should create the an unprivileged account). In that case you should create the
directory yourself (as root) and transfer ownership of it to the directory yourself (as root) and change the owner to be the
<productname>PostgreSQL</productname> user account. Here is how this might work: <productname>PostgreSQL</productname> user. Here is how this might
be done:
<screen> <screen>
root# <userinput>mkdir /usr/local/pgsql/data</userinput> root# <userinput>mkdir /usr/local/pgsql/data</userinput>
root# <userinput>chown postgres /usr/local/pgsql/data</userinput> root# <userinput>chown postgres /usr/local/pgsql/data</userinput>
...@@ -108,36 +108,36 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput> ...@@ -108,36 +108,36 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
<para> <para>
<command>initdb</command> will refuse to run if the data directory <command>initdb</command> will refuse to run if the data directory
looks like it belongs to an already initialized installation. looks like it it has already been initialized.</para>
</para>
<para> <para>
Because the data directory contains all the data stored in the Because the data directory contains all the data stored in the
database, it is essential that it be well secured from unauthorized database, it is essential that it be secured from unauthorized
access. <command>initdb</command> therefore revokes access access. <command>initdb</command> therefore revokes access
permissions from everyone but the <productname>PostgreSQL</productname> user account. permissions from everyone but the
<productname>PostgreSQL</productname> user.
</para> </para>
<para> <para>
However, while the directory contents are secure, the default However, while the directory contents are secure, the default
<filename>pg_hba.conf</filename> authentication method of <filename>pg_hba.conf</filename> authentication method of
<literal>trust</literal> allows any local user to connect to the database <literal>trust</literal> allows any local user to connect to the
and even become the database superuser. If you don't trust other local database and even become the database superuser. If you don't trust
users, we recommend you use <command>initdb</command>'s option other local users, we recommend you use <command>initdb</command>'s
<option>-W</option> or <option>--pwprompt</option> to assign a <option>-W</option> or <option>--pwprompt</option> option to assign a
password to the database superuser. After <command>initdb</command>, password to the database superuser. After <command>initdb</command>,
modify <filename>pg_hba.conf</filename> to use <literal>md5</> or modify <filename>pg_hba.conf</filename> to use <literal>md5</> or
<literal>password</>, instead of <literal>trust</>, authentication <literal>password</> instead of <literal>trust</> authentication
<emphasis>before</> you start the server for the first time. (Other, possibly <emphasis>before</> you start the server for the first time. (Other,
more convenient approaches include using <literal>ident</literal> approaches include using <literal>ident</literal> authentication or
authentication or file system permissions to restrict connections. See file system permissions to restrict connections. See <xref
<xref linkend="client-authentication"> for more information.) linkend="client-authentication"> for more information.
</para> </para>
<para> <para>
<indexterm><primary>LC_COLLATE</></> <indexterm><primary>LC_COLLATE</></>
One surprise you might encounter while running <command>initdb</command> is One surprise you might encounter while running
a notice similar to this one: <command>initdb</command> is a notice similar to this:
<screen> <screen>
WARNING: Initializing database with en_US collation order. WARNING: Initializing database with en_US collation order.
This locale setting will prevent use of index optimization for This locale setting will prevent use of index optimization for
...@@ -145,16 +145,18 @@ WARNING: Initializing database with en_US collation order. ...@@ -145,16 +145,18 @@ WARNING: Initializing database with en_US collation order.
such queries, you may wish to set LC_COLLATE to "C" and such queries, you may wish to set LC_COLLATE to "C" and
re-initdb. For more information see the Administrator's Guide. re-initdb. For more information see the Administrator's Guide.
</screen> </screen>
This is intended to warn you that the currently selected locale This is intended to warn you that the currently selected locale will
will cause indexes to be sorted in an order that prevents them from cause indexes to be sorted in an order that prevents them from being
being used for LIKE and regular-expression searches. If you need used for LIKE and regular-expression searches. If you need good
good performance of such searches, you should set your current locale performance in such searches, you should set your current locale to
to <literal>C</> and re-run <command>initdb</command>. On most systems, setting the <literal>C</> and re-run <command>initdb</command>. On most systems,
current locale is done by changing the value of the environment variable setting the current locale is done by changing the value of the
<literal>LC_ALL</literal> or <literal>LANG</literal>. The sort order used environment variable <literal>LC_ALL</literal> or
within a particular database cluster is set by <command>initdb</command> <literal>LANG</literal>. The sort order used within a particular
and cannot be changed later, short of dumping all data, rerunning <command>initdb</command>, database cluster is set by <command>initdb</command> and cannot be
and reloading the data. So it's important to make this choice correctly now. changed later, short of dumping all data, rerunning
<command>initdb</command>, and reloading the data. So it's important
to make this choice correctly the first time.
</para> </para>
</sect1> </sect1>
...@@ -165,20 +167,20 @@ WARNING: Initializing database with en_US collation order. ...@@ -165,20 +167,20 @@ WARNING: Initializing database with en_US collation order.
<indexterm> <indexterm>
<primary>postmaster</primary> <primary>postmaster</primary>
</indexterm> </indexterm>
Before anyone can access the database you must start the database Before anyone can access the database, you must start the database
server. The database server is called server. The database server is called
<firstterm>postmaster</firstterm>. <firstterm>postmaster</firstterm>. The postmaster must know where to
The postmaster must know where to find the data it is supposed find the data it is supposed to use. This is done with the
to work on. This is done with the <option>-D</option> option. Thus, <option>-D</option> option. Thus, the simplest way to start the
the simplest way to start the server is, for example, server is:
<screen> <screen>
$ <userinput>postmaster -D /usr/local/pgsql/data</userinput> $ <userinput>postmaster -D /usr/local/pgsql/data</userinput>
</screen> </screen>
which will leave the server running in the foreground. This must which will leave the server running in the foreground. This must be
again be done while logged into the <productname>PostgreSQL</productname> user account. Without done while logged into the <productname>PostgreSQL</productname> user
a <option>-D</option>, the server will try to use the data account. Without <option>-D</option>, the server will try to use
directory in the environment variable <envar>PGDATA</envar>; if the data directory in the environment variable <envar>PGDATA</envar>.
neither of these works it will fail. If neither of these succeed, it will fail.
</para> </para>
<para> <para>
...@@ -187,22 +189,22 @@ $ <userinput>postmaster -D /usr/local/pgsql/data</userinput> ...@@ -187,22 +189,22 @@ $ <userinput>postmaster -D /usr/local/pgsql/data</userinput>
<screen> <screen>
$ <userinput>postmaster -D /usr/local/pgsql/data &gt; logfile 2&gt;&amp;1 &amp;</userinput> $ <userinput>postmaster -D /usr/local/pgsql/data &gt; logfile 2&gt;&amp;1 &amp;</userinput>
</screen> </screen>
It is an extremely good idea to keep the server's <systemitem>stdout</> and <systemitem>stderr</> It is an important to store the server's <systemitem>stdout</> and
output around somewhere, as suggested here. It will help both for auditing <systemitem>stderr</> output somewhere, as shown above. It will help
purposes and to diagnose problems. for auditing purposes and to diagnose problems. (See <xref
(See <xref linkend="logfile-maintenance"> for a more thorough discussion linkend="logfile-maintenance"> for a more thorough discussion of log
of log file handling.) file handling.)
</para> </para>
<para> <para>
<indexterm> <indexterm>
<primary>TCP/IP</primary> <primary>TCP/IP</primary>
</indexterm> </indexterm>
The postmaster also takes a number of other command line options. The postmaster also takes a number of other command line options. For
For more information see the reference page and <xref linkend="runtime-config"> below. more information, see the reference page and <xref
In particular, in order for the server to accept linkend="runtime-config"> below. In particular, in order for the
TCP/IP connections (rather than just Unix domain socket ones), you server to accept TCP/IP connections (rather than just Unix domain
must also specify the <option>-i</option> option. socket ones), you must specify the <option>-i</option> option.
</para> </para>
<para> <para>
...@@ -210,51 +212,50 @@ $ <userinput>postmaster -D /usr/local/pgsql/data &gt; logfile 2&gt;&amp;1 &amp;< ...@@ -210,51 +212,50 @@ $ <userinput>postmaster -D /usr/local/pgsql/data &gt; logfile 2&gt;&amp;1 &amp;<
<primary>pg_ctl</primary> <primary>pg_ctl</primary>
</indexterm> </indexterm>
This shell syntax can get tedious quickly. Therefore the shell This shell syntax can get tedious quickly. Therefore the shell
script wrapper <application>pg_ctl</application> is provided that script wrapper <application>pg_ctl</application> is provided to
encapsulates some of the tasks. E.g., simplify some tasks. For example:
<programlisting> <programlisting>
pg_ctl start -l logfile pg_ctl start -l logfile
</programlisting> </programlisting>
will start the server in the background and put the output into the will start the server in the background and put the output into the
named log file. The <option>-D</option> option has the same named log file. The <option>-D</option> option has the same meaning
meaning as when invoking postmaster directly. here as in the postmaster. <application>pg_ctl</application> is also
<application>pg_ctl</application> also implements a symmetric capable of stopping the server.
<quote>stop</quote> operation.
</para> </para>
<para> <para>
Normally, you will want to start the database server when the Normally, you will want to start the database server when the
computer boots up. This is not required; the computer boots. Auto-start scripts are operating-system specific.
<productname>PostgreSQL</productname> server can be run There are a few distributed with
successfully from non-privileged accounts without root <productname>PostgreSQL</productname> in the
intervention. <filename>/contrib/start-scripts</> directory. This may require root
privileges.
</para> </para>
<para> <para>
Different systems have different conventions for starting up Different systems have different conventions for starting up daemons
daemons at boot time, so you are advised to familiarize yourself at boot time. Many systems have a file
with them. Many systems have a file
<filename>/etc/rc.local</filename> or <filename>/etc/rc.local</filename> or
<filename>/etc/rc.d/rc.local</filename> which is almost certainly <filename>/etc/rc.d/rc.local</filename>. Others use
no bad place to put such a command. Whatever you do, the server <filename>rc.d</> directories. Whatever you do, the server must be
must be run by the <productname>PostgreSQL</productname> user account run by the <productname>PostgreSQL</productname> user account
<emphasis>and not by root</emphasis> or any other user. Therefore <emphasis>and not by root</emphasis> or any other user. Therefore you
you probably always want to form your command lines along the lines probably should form your commands using <literal>su -c '...'
of <literal>su -c '...' postgres</literal>, for example: postgres</literal>. For example:
<programlisting> <programlisting>
su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
</programlisting> </programlisting>
</para> </para>
<para> <para>
Here are a few more operating system specific suggestions. (Always Here are a few more operating system specific suggestions. (Always
replace the proper installation directory and the user name you replace these with the proper installation directory and the user
chose.) name.)
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
For <productname>FreeBSD</productname>, take a look at the file For <productname>FreeBSD</productname>, look at the file
<filename>contrib/start-scripts/freebsd</filename> in the <filename>contrib/start-scripts/freebsd</filename> in the
<productname>PostgreSQL</productname> source distribution. <productname>PostgreSQL</productname> source distribution.
<indexterm><primary>FreeBSD</></> <indexterm><primary>FreeBSD</></>
...@@ -282,10 +283,9 @@ fi ...@@ -282,10 +283,9 @@ fi
<programlisting> <programlisting>
/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data /usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data
</programlisting> </programlisting>
to <filename>/etc/rc.d/rc.local</filename> or look into the file to <filename>/etc/rc.d/rc.local</filename> or look at the file
<filename>contrib/start-scripts/linux</filename> in the <filename>contrib/start-scripts/linux</filename> in the
<productname>PostgreSQL</productname> source distribution to <productname>PostgreSQL</productname> source distribution.
integrate the start and shutdown into the run level system.
</para> </para>
</listitem> </listitem>
...@@ -294,17 +294,15 @@ fi ...@@ -294,17 +294,15 @@ fi
On <productname>NetBSD</productname>, either use the On <productname>NetBSD</productname>, either use the
<productname>FreeBSD</productname> or <productname>FreeBSD</productname> or
<productname>Linux</productname> start scripts, depending on <productname>Linux</productname> start scripts, depending on
preference, as an example and place the file at preference. <indexterm><primary>NetBSD</></>
<filename>/usr/local/etc/rc.d/postgresql</filename>.
<indexterm><primary>NetBSD</></>
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
On <productname>Solaris</productname>, create a file called On <productname>Solaris</productname>, create a file called
<filename>/etc/init.d/postgresql</filename> to contain the following <filename>/etc/init.d/postgresql</filename> which should contain
single line: the following line:
<indexterm><primary>Solaris</></> <indexterm><primary>Solaris</></>
<programlisting> <programlisting>
su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data" su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data"
...@@ -319,22 +317,21 @@ su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgs ...@@ -319,22 +317,21 @@ su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgs
<para> <para>
While the <application>postmaster</application> is running, its While the <application>postmaster</application> is running, its
<acronym>PID</acronym> is in the file <filename>postmaster.pid</filename> in the data <acronym>PID</acronym> is in the file
directory. This is used as an interlock against multiple postmasters <filename>postmaster.pid</filename> in the data directory. This is
running in the same data directory, and can also be used for used to prevent multiple postmasters running in the same data
shutting down the postmaster. directory, and can also be used for shutting down the postmaster.
</para> </para>
<sect2 id="postmaster-start-failures"> <sect2 id="postmaster-start-failures">
<title>Server Start-up Failures</title> <title>Server Start-up Failures</title>
<para> <para>
There are several common reasons for the postmaster to fail to There are several common reasons the postmaster might fail to
start up. Check the postmaster's log file, or start it by hand start. Check the postmaster's log file, or start it by hand
(without redirecting standard output or standard error) to see (without redirecting standard output or standard error) and see
what complaint messages appear. Some of the possible error what error messages appear. Some of the error messages are
messages are reasonably self-explanatory, but here are some that self-explanatory, but some are not, as shown below:
are not.
</para> </para>
<para> <para>
...@@ -342,13 +339,12 @@ su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgs ...@@ -342,13 +339,12 @@ su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgs
FATAL: StreamServerPort: bind() failed: Address already in use FATAL: StreamServerPort: bind() failed: Address already in use
Is another postmaster already running on that port? Is another postmaster already running on that port?
</screen> </screen>
This usually means just what it suggests: you tried to This usually means just what it suggests: you tried to start
start a second postmaster on the same port where one is already another postmaster on the same port where one is already running.
running. However, if the kernel error message is not However, if the kernel error message is not <computeroutput>Address
<computeroutput>Address already in use</computeroutput> or some already in use</computeroutput> or some variant of that, there may
variant of that wording, there may be a different problem. For be a different problem. For example, trying to start a postmaster
example, trying to start a postmaster on a reserved port number on a reserved port number may draw something like:
may draw something like
<screen> <screen>
$ <userinput>postmaster -i -p 666</userinput> $ <userinput>postmaster -i -p 666</userinput>
FATAL: StreamServerPort: bind() failed: Permission denied FATAL: StreamServerPort: bind() failed: Permission denied
...@@ -357,49 +353,48 @@ FATAL: StreamServerPort: bind() failed: Permission denied ...@@ -357,49 +353,48 @@ FATAL: StreamServerPort: bind() failed: Permission denied
</para> </para>
<para> <para>
A message like A message like:
<screen> <screen>
IpcMemoryCreate: shmget(key=5440001, size=83918612, 01600) failed: Invalid argument IpcMemoryCreate: shmget(key=5440001, size=83918612, 01600) failed: Invalid argument
FATAL 1: ShmemCreate: cannot create region FATAL 1: ShmemCreate: cannot create region
</screen> </screen>
probably means that your kernel's limit on the size of shared probably means your kernel's limit on the size of shared memory is
memory areas is smaller than the buffer area that <productname>PostgreSQL</productname> is smaller than the buffer area <productname>PostgreSQL</productname>
trying to create (83918612 bytes in this example). Or it could is trying to create (83918612 bytes in this example). Or it could
mean that you don't have System-V-style shared memory support mean that you don't have System-V-style shared memory support
configured into your kernel at all. As a temporary workaround, configured into your kernel at all. As a temporary workaround, you
you can try starting the postmaster with a smaller-than-normal can try starting the postmaster with a smaller-than-normal number
number of buffers (<option>-B</option> switch). You will of buffers (<option>-B</option> switch). You will eventually want
eventually want to reconfigure your kernel to increase the to reconfigure your kernel to increase the allowed shared memory
allowed shared memory size, however. You may see this message size. You may see this message when trying to start multiple
when trying to start multiple postmasters on the same machine, if postmasters on the same machine if their total space requested
their total space requests exceed the kernel limit. exceeds the kernel limit.
</para> </para>
<para> <para>
An error like An error like:
<screen> <screen>
IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on device IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on device
</screen> </screen>
does <emphasis>not</emphasis> mean that you've run out of disk does <emphasis>not</emphasis> mean you've run out of disk space. It
space; it means that your kernel's limit on the number of System means your kernel's limit on the number of System V semaphores is
V semaphores is smaller than the number smaller than the number <productname>PostgreSQL</productname> wants
<productname>PostgreSQL</productname> wants to create. As above, to create. As above, you may be able to work around the problem by
you may be able to work around the problem by starting the starting the postmaster with a reduced number of backend processes
postmaster with a reduced number of backend processes
(<option>-N</option> switch), but you'll eventually want to (<option>-N</option> switch), but you'll eventually want to
increase the kernel limit. increase the kernel limit.
</para> </para>
<para> <para>
If you get an <quote>illegal system call</> error, then it is likely that If you get an <quote>illegal system call</> error, it is likely
shared memory or semaphores are not supported at all in your kernel. In shared memory or semaphores are not supported in your kernel at
that case your only option is to re-configure the kernel to turn on these all. In that case your only option is to reconfigure the kernel to
features. enable these features.
</para> </para>
<para> <para>
Details about configuring <systemitem class="osname">System V</> <acronym>IPC</> facilities are given in Details about configuring <systemitem class="osname">System V</>
<xref linkend="sysvipc">. <acronym>IPC</> facilities are given in <xref linkend="sysvipc">.
</para> </para>
</sect2> </sect2>
...@@ -407,11 +402,11 @@ IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on ...@@ -407,11 +402,11 @@ IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on
<title>Client Connection Problems</title> <title>Client Connection Problems</title>
<para> <para>
Although the possible error conditions on the client side are Although the error conditions possible on the client side are quite
both virtually infinite and application-dependent, a few of them varied and application-dependent, a few of them might be directly
might be directly related to how the server was started up. related to how the server was started up. Conditions other than
Conditions other than those shown below should be documented with those shown below should be documented with the respective client
the respective client application. application.
</para> </para>
<para> <para>
...@@ -428,8 +423,8 @@ psql: could not connect to server: Connection refused ...@@ -428,8 +423,8 @@ psql: could not connect to server: Connection refused
</para> </para>
<para> <para>
Alternatively, you'll get this when attempting Alternatively, you'll get this when attempting Unix-socket
Unix-socket communication to a local postmaster: communication to a local postmaster:
<screen> <screen>
psql: could not connect to server: Connection refused psql: could not connect to server: Connection refused
Is the server running locally and accepting Is the server running locally and accepting
...@@ -439,15 +434,15 @@ psql: could not connect to server: Connection refused ...@@ -439,15 +434,15 @@ psql: could not connect to server: Connection refused
<para> <para>
The last line is useful in verifying that the client is trying to The last line is useful in verifying that the client is trying to
connect where it is supposed to. If there is in fact no connect to the right place. If there is in fact no postmaster
postmaster running there, the kernel error message will typically running there, the kernel error message will typically be either
be either <computeroutput>Connection refused</computeroutput> or <computeroutput>Connection refused</computeroutput> or
<computeroutput>No such file or directory</computeroutput>, as <computeroutput>No such file or directory</computeroutput>, as
illustrated. (It is particularly important to realize that illustrated. (It is important to realize that
<computeroutput>Connection refused</computeroutput> in this <computeroutput>Connection refused</computeroutput> in this context
context does <emphasis>not</emphasis> mean that the postmaster does <emphasis>not</emphasis> mean that the postmaster got your
got your connection request and rejected it -- that case will connection request and rejected it -- that case will produce a
produce a different message, as shown in <xref different message, as shown in <xref
linkend="client-authentication-problems">.) Other error messages linkend="client-authentication-problems">.) Other error messages
such as <computeroutput>Connection timed out</computeroutput> may such as <computeroutput>Connection timed out</computeroutput> may
indicate more fundamental problems, like lack of network indicate more fundamental problems, like lack of network
...@@ -465,35 +460,33 @@ psql: could not connect to server: Connection refused ...@@ -465,35 +460,33 @@ psql: could not connect to server: Connection refused
</indexterm> </indexterm>
<para> <para>
There are a lot of configuration parameters that affect the There are a lot of configuration parameters that affect the behavior
behavior of the database system in some way or other. Here we of the database system. Here we describe how to set them and the
describe how to set them and the following subsections will following subsections will discuss each in detail.
discuss each of them.
</para> </para>
<para> <para>
All parameter names are case-insensitive. Every parameter takes a All parameter names are case-insensitive. Every parameter takes a
value of one of the four types Boolean, integer, floating point, value of one of the four types: boolean, integer, floating point,
string as described below. Boolean values are and string. Boolean values are <literal>ON</literal>,
<literal>ON</literal>, <literal>OFF</literal>, <literal>OFF</literal>, <literal>TRUE</literal>,
<literal>TRUE</literal>, <literal>FALSE</literal>, <literal>FALSE</literal>, <literal>YES</literal>,
<literal>YES</literal>, <literal>NO</literal>, <literal>NO</literal>, <literal>1</literal>, <literal>0</literal>
<literal>1</literal>, <literal>0</literal> (case-insensitive) or (case-insensitive) or any non-ambiguous prefix of these.
any non-ambiguous prefix of these.
</para> </para>
<para> <para>
One way to set these options is to edit the file One way to set these options is to edit the file
<filename>postgresql.conf</filename> in the data directory. <filename>postgresql.conf</filename> in the data directory. (A
(A default file is installed there.) An example of what default file is installed there.) An example of what this file might
this file could look like is: look like is:
<programlisting> <programlisting>
# This is a comment # This is a comment
log_connections = yes log_connections = yes
syslog = 2 syslog = 2
</programlisting> </programlisting>
As you see, options are one per line. The equal sign between name As you see, options are one per line. The equal sign between name
and value is optional. Whitespace is insignificant, blank lines and value is optional. Whitespace is insignificant and blank lines
are ignored. Hash marks (<quote>#</quote>) introduce comments are ignored. Hash marks (<quote>#</quote>) introduce comments
anywhere. anywhere.
</para> </para>
...@@ -502,18 +495,17 @@ syslog = 2 ...@@ -502,18 +495,17 @@ syslog = 2
<indexterm> <indexterm>
<primary>SIGHUP</primary> <primary>SIGHUP</primary>
</indexterm> </indexterm>
The configuration file is reread whenever the postmaster receives The configuration file is reread whenever the postmaster receives a
a <systemitem>SIGHUP</> signal (which is most easily sent by means <systemitem>SIGHUP</> signal (which is most easily sent by means of
of <literal>pg_ctl reload</>). The postmaster also propagates <literal>pg_ctl reload</>). The postmaster also propagates this
this signal to all already-running backend processes, so that signal to all currently running backend processes so that existing
existing sessions also get the new default. sessions also get the new value. Alternatively, you can send the
Alternatively, you can send the signal to only one backend process signal to a single backend process directly.
directly.
</para> </para>
<para> <para>
A second way to set these configuration parameters is to give them A second way to set these configuration parameters is to give them
as a command line option to the postmaster, such as as a command line option to the postmaster, such as:
<programlisting> <programlisting>
postmaster -c log_connections=yes -c syslog=2 postmaster -c log_connections=yes -c syslog=2
</programlisting> </programlisting>
...@@ -532,13 +524,13 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -532,13 +524,13 @@ env PGOPTIONS='-c geqo=off' psql
</programlisting> </programlisting>
(This works for any client application, not just (This works for any client application, not just
<application>psql</application>.) Note that this won't work for <application>psql</application>.) Note that this won't work for
options that are necessarily fixed once the server is started, options that are fixed when the server is started, such as the port
such as the port number. number.
</para> </para>
<para> <para>
Some options can be changed in individual SQL sessions with the Some options can be changed in individual SQL sessions with the
<command>SET</command> command, for example <command>SET</command> command, for example:
<screen> <screen>
=&gt; <userinput>SET ENABLE_SEQSCAN TO OFF;</userinput> =&gt; <userinput>SET ENABLE_SEQSCAN TO OFF;</userinput>
</screen> </screen>
...@@ -547,7 +539,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -547,7 +539,7 @@ env PGOPTIONS='-c geqo=off' psql
a user or a database. Whenever a session is started, the default a user or a database. Whenever a session is started, the default
settings for the user and database involved are loaded. The settings for the user and database involved are loaded. The
commands <literal>ALTER DATABASE</literal> and <literal>ALTER commands <literal>ALTER DATABASE</literal> and <literal>ALTER
USER</literal>, respectively, are used to set this up. USER</literal>, respectively, are used to configure these.
</para> </para>
<sect2 id="runtime-config-optimizer"> <sect2 id="runtime-config-optimizer">
...@@ -592,11 +584,11 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -592,11 +584,11 @@ env PGOPTIONS='-c geqo=off' psql
<term><varname>EFFECTIVE_CACHE_SIZE</varname> (<type>floating point</type>)</term> <term><varname>EFFECTIVE_CACHE_SIZE</varname> (<type>floating point</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the optimizer's assumption about the effective size of Sets the optimizer's assumption about the effective size of the
the disk cache (that is, the portion of the kernel's disk disk cache (that is, the portion of the kernel's disk cache that
cache that will be used for will be used for <productname>PostgreSQL</productname> data
<productname>PostgreSQL</productname> data files). This is files). This is measured in disk pages, which are normally 8 kB
measured in disk pages, which are normally 8 kB apiece. each.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -606,7 +598,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -606,7 +598,7 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of hash-join plan Enables or disables the query planner's use of hash-join plan
types. The default is on. This is mostly useful to debug the types. The default is on. This is used for debugging the
query planner. query planner.
</para> </para>
</listitem> </listitem>
...@@ -621,7 +613,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -621,7 +613,7 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of index-scan plan Enables or disables the query planner's use of index-scan plan
types. The default is on. This is mostly useful to debug the types. The default is on. This is used to debugging the
query planner. query planner.
</para> </para>
</listitem> </listitem>
...@@ -632,7 +624,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -632,7 +624,7 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of merge-join plan Enables or disables the query planner's use of merge-join plan
types. The default is on. This is mostly useful to debug the types. The default is on. This is used for debugging the
query planner. query planner.
</para> </para>
</listitem> </listitem>
...@@ -642,12 +634,11 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -642,12 +634,11 @@ env PGOPTIONS='-c geqo=off' psql
<term><varname>ENABLE_NESTLOOP</varname> (<type>boolean</type>)</term> <term><varname>ENABLE_NESTLOOP</varname> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of nested-loop Enables or disables the query planner's use of nested-loop join
join plans. It's not possible to suppress nested-loop joins plans. It's not possible to suppress nested-loop joins entirely,
entirely, but turning this variable off discourages the but turning this variable off discourages the planner from using
planner from using one if there is any other method available. one if there are other methods available. The default is
The default is on. This is mostly useful to debug the query on. This is used for debugging the query planner.
planner.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -661,11 +652,10 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -661,11 +652,10 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of sequential scan Enables or disables the query planner's use of sequential scan
plan types. It's not possible to suppress sequential scans plan types. It's not possible to suppress sequential scans
entirely, but turning this variable off discourages the entirely, but turning this variable off discourages the planner
planner from using one if there is any other method available. from using one if there are other methods available. The
The default is on. This is mostly useful to debug the query default is on. This is used for debugging the query planner.
planner.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -677,8 +667,8 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -677,8 +667,8 @@ env PGOPTIONS='-c geqo=off' psql
Enables or disables the query planner's use of explicit sort Enables or disables the query planner's use of explicit sort
steps. It's not possible to suppress explicit sorts entirely, steps. It's not possible to suppress explicit sorts entirely,
but turning this variable off discourages the planner from but turning this variable off discourages the planner from
using one if there is any other method available. The default using one if there are other methods available. The default
is on. This is mostly useful to debug the query planner. is on. This is used for debugging the query planner.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -688,7 +678,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -688,7 +678,7 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables the query planner's use of <acronym>TID</> scan plan Enables or disables the query planner's use of <acronym>TID</> scan plan
types. The default is on. This is mostly useful to debug the types. The default is on. This is used for debugging the
query planner. query planner.
</para> </para>
</listitem> </listitem>
...@@ -707,9 +697,9 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -707,9 +697,9 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Enables or disables genetic query optimization, which is an Enables or disables genetic query optimization, which is an
algorithm that attempts to do query planning without algorithm that attempts to do query planning without exhaustive
exhaustive search. This is on by default. See also the various searching. This is on by default. See also the various other
other <varname>GEQO_</varname> settings. <varname>GEQO_</varname> settings.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -724,20 +714,20 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -724,20 +714,20 @@ env PGOPTIONS='-c geqo=off' psql
<para> <para>
Various tuning parameters for the genetic query optimization Various tuning parameters for the genetic query optimization
algorithm: The pool size is the number of individuals in one algorithm: The pool size is the number of individuals in one
population. Valid values are between 128 and 1024. If it is population. Valid values are between 128 and 1024. If it is set
set to 0 (the default) a pool size of 2^(QS+1), where QS to 0 (the default) a pool size of 2^(QS+1), where QS is the
is the number of FROM items in the query, is taken. The effort number of FROM items in the query, is taken. The effort is used
is used to calculate a default for generations. Valid values to calculate a default for generations. Valid values are between
are between 1 and 80, 40 being the default. Generations 1 and 80, 40 being the default. Generations specifies the number
specifies the number of iterations in the algorithm. The of iterations in the algorithm. The number must be a positive
number must be a positive integer. If 0 is specified then integer. If 0 is specified then <literal>Effort *
<literal>Effort * Log2(PoolSize)</literal> is used. The run time of the algorithm Log2(PoolSize)</literal> is used. The run time of the algorithm
is roughly proportional to the sum of pool size and is roughly proportional to the sum of pool size and generations.
generations. The selection bias is the selective pressure The selection bias is the selective pressure within the
within the population. Values can be from 1.50 to 2.00; the population. Values can be from 1.50 to 2.00; the latter is the
latter is the default. The random seed can be set to get default. The random seed can be set to get reproducible results
reproducible results from the algorithm. If it is set to -1 from the algorithm. If it is set to -1 then the algorithm
then the algorithm behaves non-deterministically. behaves non-deterministically.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -747,11 +737,11 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -747,11 +737,11 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Use genetic query optimization to plan queries with at least Use genetic query optimization to plan queries with at least
this many <literal>FROM</> items involved. (Note that a <literal>JOIN</> construct this many <literal>FROM</> items involved. (Note that a
counts as only one <literal>FROM</> item.) The default is 11. For simpler <literal>JOIN</> construct counts as only one <literal>FROM</>
queries it is usually best to use the item.) The default is 11. For simpler queries it is usually best
deterministic, exhaustive planner. This parameter also controls to use the deterministic, exhaustive planner. This parameter
how hard the optimizer will try to merge subquery also controls how hard the optimizer will try to merge subquery
<literal>FROM</literal> clauses into the upper query. <literal>FROM</literal> clauses into the upper query.
</para> </para>
</listitem> </listitem>
...@@ -763,22 +753,23 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -763,22 +753,23 @@ env PGOPTIONS='-c geqo=off' psql
<para> <para>
The <firstterm>Key Set Query Optimizer</firstterm> The <firstterm>Key Set Query Optimizer</firstterm>
(<acronym>KSQO</acronym>) causes the query planner to convert (<acronym>KSQO</acronym>) causes the query planner to convert
queries whose <literal>WHERE</> clause contains many OR'ed AND clauses queries whose <literal>WHERE</> clause contains many OR'ed AND
(such as <literal>WHERE (a=1 AND b=2) OR (a=2 AND b=3) clauses (such as <literal>WHERE (a=1 AND b=2) OR (a=2 AND b=3)
...</literal>) into a union query. This method can be faster ...</literal>) into a union query. This method can be faster
than the default implementation, but it doesn't necessarily than the default implementation, but it doesn't necessarily give
give exactly the same results, since <literal>UNION</> implicitly adds a exactly the same results, since <literal>UNION</> implicitly
<literal>SELECT DISTINCT</> clause to eliminate identical output rows. adds a <literal>SELECT DISTINCT</> clause to eliminate identical
<acronym>KSQO</acronym> is commonly used when working with products like output rows. <acronym>KSQO</acronym> is commonly used when
<productname>Microsoft Access</productname>, which tend to working with products like <productname>Microsoft
generate queries of this form. Access</productname>, which tend to generate queries of this
form.
</para> </para>
<para> <para>
The <acronym>KSQO</acronym> algorithm used to be absolutely essential for queries The <acronym>KSQO</acronym> algorithm used to be absolutely
with many OR'ed AND clauses, but in essential for queries with many OR'ed AND clauses, but in
<productname>PostgreSQL</productname> 7.0 and later the standard <productname>PostgreSQL</productname> 7.0 and later the standard
planner handles these queries fairly successfully. Hence the planner handles these queries fairly successfully; hence the
default is off. default is off.
</para> </para>
</listitem> </listitem>
...@@ -789,8 +780,8 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -789,8 +780,8 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Sets the query optimizer's estimate of the cost of a Sets the query optimizer's estimate of the cost of a
nonsequentially fetched disk page. This is measured as a nonsequentially fetched disk page. This is measured as a
multiple of the cost of a sequential page fetch. multiple of the cost of a sequential page fetch.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -799,7 +790,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -799,7 +790,7 @@ env PGOPTIONS='-c geqo=off' psql
<note> <note>
<para> <para>
Unfortunately, there is no well-defined method of determining Unfortunately, there is no well-defined method for determining
ideal values for the family of <quote>COST</quote> variables that ideal values for the family of <quote>COST</quote> variables that
were just described. You are encouraged to experiment and share were just described. You are encouraged to experiment and share
your findings. your findings.
...@@ -850,13 +841,14 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -850,13 +841,14 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
Turns on various assertion checks. This is a debugging aid. If Turns on various assertion checks. This is a debugging aid. If
you are experiencing strange problems or crashes you might you are experiencing strange problems or crashes you might want
want to turn this on, as it might expose programming mistakes. to turn this on, as it might expose programming mistakes. To use
To use this option, the macro <literal>USE_ASSERT_CHECKING</literal> this option, the macro <literal>USE_ASSERT_CHECKING</literal>
must be defined when <productname>PostgreSQL</productname> is built (see the configure option must be defined when <productname>PostgreSQL</productname> is
<literal>--enable-cassert</literal>). Note that built (see the configure option
<literal>DEBUG_ASSERTIONS</literal> defaults to on if <productname>PostgreSQL</productname> <literal>--enable-cassert</literal>). Note that
has been built this way. <literal>DEBUG_ASSERTIONS</literal> defaults to on if
<productname>PostgreSQL</productname> has been built this way.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -874,8 +866,6 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -874,8 +866,6 @@ env PGOPTIONS='-c geqo=off' psql
the resulting parse tree, the query rewriter output, or the execution the resulting parse tree, the query rewriter output, or the execution
plan. <option>DEBUG_PRETTY_PRINT</option> indents these displays plan. <option>DEBUG_PRETTY_PRINT</option> indents these displays
to produce a more readable but much longer output format. to produce a more readable but much longer output format.
Setting <option>DEBUG_LEVEL</option> above zero implicitly turns
on some of these flags.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -897,11 +887,10 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -897,11 +887,10 @@ env PGOPTIONS='-c geqo=off' psql
<term><varname>LOG_CONNECTIONS</varname> (<type>boolean</type>)</term> <term><varname>LOG_CONNECTIONS</varname> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>
Prints a line informing about each successful connection in This outputs a line to the server logs detailing each successful
the server log. This is off by default, although it is connection. This is off by default, although it is probably very
probably very useful. This option can only be set at server useful. This option can only be set at server start or in the
start or in the <filename>postgresql.conf</filename> <filename>postgresql.conf</filename> configuration file.
configuration file.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -948,7 +937,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -948,7 +937,7 @@ env PGOPTIONS='-c geqo=off' psql
Shows the outgoing port number of the connecting host in the Shows the outgoing port number of the connecting host in the
connection log messages. You could trace back the port number connection log messages. You could trace back the port number
to find out what user initiated the connection. Other than to find out what user initiated the connection. Other than
that it's pretty useless and therefore off by default. This that, it's pretty useless and therefore off by default. This
option can only be set at server start. option can only be set at server start.
</para> </para>
</listitem> </listitem>
...@@ -974,9 +963,9 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -974,9 +963,9 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
If on, collected statistics are zeroed out whenever the server If on, collected statistics are zeroed out whenever the server
is restarted. If off, statistics are accumulated across server is restarted. If off, statistics are accumulated across server
restarts. The default is on. This option restarts. The default is on. This option can only be set at
can only be set at server start. server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -998,12 +987,13 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -998,12 +987,13 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
<productname>PostgreSQL</productname> allows the use of <productname>PostgreSQL</productname> allows the use of
<systemitem>syslog</systemitem> for logging. If this option <systemitem>syslog</systemitem> for logging. If this option is
is set to 1, messages go both to <systemitem>syslog</> and the standard set to 1, messages go both to <systemitem>syslog</> and the
output. A setting of 2 sends output only to <systemitem>syslog</>. (Some standard output. A setting of 2 sends output only to
messages will still go to the standard output/error.) The <systemitem>syslog</>. (Some messages will still go to the
default is 0, which means <systemitem>syslog</> is off. This option must be standard output/error.) The default is 0, which means
set at server start. <systemitem>syslog</> is off. This option must be set at server
start.
</para> </para>
<para> <para>
To use <systemitem>syslog</>, the build of To use <systemitem>syslog</>, the build of
...@@ -1018,11 +1008,11 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1018,11 +1008,11 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
This option determines the <application>syslog</application> This option determines the <application>syslog</application>
<quote>facility</quote> to be used when <application>syslog</application> is enabled. <quote>facility</quote> to be used when
You may choose from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, <application>syslog</application> is enabled. You may choose
LOCAL5, LOCAL6, LOCAL7; the default is LOCAL0. See also the from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6,
documentation of your system's LOCAL7; the default is LOCAL0. See also the documentation of
<application>syslog</application>. your system's <application>syslog</application>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1031,11 +1021,11 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1031,11 +1021,11 @@ env PGOPTIONS='-c geqo=off' psql
<term><varname>SYSLOG_IDENT</varname> (<type>string</type>)</term> <term><varname>SYSLOG_IDENT</varname> (<type>string</type>)</term>
<listitem> <listitem>
<para> <para>
If logging to <application>syslog</> is enabled, this option determines the If logging to <application>syslog</> is enabled, this option
program name used to identify determines the program name used to identify
<productname>PostgreSQL</productname> messages in <productname>PostgreSQL</productname> messages in
<application>syslog</application> log messages. The default <application>syslog</application> log messages. The default is
is <literal>postgres</literal>. <literal>postgres</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1077,12 +1067,12 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1077,12 +1067,12 @@ env PGOPTIONS='-c geqo=off' psql
<indexterm><primary>timeout</><secondary>authentication</></indexterm> <indexterm><primary>timeout</><secondary>authentication</></indexterm>
<listitem> <listitem>
<para> <para>
Maximum time to complete client authentication, in seconds. Maximum time to complete client authentication, in seconds. If a
If a would-be client has not completed the authentication protocol would-be client has not completed the authentication protocol in
in this much time, the server unceremoniously breaks the connection. this much time, the server breaks the connection. This prevents
This prevents hung clients from occupying a connection indefinitely. hung clients from occupying a connection indefinitely. This
This option can only be set at server start or in the option can only be set at server start or in the
<filename>postgresql.conf</filename> file. <filename>postgresql.conf</filename> file.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1101,21 +1091,20 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1101,21 +1091,20 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
This is the amount of time, in milliseconds, to wait on a lock This is the amount of time, in milliseconds, to wait on a lock
before checking to see if there is a deadlock condition or not. before checking to see if there is a deadlock condition. The
The check for deadlock is relatively slow, so we don't want to check for deadlock is relatively slow, so the server doesn't run
run it every time we wait for a lock. We (optimistically?) it every time it waits for a lock. We (optimistically?) assume
assume that deadlocks are not common in production applications, that deadlocks are not common in production applications and
and just wait on the lock for awhile before starting to ask just wait on the lock for a while before starting check for a
questions about whether it can ever get unlocked. deadlock. Increasing this value reduces the amount of time
Increasing this value reduces the amount of time wasted in wasted in needless deadlock checks, but slows down reporting of
needless deadlock checks, but slows down reporting of real deadlock real deadlock errors. The default is 1000 (i.e., one second),
errors. The default is 1000 (i.e., one second), which is probably which is probably about the smallest value you would want in
about the smallest value you would want in practice. On a heavily practice. On a heavily loaded server you might want to raise it.
loaded server you might want to raise it. Ideally the setting Ideally the setting should exceed your typical transaction time,
should exceed your typical transaction time, so as to improve the so as to improve the odds that the lock will be released before
odds that the lock will be released before the waiter decides to the waiter decides to check for deadlock. This option can only
check for deadlock. be set at server start.
This option can only be set at server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1128,11 +1117,10 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1128,11 +1117,10 @@ env PGOPTIONS='-c geqo=off' psql
<term><varname>DEFAULT_TRANSACTION_ISOLATION</varname> (<type>string</type>)</term> <term><varname>DEFAULT_TRANSACTION_ISOLATION</varname> (<type>string</type>)</term>
<listitem> <listitem>
<para> <para>
Each SQL transaction has an isolation level, which can be Each SQL transaction has an isolation level, which can be either
either <quote>read committed</quote> or <quote>read committed</quote> or <quote>serializable</quote>.
<quote>serializable</quote>. This parameter controls what the This parameter controls the default isolation level of each new
isolation level of each new transaction is set to. The transaction. The default is <quote>read committed/quote>.
default is read committed.
</para> </para>
<para> <para>
...@@ -1150,7 +1138,7 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1150,7 +1138,7 @@ env PGOPTIONS='-c geqo=off' psql
<listitem> <listitem>
<para> <para>
If a dynamically loadable module needs to be opened and the If a dynamically loadable module needs to be opened and the
specified name does not have a directory component (i.e., the specified name does not have a directory component (i.e. the
name does not contain a slash), the system will search this name does not contain a slash), the system will search this
path for the specified file. (The name that is used is the path for the specified file. (The name that is used is the
name specified in the <command>CREATE FUNCTION</command> or name specified in the <command>CREATE FUNCTION</command> or
...@@ -1159,12 +1147,14 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -1159,12 +1147,14 @@ env PGOPTIONS='-c geqo=off' psql
<para> <para>
The value for dynamic_library_path has to be a colon-separated The value for dynamic_library_path has to be a colon-separated
list of absolute directory names. If a directory name starts list of absolute directory names. If a directory name starts
with the special value <literal>$libdir</literal>, the with the special value <literal>$libdir</literal>, the
compiled-in <productname>PostgreSQL</productname> package library directory, which is where the compiled-in <productname>PostgreSQL</productname> package
modules provided by the <productname>PostgreSQL</productname> distribution are installed, library directory is substituted. This where the modules
is substituted. (Use <literal>pg_config --pkglibdir</literal> provided by the <productname>PostgreSQL</productname>
to print the name of this directory.) An example value: distribution are installed. (Use <literal>pg_config
--pkglibdir</literal> to print the name of this directory.) For
example:
<informalexample> <informalexample>
<programlisting> <programlisting>
dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
...@@ -1174,17 +1164,17 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1174,17 +1164,17 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<para> <para>
The default value for this parameter is The default value for this parameter is
<literal>$libdir</literal>. If the value is set to the empty <literal>$libdir</literal>. If the value is set to an empty
string, the automatic path search is turned off. string, the automatic path search is turned off.
</para> </para>
<para> <para>
This parameter can be changed at run time by superusers, but This parameter can be changed at run time by superusers, but a
note that a setting done that way will only persist till the setting done that way will only persist until the end of the
end of the client connection, so this method should be client connection, so this method should be reserved for
reserved for development purposes. The recommended way to set development purposes. The recommended way to set this parameter
this parameter is in the <filename>postgresql.conf</filename> is in the <filename>postgresql.conf</filename> configuration
configuration file. file.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1198,44 +1188,42 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1198,44 +1188,42 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
If this option is on, the <productname>PostgreSQL</> backend If this option is on, the <productname>PostgreSQL</> backend
will use the <function>fsync()</> system call in several will use the <function>fsync()</> system call in several places
places to make sure that updates are physically written to to make sure that updates are physically written to disk. This
disk and do not hang around in the kernel buffer cache. This insures that a database installation will recover to a
increases the chance by a large amount that a database consistent state after an operating system or hardware crash.
installation will still be usable after an operating system or (Crashes of the database server itself are <emphasis>not</>
hardware crash. (Crashes of the database server itself do related to this.)
<emphasis>not</> affect this consideration.)
</para> </para>
<para> <para>
However, this operation slows down <productname>PostgreSQL</>, However, this operation does slow down
because at all those points it has <productname>PostgreSQL</> because at transaction commit it has
to block and wait for the operating system to flush the wait for the operating system to flush the write-ahead log.
buffers. Without <function>fsync</>, the operating system is Without <function>fsync</>, the operating system is allowed to
allowed to do its best in buffering, sorting, and delaying do its best in buffering, sorting, and delaying writes, which
writes, which can make for a considerable performance can considerably increase performance. However, if the system
increase. However, if the system crashes, the results of the crashes, the results of the last few committed transactions may
last few committed transactions may be lost in part or whole; be lost in part or whole. In the worst case, unrecoverable data
in the worst case, unrecoverable data corruption may occur. corruption may occur.
</para> </para>
<para> <para>
This option is the subject of an eternal debate in the For the above reasons, some administrators always leave it off,
<productname>PostgreSQL</> user and developer communities. Some some turn it off only for bulk loads, where there is a clear
always leave it off, some turn it off only for bulk loads, restart point if something goes wrong, and some leave it on just
where there is a clear restart point if something goes wrong, to be on the safe side. Because it is always safe, the default
some leave it on just to be on the safe side. Because it is is on. If you trust your operating system, your hardware, and
the safe side, on is also the default. If you trust your your utility company (or better your UPS), you might want to
operating system, your hardware, and your utility company (or disable <varname>fsync</varname>.
better your UPS), you might want to disable <varname>fsync</varname>.
</para> </para>
<para> <para>
It should be noted that the performance penalty from doing It should be noted that the performance penalty of doing
<function>fsync</>s is considerably less in <productname>PostgreSQL</> version <function>fsync</>s is considerably less in
7.1 than it was in prior releases. If you previously suppressed <productname>PostgreSQL</> version 7.1 and later. If you
<function>fsync</>s because of performance problems, you may wish to reconsider previously suppressed <function>fsync</>s for performance
your choice. reasons, you may wish to reconsider your choice.
</para> </para>
<para> <para>
...@@ -1259,9 +1247,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1259,9 +1247,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>MAX_CONNECTIONS</varname> (<type>integer</type>)</term> <term><varname>MAX_CONNECTIONS</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Determines how many concurrent connections the database server Determines the maximum number of concurrent connections to the
will allow. The default is 32 (unless altered while building database server. The default is 32 (unless altered while
the server). This parameter can only be set at server start. building the server). This parameter can only be set at server
start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1270,11 +1259,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1270,11 +1259,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>MAX_EXPR_DEPTH</varname> (<type>integer</type>)</term> <term><varname>MAX_EXPR_DEPTH</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the maximum expression nesting depth that the parser will Sets the maximum expression nesting depth of the parser. The
accept. The default value is high enough for any normal query, default value is high enough for any normal query, but you can
but you can raise it if you need to. (But if you raise it too raise it if needed. (But if you raise it too high, you run
high, you run the risk of backend crashes due to stack the risk of backend crashes due to stack overflow.)
overflow.)
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1283,21 +1271,20 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1283,21 +1271,20 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>MAX_FILES_PER_PROCESS</varname> (<type>integer</type>)</term> <term><varname>MAX_FILES_PER_PROCESS</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the maximum number of simultaneously open files in each server Sets the maximum number of simultaneously open files in each
subprocess. The default is 1000. The limit actually used by the code server subprocess. The default is 1000. The limit actually used
is the smaller of this setting and the result of by the code is the smaller of this setting and the result of
<literal>sysconf(_SC_OPEN_MAX)</literal>. <literal>sysconf(_SC_OPEN_MAX)</literal>. Therefore, on systems
Therefore, on systems where <function>sysconf</> returns a reasonable limit, where <function>sysconf</> returns a reasonable limit, you don't
you don't need to worry about this setting. But on some platforms need to worry about this setting. But on some platforms
(notably, most BSD systems), <function>sysconf</> returns a value that is much (notably, most BSD systems), <function>sysconf</> returns a
larger than the system can really support when a large number of value that is much larger than the system can really support
processes all try to open that many files. If you find yourself when a large number of processes all try to open that many
seeing <quote>Too many open files</> failures, try reducing this files. If you find yourself seeing <quote>Too many open files</>
setting. failures, try reducing this setting. This option can only be set
This option can only be set at server start or in the at server start or in the <filename>postgresql.conf</filename>
<filename>postgresql.conf</filename> configuration file; configuration file; if changed in the configuration file, it
if changed in the configuration file, it only affects only affects subsequently-started server subprocesses.
subsequently-started server subprocesses.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1306,9 +1293,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1306,9 +1293,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>MAX_FSM_RELATIONS</varname> (<type>integer</type>)</term> <term><varname>MAX_FSM_RELATIONS</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the maximum number of relations (tables) for which free space Sets the maximum number of relations (tables) for which free
will be tracked in the shared free-space map. space will be tracked in the shared free-space map. The default
The default is 100. This option can only be set at server start. is 100. This option can only be set at server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1317,9 +1304,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1317,9 +1304,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>MAX_FSM_PAGES</varname> (<type>integer</type>)</term> <term><varname>MAX_FSM_PAGES</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the maximum number of disk pages for which free space Sets the maximum number of disk pages for which free space will
will be tracked in the shared free-space map. be tracked in the shared free-space map. The default is 10000.
The default is 10000. This option can only be set at server start. This option can only be set at server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1329,11 +1316,12 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1329,11 +1316,12 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
The shared lock table is sized on the assumption that at most The shared lock table is sized on the assumption that at most
<varname>max_locks_per_transaction</> * <varname>max_connections</varname> distinct objects will need <varname>max_locks_per_transaction</> *
to be locked at any one time. The default, 64, has historically <varname>max_connections</varname> distinct objects will need to
proven sufficient, but you might need to raise this value if you be locked at any one time. The default, 64, which has historically
have clients that touch many different tables in a single transaction. proven sufficient, but you might need to raise this value if you
This option can only be set at server start. have clients that touch many different tables in a single
transaction. This option can only be set at server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1343,11 +1331,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1343,11 +1331,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
When a password is specified in <command>CREATE USER</> or When a password is specified in <command>CREATE USER</> or
<command>ALTER USER</> without writing either ENCRYPTED or <command>ALTER USER</> without writing either ENCRYPTED or
UNENCRYPTED, this flag determines whether the password is to be UNENCRYPTED, this flag determines whether the password is to be
encrypted. encrypted. The default is off (do not encrypt the password), but
The default is off (do not encrypt the password), but this choice this choice may change in a future release.
may change in a future release.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1367,9 +1354,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1367,9 +1354,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>SHARED_BUFFERS</varname> (<type>integer</type>)</term> <term><varname>SHARED_BUFFERS</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Sets the number of shared memory buffers the database server Sets the number of shared memory buffers used by the database
will use. The default is 64. Each buffer is typically 8192 server. The default is 64. Each buffer is typically 8192 bytes.
bytes. This option can only be set at server start. This option can only be set at server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1378,13 +1365,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1378,13 +1365,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>SILENT_MODE</varname> (<type>bool</type>)</term> <term><varname>SILENT_MODE</varname> (<type>bool</type>)</term>
<listitem> <listitem>
<para> <para>
Runs postmaster silently. If this option is set, postmaster Runs postmaster silently. If this option is set, the postmaster
will automatically run in background and any controlling ttys will automatically run in background and any controlling ttys
are disassociated, thus no messages are written to standard output or are disassociated, thus no messages are written to standard
standard error (same effect as postmaster's -S option). Unless some output or standard error (same effect as postmaster's -S
logging system such as <application>syslog</> is enabled, using this option is option). Unless some logging system such as
discouraged since it makes it impossible to see error <application>syslog</> is enabled, using this option is
messages. discouraged since it makes it impossible to see error messages.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1393,15 +1380,15 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1393,15 +1380,15 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>SORT_MEM</varname> (<type>integer</type>)</term> <term><varname>SORT_MEM</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Specifies the amount of memory to be used by internal sorts Specifies the amount of memory to be used by internal sorts and
and hashes before switching to temporary disk files. The value hashes before switching to temporary disk files. The value is
is specified in kilobytes, and defaults to 512 kilobytes. Note specified in kilobytes, and defaults to 512 kilobytes. Note that
that for a complex query, several sorts and/or hashes might be for a complex query, several sorts and/or hashes might be
running in parallel, and each one will be allowed to use as running in parallel, and each one will be allowed to use as much
much memory as this value specifies before it starts to put memory as this value specifies before it starts to put data into
data into temporary files. And don't forget that each running temporary files. Also, each running backend could be doing one
backend could be doing one or more sorts. So the total memory or more sorts simultaneously, so the total memory used could be
space needed could be many times the value of <varname>SORT_MEM</varname>. many times the value of <varname>SORT_MEM</varname>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1412,14 +1399,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1412,14 +1399,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
This controls the inheritance semantics, in particular whether This controls the inheritance semantics, in particular whether
subtables are included into the consideration of various subtables are included by various commands by default. They were
commands by default. This was not the case in versions prior not included in versions prior to 7.1. If you need the old
to 7.1. If you need the old behavior you can set this behavior you can set this variable to off, but in the long run
variable to off, but in the long run you are encouraged to you are encouraged to change your applications to use the
change your applications to use the <literal>ONLY</literal> <literal>ONLY</literal> keyword to exclude subtables. See the
keyword to exclude subtables. See the SQL language reference SQL language reference and the <citetitle>User's
and the <citetitle>User's Guide</citetitle> for more Guide</citetitle> for more information about inheritance.
information about inheritance.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1443,10 +1429,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1443,10 +1429,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>TCPIP_SOCKET</varname> (<type>boolean</type>)</term> <term><varname>TCPIP_SOCKET</varname> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>
If this is true, then the server will accept TCP/IP If this is true, then the server will accept TCP/IP connections.
connections. Otherwise only local Unix domain socket Otherwise only local Unix domain socket connections are
connections are accepted. It is off by default. This option accepted. It is off by default. This option can only be set at
can only be set at server start. server start.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1457,13 +1443,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1457,13 +1443,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
When turned on, expressions of the form When turned on, expressions of the form
<literal><replaceable>expr</> = NULL</literal> (or <literal><replaceable>expr</> = NULL</literal> (or <literal>NULL
<literal>NULL = <replaceable>expr</></literal>) are treated as = <replaceable>expr</></literal>) are treated as
<literal><replaceable>expr</> IS NULL</literal>, that is, they <literal><replaceable>expr</> IS NULL</literal>, that is, they
return true if <replaceable>expr</> evaluates to the NULL return true if <replaceable>expr</> evaluates to the NULL value,
value, and false otherwise. The correct behavior of and false otherwise. The correct behavior of
<literal><replaceable>expr</> = NULL</literal> is to always <literal><replaceable>expr</> = NULL</literal> is to always
return NULL (unknown). Therefore this option defaults to off. return NULL (unknown). Therefore this option defaults to off.
</para> </para>
<para> <para>
...@@ -1477,7 +1463,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1477,7 +1463,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
very useful and do not appear often in normal applications, so very useful and do not appear often in normal applications, so
this option does little harm in practice. But new users are this option does little harm in practice. But new users are
frequently confused about the semantics of expressions frequently confused about the semantics of expressions
involving NULL, so we do not turn this option on by default. involving NULL, so this option is not on by default.
</para> </para>
<para> <para>
...@@ -1538,16 +1524,16 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1538,16 +1524,16 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<para> <para>
The default permissions are <literal>0777</literal>, meaning The default permissions are <literal>0777</literal>, meaning
anyone can connect. Reasonable alternatives would be anyone can connect. Reasonable alternatives are
<literal>0770</literal> (only user and group, see also under <literal>0770</literal> (only user and group, see also under
<option>UNIX_SOCKET_GROUP</option>) and <option>UNIX_SOCKET_GROUP</option>) and <literal>0700</literal>
<literal>0700</literal> (only user). (Note that actually for (only user). (Note that actually for a Unix socket, only write
a Unix socket, only write permission matters and there is no permission matters and there is no point in setting or revoking
point in setting or revoking read or execute permissions.) read or execute permissions.)
</para> </para>
<para> <para>
This access control mechanism is independent from the one This access control mechanism is independent of the one
described in <xref linkend="client-authentication">. described in <xref linkend="client-authentication">.
</para> </para>
...@@ -1562,10 +1548,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1562,10 +1548,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
Specifies the maximum amount of memory to be used by Specifies the maximum amount of memory to be used by
<command>VACUUM</command> to keep track of to-be-reclaimed tuples. <command>VACUUM</command> to keep track of to-be-reclaimed
The value is specified in kilobytes, and defaults to 8192 kilobytes. tuples. The value is specified in kilobytes, and defaults to
Larger settings may improve the speed of vacuuming large tables 8192 kilobytes. Larger settings may improve the speed of
that have many deleted tuples. vacuuming large tables that have many deleted tuples.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1576,8 +1562,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1576,8 +1562,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<para> <para>
Specifies the TCP/IP host name or address on which the Specifies the TCP/IP host name or address on which the
<application>postmaster</application> is to listen for <application>postmaster</application> is to listen for
connections from client applications. Defaults to connections from client applications. Defaults to listening on
listening on all configured addresses (including <systemitem class="systemname">localhost</>). all configured addresses (including <systemitem
class="systemname">localhost</>).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1622,14 +1609,15 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1622,14 +1609,15 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
Time delay between writing a commit record to the WAL buffer and Time delay between writing a commit record to the WAL buffer and
flushing the buffer out to disk, in microseconds. A nonzero delay flushing the buffer out to disk, in microseconds. A nonzero
allows multiple transactions to be committed with only one <function>fsync</function> system call, delay allows multiple transactions to be committed with only one
if system load is high enough that additional transactions become <function>fsync</function> system call, if system load is high
ready to commit within the given interval. But the delay is just enough additional transactions may become ready to commit within
wasted time if no other transactions become ready to commit. the given interval. But the delay is just wasted if no other
Therefore, the delay is only performed if at least COMMIT_SIBLINGS transactions become ready to commit. Therefore, the delay is
other transactions are active at the instant that a backend has only performed if at least COMMIT_SIBLINGS other transactions
written its commit record. are active at the instant that a backend has written its commit
record.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1639,9 +1627,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1639,9 +1627,9 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<listitem> <listitem>
<para> <para>
Minimum number of concurrent open transactions to require before Minimum number of concurrent open transactions to require before
performing the <varname>COMMIT_DELAY</> delay. A larger value makes it more performing the <varname>COMMIT_DELAY</> delay. A larger value
probable that at least one other transaction will become ready to makes it more probable that at least one other transaction will
commit during the delay interval. become ready to commit during the delay interval.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1650,7 +1638,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1650,7 +1638,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<term><varname>WAL_BUFFERS</varname> (<type>integer</type>)</term> <term><varname>WAL_BUFFERS</varname> (<type>integer</type>)</term>
<listitem> <listitem>
<para> <para>
Number of disk-page buffers in shared memory for WAL log. Number of disk-page buffers in shared memory for WAL logging.
This option can only be set at server start. This option can only be set at server start.
</para> </para>
</listitem> </listitem>
...@@ -1724,7 +1712,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -1724,7 +1712,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
</row> </row>
<row> <row>
<entry><option>-d <replaceable>x</replaceable></option></entry> <entry><option>-d <replaceable>x</replaceable></option></entry>
<entry><literal>debug_level = <replaceable>x</replaceable></></entry> <entry><literal>server_min_messages = <replaceable>DEBUGx</replaceable></></entry>
<entry></entry> <entry></entry>
</row> </row>
<row> <row>
...@@ -1806,11 +1794,11 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -1806,11 +1794,11 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<title>Managing Kernel Resources</title> <title>Managing Kernel Resources</title>
<para> <para>
A large <productname>PostgreSQL</> installation can quickly hit A large <productname>PostgreSQL</> installation can quickly exhaust
various operating system resource limits. (On some systems, the various operating system resource limits. (On some systems, the
factory defaults are so low that you don't even need a really factory defaults are so low that you don't even need a really
<quote>large</> installation.) If you have encountered this kind of <quote>large</> installation.) If you have encountered this kind of
problem then keep reading. problem, keep reading.
</para> </para>
<sect2 id="sysvipc"> <sect2 id="sysvipc">
...@@ -1826,13 +1814,14 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -1826,13 +1814,14 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<para> <para>
Shared memory and semaphores are collectively referred to as Shared memory and semaphores are collectively referred to as
<quote><systemitem class="osname">System V</> <acronym>IPC</></quote> (together with message queues, which are <quote><systemitem class="osname">System V</>
not relevant for <productname>PostgreSQL</>). Almost all modern <acronym>IPC</></quote> (together with message queues, which are not
relevant for <productname>PostgreSQL</>). Almost all modern
operating systems provide these features, but not all of them have operating systems provide these features, but not all of them have
them turned on or sufficiently sized by default, especially them turned on or sufficiently sized by default, especially systems
systems with BSD heritage. (For the <systemitem class="osname">QNX</> and <systemitem class="osname">BeOS</> ports, with BSD heritage. (For the <systemitem class="osname">QNX</> and
<productname>PostgreSQL</> provides its own replacement <systemitem class="osname">BeOS</> ports, <productname>PostgreSQL</>
implementation of these facilities.) provides its own replacement implementation of these facilities.)
</para> </para>
<para> <para>
...@@ -1844,17 +1833,15 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -1844,17 +1833,15 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<para> <para>
When <productname>PostgreSQL</> exceeds one of the various hard When <productname>PostgreSQL</> exceeds one of the various hard
limits of the <acronym>IPC</> resources then the postmaster will refuse to <acronym>IPC</> limits, the postmaster will refuse to start and
start up and should leave a marginally instructive error message should leave an instructive error message describing the problem
about which problem was encountered and what needs to be done encountered and what to do about it. (See also <xref
about it. (See also <xref linkend="postmaster-start-failures">.) linkend="postmaster-start-failures">.) The relevant kernel
The relevant kernel parameters are named parameters are named consistently across different systems; <xref
consistently across different systems; <xref linkend="sysvipc-parameters"> gives an overview. The methods to set
linkend="sysvipc-parameters"> gives an overview. The methods to them, however, vary. Suggestions for some platforms are given below.
set them, however, vary; suggestions for some platforms are given Be warned that it is often necessary to reboot your machine, and
below. Be warned that it is often necessary to reboot your possibly even recompile the kernel, to change these settings.
machine at least, possibly even recompile the kernel, to change these
settings.
</para> </para>
...@@ -1937,27 +1924,26 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -1937,27 +1924,26 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<para> <para>
<indexterm><primary>SHMMAX</primary></indexterm> <indexterm><primary>SHMMAX</primary></indexterm> The most important
The most important shared memory parameter is <varname>SHMMAX</>, shared memory parameter is <varname>SHMMAX</>, the maximum size, in
the maximum size, in bytes, that a shared memory segment can have. bytes, of a shared memory segment. If you get an error message from
If you get an error message from <function>shmget</> along the <function>shmget</> like <errorname>Invalid argument</>, it is
lines of <errorname>Invalid argument</> then it is possible that possible that this limit has been exceeded. The size of the required
this limit has been exceeded. The size of the required shared shared memory segment varies both with the number of requested
memory segments varies both with the number of requested buffers buffers (<option>-B</> option) and the number of allowed connections
(<option>-B</> option) and the number of allowed connections (<option>-N</> option), although the former is the most significant.
(<option>-N</> option), although the former is the dominant item. (You can, as a temporary solution, lower these settings to eliminate
(You can therefore, as a temporary solution, lower these settings the failure.) As a rough approximation, you can estimate the
to get rid of the failures.) As a rough approximation you can required segment size by multiplying the number of buffers and the
estimate the required segment size as the number of buffers times block size (8 kB by default) plus ample overhead (at least half a
the block size (8 kB by default) plus ample overhead (at least megabyte). Any error message you might get will contain the size of
half a megabyte). Any error message you might get will contain the the failed allocation request.
size of the failed allocation request.
</para> </para>
<para> <para>
Less likely to cause problems is the minimum size for shared Less likely to cause problems is the minimum size for shared
memory segments (<varname>SHMMIN</>), which should be at most memory segments (<varname>SHMMIN</>), which should be at most
somewhere around 256 kB for <productname>PostgreSQL</> (it is approximately 256 kB for <productname>PostgreSQL</> (it is
usually just 1). The maximum number of segments system-wide usually just 1). The maximum number of segments system-wide
(<varname>SHMMNI</>) or per-process (<varname>SHMSEG</>) should (<varname>SHMMNI</>) or per-process (<varname>SHMSEG</>) should
not cause a problem unless your system has them set to zero. Some not cause a problem unless your system has them set to zero. Some
...@@ -1984,16 +1970,16 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -1984,16 +1970,16 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
</para> </para>
<para> <para>
In some cases it might also turn out to be necessary to increase In some cases it might also be necessary to increase
<varname>SEMMAP</> to be at least on the order of <varname>SEMMAP</> to be at least on the order of
<varname>SEMMNS</>. This parameter defines the size of the <varname>SEMMNS</>. This parameter defines the size of the semaphore
semaphore resource map, in which each contiguous block of available resource map, in which each contiguous block of available semaphores
semaphores needs an entry. When a semaphore set is freed it is needs an entry. When a semaphore set is freed it is either added to
either added to an existing entry that is adjacent to the freed an existing entry that is adjacent to the freed block or it is
block or it is registered under a new map entry. If the map is registered under a new map entry. If the map is full, the freed
full, the freed semaphores get lost (until reboot). Fragmentation semaphores get lost (until reboot). Fragmentation of the semaphore
of the semaphore space could therefore over time lead to less space could over time lead to fewer available semaphores than there
available semaphores than there should be. should be.
</para> </para>
<para> <para>
...@@ -2021,12 +2007,11 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -2021,12 +2007,11 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<para> <para>
By default, only 4 MB of shared memory is supported. Keep in By default, only 4 MB of shared memory is supported. Keep in
mind that shared memory is not pageable; it is locked in RAM. mind that shared memory is not pageable; it is locked in RAM.
To increase the number of shared buffers supported by the
To increase the number of shared buffers supported by the postmaster, add the following to your kernel configuration
postmaster, add the following to your kernel configuration file. A file. A <varname>SHMALL</> value of 1024 represents 4MB of
<varname>SHMALL</> value of 1024 represents 4MB of shared shared memory. The following increases the maximum shared
memory. The following increases the maximum shared memory area memory area to 32 MB:
to 32 MB:
<programlisting> <programlisting>
options "SHMALL=8192" options "SHMALL=8192"
options "SHMMAX=\(SHMALL*PAGE_SIZE\)" options "SHMMAX=\(SHMALL*PAGE_SIZE\)"
...@@ -2057,9 +2042,9 @@ options "SYSPTSIZE=16" ...@@ -2057,9 +2042,9 @@ options "SYSPTSIZE=16"
<formalpara> <formalpara>
<title>Semaphores</> <title>Semaphores</>
<para> <para>
You may need to increase the number of semaphores. By You may need to increase the number of semaphores. By default,
default, <productname>PostgreSQL</> allocates 34 semaphores, <productname>PostgreSQL</> allocates 34 semaphores, which is
which is over half the default system total of 60. over half the default system total of 60.
</para> </para>
</formalpara> </formalpara>
...@@ -2105,6 +2090,10 @@ options SEMMAP=256 ...@@ -2105,6 +2090,10 @@ options SEMMAP=256
class="osname">OpenBSD</> the key word is actually class="osname">OpenBSD</> the key word is actually
<literal>option</literal> singular.) <literal>option</literal> singular.)
</para> </para>
<para>
You may also want to use the <application>sysctl</> setting to
lock shared memory into RAM and prevent it from being paged out
to swap.
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2123,8 +2112,8 @@ options SEMMAP=256 ...@@ -2123,8 +2112,8 @@ options SEMMAP=256
<acronym>IPC</> parameters can be set in the <application>System <acronym>IPC</> parameters can be set in the <application>System
Administration Manager</> (<acronym>SAM</>) under Administration Manager</> (<acronym>SAM</>) under
<menuchoice><guimenu>Kernel <menuchoice><guimenu>Kernel
Configuration</><guimenuitem>Configurable Parameters</></>. Configuration</><guimenuitem>Configurable Parameters</></>. Hit
Hit <guibutton>Create A New Kernel</> when you're done. <guibutton>Create A New Kernel</> when you're done.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2164,10 +2153,10 @@ kernel.shmmax = 134217728 ...@@ -2164,10 +2153,10 @@ kernel.shmmax = 134217728
</para> </para>
<para> <para>
Other parameters are sufficiently sized for any application. Other parameters are sufficiently sized for any application. If
If you want to see for yourself look into you want to see for yourself look in
<filename>/usr/src/linux/include/asm-<replaceable>xxx</>/shmparam.h</> <filename>/usr/src/linux/include/asm-<replaceable>xxx</>/shmpara
and <filename>/usr/src/linux/include/linux/sem.h</>. m.h</> and <filename>/usr/src/linux/include/linux/sem.h</>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2180,7 +2169,7 @@ kernel.shmmax = 134217728 ...@@ -2180,7 +2169,7 @@ kernel.shmmax = 134217728
<para> <para>
In the default configuration, only 512 kB of shared memory per In the default configuration, only 512 kB of shared memory per
segment is allowed, which is about enough for <option>-B 24 -N segment is allowed, which is about enough for <option>-B 24 -N
12</>. To increase the setting, first change the directory to 12</>. To increase the setting, first change directory to
<filename>/etc/conf/cf.d</>. To display the current value of <filename>/etc/conf/cf.d</>. To display the current value of
<varname>SHMMAX</>, in bytes, run <varname>SHMMAX</>, in bytes, run
<programlisting> <programlisting>
...@@ -2206,8 +2195,8 @@ kernel.shmmax = 134217728 ...@@ -2206,8 +2195,8 @@ kernel.shmmax = 134217728
<indexterm><primary>Solaris</></> <indexterm><primary>Solaris</></>
<listitem> <listitem>
<para> <para>
At least in version 2.6, the maximum size of a shared memory At least in version 2.6, the default maximum size of a shared
segment is set too low for <productname>PostgreSQL</>. The memory segments is too low for <productname>PostgreSQL</>. The
relevant settings can be changed in <filename>/etc/system</>, relevant settings can be changed in <filename>/etc/system</>,
for example: for example:
<programlisting> <programlisting>
...@@ -2221,7 +2210,7 @@ set semsys:seminfo_semmni=512 ...@@ -2221,7 +2210,7 @@ set semsys:seminfo_semmni=512
set semsys:seminfo_semmns=512 set semsys:seminfo_semmns=512
set semsys:seminfo_semmsl=32 set semsys:seminfo_semmsl=32
</programlisting> </programlisting>
You need to reboot to make the changes effective. You need to reboot for the changes to take effect.
</para> </para>
<para> <para>
...@@ -2273,27 +2262,26 @@ set semsys:seminfo_semmsl=32 ...@@ -2273,27 +2262,26 @@ set semsys:seminfo_semmsl=32
<title>Resource Limits</title> <title>Resource Limits</title>
<para> <para>
Unix-like operating systems enforce various kinds of resource Unix-like operating systems enforce various kinds of resource limits
limits that might interfere with the operation of your that might interfere with the operation of your
<productname>PostgreSQL</productname> server. Of importance are <productname>PostgreSQL</productname> server. Of particular
especially the limits on the number of processes per user, the importance are limits on the number of processes per user, the
number of open files per process, and the amount of memory number of open files per process, and the amount of memory available
available to a process. Each of these have a <quote>hard</quote> to each process. Each of these have a <quote>hard</quote> and a
and a <quote>soft</quote> limit. The soft limit is what actually <quote>soft</quote> limit. The soft limit is what actually counts
counts but it can be changed by the user up to the hard limit. but it can be changed by the user up to the hard limit. The hard
The hard limit can only be changed by the root user. The system limit can only be changed by the root user. The system call
call <function>setrlimit</function> is responsible for setting <function>setrlimit</function> is responsible for setting these
these parameters. The shell's built-in command parameters. The shell's built-in command <command>ulimit</command>
<command>ulimit</command> (Bourne shells) or (Bourne shells) or <command>limit</command> (<application>csh</>) is
<command>limit</command> (<application>csh</>) is used to control the resource used to control the resource limits from the command line. On
limits from the command line. On BSD-derived systems the file BSD-derived systems the file <filename>/etc/login.conf</filename>
<filename>/etc/login.conf</filename> controls what values the controls the various resource limits set during login. See
various resource limits are set to upon login. See
<citerefentry><refentrytitle>login.conf</refentrytitle> <citerefentry><refentrytitle>login.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for details. The relevant <manvolnum>5</manvolnum></citerefentry> for details. The relevant
parameters are <varname>maxproc</varname>, parameters are <varname>maxproc</varname>,
<varname>openfiles</varname>, and <varname>datasize</varname>. <varname>openfiles</varname>, and <varname>datasize</varname>. For
For example: example:
<programlisting> <programlisting>
default:\ default:\
... ...
...@@ -2307,8 +2295,7 @@ default:\ ...@@ -2307,8 +2295,7 @@ default:\
</para> </para>
<para> <para>
Kernels generally also have an implementation-dependent Kernels can also have system-wide limits on some resources.
system-wide limit on some resources.
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
...@@ -2345,12 +2332,12 @@ default:\ ...@@ -2345,12 +2332,12 @@ default:\
<para> <para>
On the other side of the coin, some systems allow individual On the other side of the coin, some systems allow individual
processes to open large numbers of files; if more than a few processes processes to open large numbers of files; if more than a few
do so then the system-wide limit can easily be exceeded. If you find processes do so then the system-wide limit can easily be exceeded.
this happening, and don't want to alter the system-wide limit, you If you find this happening, and don't want to alter the system-wide
can set <productname>PostgreSQL</productname>'s limit, you can set <productname>PostgreSQL</productname>'s
<varname>max_files_per_process</varname> configuration parameter <varname>max_files_per_process</varname> configuration parameter to
to limit its consumption of open files. limit the consumption of open files.
</para> </para>
</sect2> </sect2>
...@@ -2361,19 +2348,19 @@ default:\ ...@@ -2361,19 +2348,19 @@ default:\
<title>Shutting down the server</title> <title>Shutting down the server</title>
<para> <para>
Depending on your needs, there are several ways to shut down the There are several ways to shut down the database server. You control
database server when your work is done. The differentiation is the type of shutdown by sending different signals to the server
done by what signal you send to the server process. process.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><systemitem>SIGTERM</systemitem></term> <term><systemitem>SIGTERM</systemitem></term>
<listitem> <listitem>
<para> <para>
After receiving <systemitem>SIGTERM</systemitem>, the postmaster disallows new After receiving <systemitem>SIGTERM</systemitem>, the postmaster
connections, but lets existing backends end their work normally. disallows new connections, but lets existing backends end their
It shuts down only after all of the backends terminate by client work normally. It shuts down only after all of the backends
request. terminate normally. This is <firstterm>Smart
This is the <firstterm>Smart Shutdown</firstterm>. Shutdown</firstterm>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2383,10 +2370,10 @@ default:\ ...@@ -2383,10 +2370,10 @@ default:\
<listitem> <listitem>
<para> <para>
The postmaster disallows new connections and sends all existing The postmaster disallows new connections and sends all existing
backends <systemitem>SIGTERM</systemitem>, which will cause them to abort their current backends <systemitem>SIGTERM</systemitem>, which will cause them
transactions and exit promptly. It then waits for the backends to exit to abort their current transactions and exit promptly. It then
and finally shuts down the data base. waits for the backends to exit and finally shuts down. This is
This is the <firstterm>Fast Shutdown</firstterm>. <firstterm>Fast Shutdown</firstterm>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2394,13 +2381,14 @@ default:\ ...@@ -2394,13 +2381,14 @@ default:\
<varlistentry> <varlistentry>
<term><systemitem>SIGQUIT</systemitem></term> <term><systemitem>SIGQUIT</systemitem></term>
<listitem> <listitem>
<para> <para> This is <firstterm>Immediate Shutdown</firstterm>, which
This is the <firstterm>Immediate Shutdown</firstterm> which will cause the postmaster to send a
will cause the postmaster to send a <systemitem>SIGQUIT</systemitem> to all backends and <systemitem>SIGQUIT</systemitem> to all backends and exit
exit immediately (without properly shutting down the database immediately (without properly shutting itself down). The backends
system). The backends likewise exit immediately upon receiving likewise exit immediately upon receiving
<systemitem>SIGQUIT</systemitem>. This will lead to recovery (by replaying the WAL log) <systemitem>SIGQUIT</systemitem>. This will lead to recovery (by
upon next start-up. This is recommended only in emergencies. replaying the WAL log) upon next start-up. This is recommended
only in emergencies.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2408,9 +2396,10 @@ default:\ ...@@ -2408,9 +2396,10 @@ default:\
<important> <important>
<para> <para>
It is best not to use <systemitem>SIGKILL</systemitem> to shut down the postmaster. This It is best not to use <systemitem>SIGKILL</systemitem> to shut down
will prevent the postmaster from releasing shared memory and the postmaster. This will prevent the postmaster from releasing
semaphores, which you may then have to do by hand. shared memory and semaphores, which may then have to be done by
manually.
</para> </para>
</important> </important>
...@@ -2437,11 +2426,11 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput ...@@ -2437,11 +2426,11 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
</indexterm> </indexterm>
<para> <para>
<productname>PostgreSQL</> has native support for connections over <productname>PostgreSQL</> has native support for using
<acronym>SSL</> to encrypt <acronym>SSL</> connections to encrypt client/server communications
client/server communications for increased security. This requires for increased security. This requires
<productname>OpenSSL</productname> to be installed on both client <productname>OpenSSL</productname> be installed on both client and
and server systems and support enabled at build time (see <xref server systems and support enabled at build time (see <xref
linkend="installation">). linkend="installation">).
</para> </para>
...@@ -2458,30 +2447,30 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput ...@@ -2458,30 +2447,30 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
</para> </para>
<para> <para>
The server will listen for both standard and SSL connections The server will listen for both standard and SSL connections on the
on the same TCP/IP port, and will negotiate with any connecting same TCP/IP port, and will negotiate with any connecting client on
client whether or not to use SSL. whether to use SSL. See <xref linkend="client-authentication"> about
See <xref linkend="client-authentication"> how to force the server to only use of SSL for certain connections.
about how to force on the server side the use of SSL for certain
connections.
</para> </para>
<para> <para>
For details on how to create your server private key and certificate, For details on how to create your server private key and certificate,
refer to the <productname>OpenSSL</> documentation. A simple self-signed refer to the <productname>OpenSSL</> documentation. A simple
certificate can be used to get started for testing, but a certificate signed self-signed certificate can be used to get started for testing, but a
by a <acronym>CA</> (either one of the global <acronym>CAs</> or a local one) should be used in certificate signed by a <acronym>CA</> (either one of the global
production so the client can verify the server's identity. To create <acronym>CAs</> or a local one) should be used in production so the
a quick self-signed certificate, use the following <productname>OpenSSL</productname> command: client can verify the server's identity. To create a quick
self-signed certificate, use the following
<productname>OpenSSL</productname> command:
<programlisting> <programlisting>
openssl req -new -text -out cert.req openssl req -new -text -out cert.req
</programlisting> </programlisting>
Fill out the information that <command>openssl</> asks for. Make sure that you enter Fill out the information that <command>openssl</> asks for. Make sure
the local host name as Common Name; the challenge password can be that you enter the local host name as Common Name; the challenge
left blank. The script will generate a key that is passphrase protected; password can be left blank. The script will generate a key that is
it will not accept a pass phrase that is less than four characters long. passphrase protected; it will not accept a pass phrase that is less
To remove the passphrase (as you must if you want automatic start-up of than four characters long. To remove the passphrase (as you must if
the server), run the commands you want automatic start-up of the server), run the commands
<programlisting> <programlisting>
openssl rsa -in privkey.pem -out cert.pem openssl rsa -in privkey.pem -out cert.pem
</programlisting> </programlisting>
...@@ -2523,8 +2512,8 @@ cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt ...@@ -2523,8 +2512,8 @@ cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt
First make sure that an <application>ssh</application> server is First make sure that an <application>ssh</application> server is
running properly on the same machine as running properly on the same machine as
<productname>PostgreSQL</productname> and that you can log in using <productname>PostgreSQL</productname> and that you can log in using
<command>ssh</command> as some user. Then you can establish a secure tunnel with a <command>ssh</command> as some user. Then you can establish a secure
command like this from the client machine: tunnel with a command like this from the client machine:
<programlisting> <programlisting>
$ <userinput>ssh -L 3333:foo.com:5432 joe@foo.com</userinput> $ <userinput>ssh -L 3333:foo.com:5432 joe@foo.com</userinput>
</programlisting> </programlisting>
...@@ -2541,8 +2530,9 @@ psql -h localhost -p 3333 template1 ...@@ -2541,8 +2530,9 @@ psql -h localhost -p 3333 template1
To the database server it will then look as though you are really To the database server it will then look as though you are really
user <literal>joe@foo.com</literal> and it will use whatever user <literal>joe@foo.com</literal> and it will use whatever
authentication procedure was set up for this user. In order for the authentication procedure was set up for this user. In order for the
tunnel setup to succeed you must be allowed to connect via <command>ssh</command> as tunnel setup to succeed you must be allowed to connect via
<systemitem>joe@foo.com</systemitem>, just as if you had attempted to use <command>ssh</command> to set up a <command>ssh</command> as <systemitem>joe@foo.com</systemitem>, just
as if you had attempted to use <command>ssh</command> to set up a
terminal session. terminal session.
</para> </para>
......
...@@ -2,19 +2,23 @@ ...@@ -2,19 +2,23 @@
# PostgreSQL configuration file # PostgreSQL configuration file
# ----------------------------- # -----------------------------
# #
# This file consists of lines of the form # This file consists of lines of the form:
# #
# name = value # name = value
# #
# (The `=' is optional.) White space is collapsed, comments are # (The '=' is optional.) White space may be used. Comments are introduced
# introduced by `#' anywhere on a line. The complete list of option # with '#' anywhere on a line. The complete list of option names and
# names and allowed values can be found in the PostgreSQL # allowed values can be found in the PostgreSQL documentation. The
# documentation. The commented-out settings shown in this file # commented-out settings shown in this file represent the default values.
# represent the default values. #
# Any option can also be given as a command line switch to the # Any option can also be given as a command line switch to the
# postmaster, e.g., 'postmaster -c log_connections=on'. Some options # postmaster, e.g. 'postmaster -c log_connections=on'. Some options
# can be changed at run-time with the 'SET' SQL command. # can be changed at run-time with the 'SET' SQL command.
#
# This file is read on postmaster startup and when the postmaster
# receives a SIGHUP. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect, or use
# "pg_ctl reload".
#======================================================================== #========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment