postgres

Name

postgres  --  Runs a single-user backend process.

Synopsis

postgres [ dbname ]
postgres [ -B nBuffers ] [ -C ] [ -D DataDir ] [ -E ] [ -F ]
   [ -O ] [ -P ] [ -Q ] [ -S SortSize ] [ -d [ DebugLevel ] ] [ -e ]
   [ -o ] [ OutputFile ] [ -s ] [ -v protocol ] [ dbname ]
  

Parameters

-A, -B, -c, -d, -D all perform the same function as they do in postmaster program. See postmaster for more information.

dbname

Use this parameter to identify the database you are accessing. If this is left unspecified, the USER environment variable is used.

-C

Use this parameter to mute output of the PostgreSQL version.

-E

Use this parameter to have all queries echoed to standard output.

-F

Use this parameter to disable the automatic calling of fsync() after each transaction. Disabling this will improve performance, but new or modified data will be buffered until the machine's operating system writes it at a later time; hence, new data can easily be lost in the event of an operating system crash.

-O

] Use this parameter to override default restrictions set on system table structures, allowing them to be modified (table structures are those that start with pg_).

-P

Use this parameter to disable system indexes. This option is required by the REINDEX command.

-Q

Use this parameter to have postgres run in quiet mode. This mode will not produce any logging information (standard output and standard error streams are sent to /dev/null). When in quiet mode, the postgres instance will run detached from the starting TTY and run in its own process group.

-S sortsize

Use this parameter to set how much memory should be used by internal sorts and hashes before those functions begin to use temporary disk memory. This number is interpreted as kilobytes (kb) and the default is 512 kilobytes.

-e

Use this parameter enable European style date formatting (and display). European style follows the 'DD-MM-YYYY' format. If this is not specified, dates are interpreted and displayed in American format ('MM-DD-YYYY').

-o outputfile

Use this parameter to indicate that all debugging and error information should be sent to the specified file. If postgres was started by a postmaster instance, error messages are sent to both the output file and the frontend process, and debugging information is sent to the controlling TTY of postmaster.

-s

Use this parameter to have time and statistical information printed after the execution of each query, for benchmarking and performance tuning.

-v protocol

Use this parameter to specify the protocol this session will use.

There are several other parameters for the postgres program that are used primarily for internal reasons, though they can also be used for debugging purposes. The use of these options for non-debugging purposes is highly discouraged and their continued existence is not guranteed

These options are:

-L

Use this parameter to disable the locking system.

-N

Use this parameter to disable the use of a new line character as a query delimiter.

-f [ s | i | m | n | h ]

Use this parameter to forbid the use of specified scan and join methods. Using -f in conjunction with s forbids sequential scans; i forbids index scans; n forbids nested-loop joins; m forbids merge joins; and h forbids hash joins.

NoteNote
 

You cannot fully disable sequential scans or nested-loop joins. Specifying their respective forbid options will just discourage their use by the optimizer.

-i

Use this parameter to show the plan tree for queries, insated of executing them.

-p dbname

Use this parameter to indicate to the postgres program that it has been started by a postmaster instance, and therefor should make different assumptions about shared memory management, file descriptors, and various other components of the system.

-t pa[rser] | pl[anner] | e[xecutor]

Use this parameter to print the timing statistics for each executed query, in relation to the major system modules. This parameter cannot be specified with -s.

Results

~ The most common error returned from the use of this program will probably be:

semget: No space left on device

This message is displayed if there were errors allocating shared memory. Try running the ipcclean program to clean up shared memory and semaphore space, then run postgres again. You could also be receiving this error if your system's kernel is configured with restrictive shared memory limits; in this case, you will need to reconfigure the kernel. You can also try reducing the shared memory that postgres uses by reducing the values of your supplied -B and -N options.

Description

The postgres program is PostgreSQL's backend server. Though it is not usually done (and is certainly not what you would normally want to do), you can execute postgres directly from the command line. This should only be done by the DBA for debugging purposes, and not in place of using postmaster. Also, be sure not to run this program directly if an instance of postmaster is managing connections to the same database cluster you would be using.

Examples

See postmaster for more information on how to run this program, as it is run in a similar fashion.