postgresql.conf is PostgreSQL's main configuration file and the primary source of configuration parameter settings.
postgresql.confis a plain text file generated by
initdb and is normally stored in the data directory. However some distributions' packages may place postgresql.conf in another location such as
One parameter can be specified on each line as a name/value setting; blank lines will be ignored. Any part of a line following a hash mark (#) will be treated as a comment. White space within a line is not significant, and the equals sign (=) between name and value is optional, provided there is at least one whitespace character separating them.
Parameters which include whitespace must be quoted with single quotes. In the rare case that single quotes occur in parameter values, these must be escaped either using two quotes or with a backslash (\').
# Comment port = 5432 ssl on shared_buffers = 512MB # very important to get this right! default_transaction_isolation = 'read committed' log_line_prefix = '[\'foo''] ' # this log line prefix will be printed as: "['foo'] "
Including other files
Following directives enable the inclusion of further files:
include- includes the specified file, either as an absolute path or relative to the current file's directory
include, but no error is raised if the file does not exist
include_dir- includes all files ending in
.confin the specified directory, which is specified either as an absolute path or relative to the current file's directory
Making changes to postgresql.conf
postgresql.conf can be altered using any text editor; use of a provisioning system is generally a sensible way of managing this and related files.
postgresql.conf is read at server startup. Any changes made while the server is running will not be automatically become effective; a
SIGHUP signal must be sent, which can be performed with
pg_ctl reload or by executing
SELECT pg_reload_conf(). Some configuration parameters require that the server is restarted; see this page for details
Using postgresql.conf outside the data directory
postgresql.conf file, populated with the default values for most parametes, is available at src/backend/utils/misc/postgresql.conf.sample.