POSTGRES(1)                                           POSTGRES(1)

NAME
       postgres - Run a Postgres single-user backend

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

   INPUTS
       postgres accepts the following command line arguments:

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

       -B nBuffers
              If  the  backend  is  running under the postmaster,
              nBuffers 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
              buffers, where each buffer is 8k bytes (or whatever
              BLCKSZ is set to in config.h).

       -C     Do not show the server version number.

       -D DataDir
              Specifies the directory to use as the root  of  the
              tree  of  database directories. If -D is not given,
              the default data directory name is the value of the
              environment variable PGDATA.  If PGDATA is not set,
              then the directory used is $POSTGRESHOME/data.   If
              neither  environment  variable is set and this com-
              mand-line option  is  not  specified,  the  default
              directory that was set at compile-time is used.

       -E     Echo all queries.

       -F     Disable an automatic fsync() call after each trans-
              action.  This option improves performance,  but  an
              operating  system  crash  while a transaction is in
              progress may cause the loss of  the  most  recently
              entered  data. Without the fsync() call the data is
              buffered by the operating system,  and  written  to
              disk sometime later.

       -O     Override  restrictions,  so system table structures
              can be modified.  These tables are typically  those
              with a leading "pg_" in the table name.

       -Q     Specifies "quiet" mode.

       -S SortSize
              Specifies the amount of memory to be used by inter-
              nal sorts and hashes before resorting to  temporary
              disk  files.  The  value is specified in kilobytes,
              and defaults to 512 kilobytes. Note that for a com-
              plex  query,  several  sorts and/or hashes might be
              running in parallel, and each one will  be  allowed
              to  use  as  much  as  SortSize kilobytes before it
              starts to put data into temporary files.

       -d [ DebugLevel ]
              The optional  argument  DebugLevel  determines  the
              amount of debugging output the backend servers will
              produce.  If DebugLevel is one, the postmaster will
              trace  all  connection  traffic,  and nothing else.
              For levels two and higher, debugging is  turned  on
              in  the backend process and the postmaster displays
              more information, including the backend environment
              and process traffic.  Note that if no file is spec-
              ified for backend servers to send  their  debugging
              output then this output will appear on the control-
              ling tty of their parent postmaster.

       -e     This option controls how dates are interpreted upon
              input  to  and output from the database.  If the -e
              option is supplied, then dates passed to  and  from
              the  frontend  processes  will  be assumed to be in
              "European" format (DD-MM-YYYY), otherwise dates are
              assumed  to  be  in "American" format (MM-DD-YYYY).
              Dates are accepted by the backend in a wide variety
              of  formats, and for input dates this switch mostly
              affects the  interpretation  for  ambiguous  cases.
              See  The  PostgreSQL User's Guide for more informa-
              tion.

       -o OutputFile
              Sends all debugging and error output to OutputFile.
              If  the  backend  is  running under the postmaster,
              error messages are still sent to the frontend  pro-
              cess as well as to OutputFile, 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.

       -v protocol
              Specifies the number of the frontend/backend proto-
              col to be used for this particular session.

       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.

       These special-case options are:

       -A n|r|b|Q\fIn\fP|X\fIn\fP
              This option generates a tremendous amount  of  out-
              put.

       -L     Turns off the locking system.

       -N     Disables use of newline as a query delimiter.

       -f [ s | i | m | n | h ]
              Forbids  the  use of particular scan and join meth-
              ods: s and i disable  sequential  and  index  scans
              respectively,  while  n,  m,  and h disable nested-
              loop, merge and hash joins respectively.

              Note:  Neither  sequential  scans  nor  nested-loop
              joins  can  be disabled completely; the -fs and -fn
              options simply discourage the optimizer from  using
              those plan types if it has any other alternative.

       -i     Prevents  query execution, but shows the plan tree.

       -p dbname
              Indicates to the backend server that  it  has  been
              started  by a postmaster and make different assump-
              tions about buffer pool management,  file  descrip-
              tors,  etc. Switches following -p are restricted to
              those considered "secure".

       -t pa[rser] | pl[anner] | e[xecutor]
              Print timing statistics for each query relating  to
              each  of the major system modules. This option can-
              not be used with -s.

   OUTPUTS
       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  ipc-
              clean command. After doing this, try starting post-
              master again. If this still doesn't work, you prob-
              ably  need to configure your kernel for shared mem-
              ory and semaphores as described in the installation
              notes. If you have a kernel with particularly small
              shared memory and/or semaphore limits, you may have
              to  reconfigure  your kernel to increase its shared
              memory or semaphore parameters.

              Tip: You may be able to postpone reconfiguring your
              kernel  by decreasing -B to reduce Postgres' shared
              memory consumption.

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.

       Some of the switches explained here can be passed  to  the
       backend  through the "database options" field of a connec-
       tion request, and thus can be set for a particular backend
       without going to the trouble of restarting the postmaster.
       This is particularly handy for debugging-related switches.

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

NOTES
       Useful  utilities  for dealing with shared memory problems
       include ipcs(1),  ipcrm(1),  and  ipcclean(1).   See  also
       postmaster(1).

Application               15 August 1999                        1