Database Reference
In-Depth Information
The timezone settings are also picked up from the OS environment, so you shouldn't need
to set those directly. pg_settings shows this as a "command-line" setting.
Updating the parameter file
The parameter file is the main location for defining parameter values for the PostgreSQL
server. All of the parameters can be set in the parameter file, which is known as the
postgresql.conf .
There are also two other parameter files, pg_hba.conf and pg_ident.conf . Both of these
relate to connections and security, so we cover them in the appropriate chapters that follow.
Getting ready
First, locate the postgresql.conf as described earlier.
How to do it...
All of the parameters can be set in the parameter file, which is known as the postgresql.
conf . Some of the parameters take effect only when the server is first started. A typical
example might be shared_buffers , which defines the size of the shared memory cache.
Many of the parameters can be changed while the server is still running. After changing
the required parameters, we issue a reload operation to the server, forcing PostgreSQL
to re-read the postgresql.conf .
pg_ctl -D data reload
The postgresql.conf is a normal text file that can be simply edited. Most of the
parameters are listed in the file, so you can just search for them, and then overtype
the desired value.
How it works...
If you set the same parameter twice in different parts of the file, the last setting is the one
that applies. This can cause lots of confusion if you add settings to the bottom of the file, so
you are advised against doing that.
Best practice is to either leave the file as it is and edit the values, or to start with a blank file
and just include the values that you wish to change. I personally prefer a file with only the non-
default values. That makes it easier to see what's happening.
Whichever method you use, you are strongly advised to keep all of the previous versions of your
.conf files. You can do this by copying, or you can use a version control system, such as SVN.
 
Search WWH ::




Custom Search