Appendix B. Backend Options for postgres

The postgres program is the actual backend server that processes SQL statements. It is generally not called directly, but invoked through the multiuser postmaster process. It can be helpful to know the options available to this program, however, as they can be called indirectly through the postmaster 's -o  flag.

The following syntax diagram shows the options recognized by postgres:

  postgres [ -A { 0 | 1 } ] [ -B buffers ] [ -c name=value ] [ -d debug-level ]
           [ -D datadir ] [ -e ] [ -E ] [ -f { s | i | n | m | h } ] [ -F ] 
           [ -i ] [ -L ] [ -N ] [ -o file-name ] [ -O ] [ -P ] 
           [ -s | -t { pa | pl | ex } ] [ -S sort_mem ] [ -W num ] database
  postgres [ -A { 0 | 1 } ] [ -B buffers ] [ -c name=value ] [ -d debug-level ]
           [ -D datadir ] [ -e ] [ -f { s | i | n | m | h } ] [ -F ] [ -i ] 
           [ -L ] [ -o file-name ] [ -O ] [ -p database ] [ -P ] 
           [ -s | -t { pa | pl | ex } ] [ -S sort_mem ] [ -v version ] [ -W num ]

-A { 0 | 1 }

The run-time assertion check parameter. This enables debugging, if the debugging option was enabled during compilation of PostgreSQL. This parameter should only be used by knowledgeable developers working on PostgreSQL.

-B buffers

The number of shared-memory disk buffers that postmaster will allocate for use by the backend. By default, this is 64.

Note: The buffers value passed to -B must be at least twice the number supplied for the -N parameter.

-c name=value

An arbitrary run-time configuration, setting name to value. Any configuration settings found in the postgresql.conf file (within the database cluster's data directory) may be over-ridden with this option.

-d debug_level

The debug level, which determines the amount of debugging output that will be logged by the backend. The default is 0. With a higher the debug_level number, more output will be generated. Values as high as 4 are reasonable for normal use, though this can log a great deal of information.

Note: Unless the standard output and standard error streams from postmaster are redirected to a file (e.g., from the shell, or with the -l option to pg_ctl) all debugging information will be displayed to the controlling terminal session of the postmaster process.

-D datadir

The data directory of the intended database cluster. If this is not supplied, postmaster will use either the value of the PGDATA environment variable, or the /data path off of the path defined in the POSTGRESHOME environment variable. If neither environment variable is set, the default compile-time directory is used (e.g., /usr/local/pgsql/data).


The European date style parameter. This causes PostgreSQL to assume that dates such as 3/2/2001 are day-first rather than month-first. It also causes PostgreSQL to display the day before the month (e.g., dd/mm/yyyy) when displaying dates.


The verbose echo parameter. Causes all passed statements to be output (e.g., to the controlling terminal session, or to the server log).

-f { s | i | n | m | h }

The forbid parameter, which can forbid the use of certain scan and join methods. The following options may follow the -f:


Forbids sequential scans


Forbids index scans


Forbids nested loops


Forbids merge joins


Forbids hash joins


The fsync-disabling option. Using this increases performance at the risk of data corruption in the event that the operating system or physical hardware crashes unexpectedly. Be sure you know what you are doing before you use this parameter!


The -i parameter disables query execution, and causes PostgreSQL to only show the plan tree.


The lock-disabling parameter. This turns off the ability to lock in PostgreSQL.


The -N parameter disables the use of a newline as a statement delimiter.


The -O parameter allows system tables to be modified.

-p database

The postmaster parameter, indicating that this postgres instance was started by postmaster connecting to database. This causes postgres to make different decisions about memory management and file descriptors.


The -P parameter causes PostgreSQL to ignore system indices when scanning and updating system tuples. This option is required by the REINDEX command when indexing system tables.


The statistics parameter. This causes PostgreSQL to display processing time and other statistics after each query, which can be helpful in benchmark tests, or for tuning the amount of buffers you make available with the -B parameter.

-S sort_mem

The amount of memory to be allocated for internal sorting and hashes before falling back on temporary hard disk files. sort_mem is a numeric value, in kilobytes, and defaults to 512. For complex statements, several sorts or hashes may run simultaneously; each one will be allocated up to the value specified by sort_mem before using temporary disk space.

-t { pa | pl | e }

The timing statistics parameter, specific to only one of the major postgres components. The following are the valid options that may follow the -t parameter:


Times the parser component


Times the planner component


Times the executor component

The -t and -s options are mutually exclusive.

-v version

The protocol version parameter. This option sets the internal version number of the frontend-to-backend protocol.

-W num

The wait parameter. Specifying this value causes postgres to wait for num seconds before starting up, allowing a developer time to attach a debugger.