Table of Contents

NAME

postgres -- the Postgres backend server

SYNOPSIS

postgres [-B n_buffers] [-D data_directory] [-E ] [-F ]
[-P filedes] [-Q ] [-S n_buffers ] [-e ]
[-d debug_level] [-o output_file] [-s ] [dbname]

DESCRIPTION

The Postgres backend server can be executed directly from the user shell. This should be done only while debugging by the DBA, and should not be done while other Postgres backends are being managed by a postmaster on this set of databases.

The optional argument dbname specifies the name of the database to be accessed. Dbname defaults to the value of the USER environment variable.

The postgres server understands the following command-line options:

-D data_directory
This option specifies the pathname of the directory that contains the database system data (the tables, the catalogs, etc.). If you don't specify this option, Postgres uses the value of the PGDATA environment variable. You must either specify a -D option or set PGDATA. The data directory pathname for a database system is normally determined when the database system is created with initdb, with a --pgdata option to initdb.
-B n_buffers
If the backend is running under the postmaster, n_buffers is the number of shared-memory buffers that the postmaster has allocated for the backend server processes that it starts. If the backend is running standalone, this specifies the number of buffers to allocate. This value defaults to 64, and each buffer is 8k bytes.
-E
Echo all queries.
-F
Disable automatic fsync() call after each transaction. This option improves performance, but an operating system crash while a transaction is in progress will probably cause data loss.
-P filedes
filedes specifies the file descriptor that corresponds to the socket (port) on which to communicate to the frontend process. This option is not useful for interactive use.
-Q
Specifies `quiet' mode.
-S
Specifies the amount of memory to be used by internal sorts before using disk files for sorting. This value is specified in 1k bytes, and defaults to 512.
-e
The -e option controls how dates are input to and output from the database.
If the
-e option is supplied, then all dates passed to and from the frontend processes will be assumed to be in European format ie. DD-MM-YYYY otherwise dates are input and output in American format ie. MM-DD-YYYY
-d debug_level
Turns on debugging at the numeric level debug_level. Turning on debugging will cause query, parse trees, and query plans to be displayed.
-o output_file
Sends all debugging and error output to output_file. If the backend is running under the postmaster, error messages are still sent to the frontend process as well as to output_file, but debugging output is sent to the controlling tty of the postmaster (since only one file descriptor can be sent to an actual file).
-s
Print time information and other statistics at the end of each query. This is useful for benchmarking or for use in tuning the number of buffers.

DEPRECATED COMMAND OPTIONS

There are several other options that may be specified, used mainly for debugging purposes. These are listed here only for the use by Postgres system developers. Use of any of these options is highly discouraged. Furthermore, any of these options may disappear or change at any time.
-An|r|b|Qn |Xn
This option generates a tremendous amount of output.
-L
Turns off the locking system.
-N
Disables use of newline as a query delimiter.
-b
Enables generation of bushy query plan trees (as opposed to left-deep query plans trees). These query plans are not intended for actual execution; in addition, this flag often causes Postgres to run out of memory.
-f
Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, while n, m and h disable nested-loop, merge and hash joins respectively. This is another feature that may not necessarily produce executable plans.
-p
Indicates to the backend server that it has been started by a postmaster and make different assumptions about buffer pool management, file descriptors, etc.
-tpa[rser]|pl[anner]|e[xecutor]
Print timing statistics for each query relating to each of the major system modules. This option cannot be used with -s.

SEE ALSO

ipcclean(1) , psql(1) , postmaster(1) .

DIAGNOSTICS

Of the nigh-infinite number of error messages you may see when you execute the backend server directly, the most common will probably be:
semget: No space left on device
If you see this message, you should run the ipcclean command. After doing this, try starting postgres again. If this still doesn't work, you probably need to configure your kernel for shared memory and semaphores as described in the installation notes.


Table of Contents