PostgreSQL's main configuration file

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 /etc/postgresql.


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'] "

In the postgresql.conf file generated by initdb, most valid parameters are commented out but shown with the default values set by initdb.

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_if_exists - like  include, but no error is raised if the file does not exist
  • include_dir - includes all files ending in .conf in 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.

From PostgreSQL 9.4, postgresql.conf can be modified with the SQL commands ALTER SYSTEM.

Activating changes

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

See Server management hacks.

Sample file

A sample postgresql.conf file, populated with the default values for most parametes, is available at src/backend/utils/misc/postgresql.conf.sample.


Configuration, Management / adminstration

See also, ALTER SYSTEM, GUC, include, include_if_exists, include_dir, List of configuration items which require a server restart