Seth Woolley's Man Viewer

postgres(1) - postgres - run a PostgreSQL server in single-user mode - man 1 postgres

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

POSTGRES(1)             PostgreSQL Server Applications             POSTGRES(1)

       postgres - run a PostgreSQL server in(1,8) single-user mode

       postgres  [  -A   0 | 1 ] [ -B nbuffers ] [ -c name=value ] [ -d debug-
       level ] [ --describe-config ] [ -D datadir ] [ -e ] [ -E ] [ -f  s |  i
       | t | n | m | h ] [ -F ] [ -N ] [ -o filename ] [ -O ] [ -P ] [ -s | -t
       pa | pl | ex ] [ -S sort-mem ] [ -W seconds ] [ --name=value ] database

       postgres  [  -A   0 | 1 ] [ -B nbuffers ] [ -c name=value ] [ -d debug-
       level ] [ -D datadir ] [ -e ] [ -f  s | i | t | n | m | h ] [ -F ] [ -o
       filename ] [ -O ] [ -p database ] [ -P ] [ -s | -t  pa | pl | ex ] [ -S
       sort-mem ] [ -v protocol ] [ -W seconds ] [ --name=value ]

       The postgres executable is the actual PostgreSQL  server  process  that
       processes  queries. It is normally not called directly; instead a post-
       master(5,8)(1) multiuser server is started.

       The second form above is how postgres is invoked by  the  postmaster(1)
       (only  conceptually, since both postmaster and postgres are in(1,8) fact the
       same program); it should not be invoked directly this  way.  The  first
       form  invokes  the server directly in(1,8) interactive single-user mode. The
       primary use for this mode is during bootstrapping by initdb(1).   Some-
       times it is used for debugging or disaster recovery.

       When  invoked  in(1,8)  interactive  mode from the shell, the user can enter
       queries and the results will be printed to the screen, but  in(1,8)  a  form
       that  is  more useful for developers than end users. But note that run-
       ning a single-user server is  not  truly  suitable  for  debugging  the
       server  since  no realistic interprocess communication and locking will

       When running a stand-alone server, the session user will be set(7,n,1 builtins) to  the
       user  with ID 1. This user does not actually have to exist, so a stand-
       alone server can be used to manually  recover  from  certain  kinds  of
       accidental damage to the system catalogs. Implicit superuser powers are
       granted to the user with ID 1 in(1,8) stand-alone mode.

       When postgres is started  by  a  postmaster(1)  then  it  inherits  all
       options  set(7,n,1 builtins) by the latter. Additionally, postgres-specific options can
       be passed from the postmaster with the -o switch.

       You can avoid having to type these options by setting up  a  configura-
       tion  file.  See  the  section called ``Run-time Configuration'' in(1,8) the
       documentation for details. Some (safe) options can also be set(7,n,1 builtins) from the
       connecting  client in(1,8) an application-dependent way. For example, if(3,n) the
       environment variable PGOPTIONS is set(7,n,1 builtins), then  libpq-based  clients  will
       pass  that  string(3,n)  to  the server, which will interpret it as postgres
       command-line options.

       The options -A, -B, -c, -d, -D, -F, and --name have the  same  meanings
       as  the postmaster(1) except that -d 0 prevents the server log level of
       the postmaster from being propagated to postgres.

       -e     Sets the default date style to ``European'', that is DMY  order-
              ing of input date fields. This also causes the day to be printed
              before the month in(1,8) certain date output formats.  See  the  sec-
              tion  called  ``Date/Time  Types'' in(1,8) the documentation for more

       -o filename
              Send all server log output to filename.  If postgres is  running
              under  the  postmaster,  this  option is ignored, and the stderr
              inherited from the postmaster is used.

       -P     Ignore system indexes when  reading  system  tables  (but  still
              update(7,n)  the  indexes  when modifying the tables). This is useful
              when recovering from damaged system indexes.

       -s     Print time(1,2,n) information and other statistics at the end  of  each
              command.   This  is useful for benchmarking or for use in(1,8) tuning
              the number of buffers.

       -S sort-mem
              Specifies the amount of memory to be used by internal sorts  and
              hashes  before  resorting  to temporary disk files. The value is
              specified in(1,8) kilobytes, and defaults to 1024. Note  that  for  a
              complex  query,  several sorts and/or hashes might be running in(1,8)
              parallel, and each one will be allowed to use as much  as  sort-
              mem kilobytes before it starts to put data into temporary files.

              Specifies the name of the database to  be  accessed.  If  it  is
              omitted it defaults to the user name.

       -E     Echo all commands.

       -N     Disables use of newline as a statement delimiter.

       There  are several other options that may be specified, used mainly for
       debugging purposes. These are listed here only for  the  use  by  Post-
       greSQL  system  developers.  Use of any of these options is highly dis-
       couraged. Furthermore, any of these options may disappear or change  in(1,8)
       a future release without notice.

       -f { s | i | m | n | h }
              Forbids  the  use  of  particular scan and join(1,n) methods: s and i
              disable sequential and index scans respectively, while n, m, and
              h disable nested-loop, merge(1,8) and hash joins respectively.

              Note: Neither sequential scans nor nested-loop joins can be dis-
              abled completely; the -fs and -fn options simply discourage  the
              optimizer from using those plan types if(3,n) it has any other alter-

       -O     Allows the structure of system tables to be  modified.  This  is
              used by initdb.

       -p database
              Indicates that this process has been started by a postmaster and
              specifies the database to use.  etc.

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

       -v protocol
              Specifies the version(1,3,5) number of the frontend/backend protocol to
              be used for this particular session.

       -W seconds
              As  soon  as  this option is encountered, the process sleeps for
              the specified amount of seconds. This gives developers  time(1,2,n)  to
              attach a debugger to the server process.

              This  option dumps out the server's internal configuration vari-
              ables, descriptions, and defaults in(1,8) tab-delimited COPY  format.
              It is designed primarily for use by administration tools.

       PGDATA Default data direction location

       For  others,  which  have little influence during single-user mode, see

       To cancel a running query, send(2,n)  the  SIGINT  signal(2,7)  to  the  postgres
       process running that command.

       To  tell postgres to reload the configuration files, send(2,n) a SIGHUP sig-
       nal. Normally it's best to SIGHUP the postmaster instead; the  postmas-
       ter  will  in(1,8)  turn  SIGHUP  each of its children. But in(1,8) some cases it
       might be desirable to have only one postgres process reload the config-
       uration files.

       The postmaster uses SIGTERM to tell a postgres process to quit normally
       and SIGQUIT to terminate without the  normal  cleanup.   These  signals
       should  not  be  used  by users. It is also unwise to send(2,n) SIGKILL to a
       postgres process --- the postmaster will interpret this as a  crash  in(1,8)
       postgres,  and will force all the sibling postgres processes to quit as
       part of its standard crash-recovery procedure.

       Start a stand-alone server with a command like

       postgres -D /usr/local/pgsql/data other-options my_database

       Provide the correct path to the database directory  with  -D,  or  make
       sure  that  the  environment  variable PGDATA is set.  Also specify the
       name of the particular database you want to work in.

       Normally, the stand-alone server treats newline as  the  command  entry
       terminator;  there  is no intelligence about semicolons, as there is in(1,8)
       psql. To continue a command across multiple lines, you must type  back-
       slash just before each newline except the last one.

       But if(3,n) you use the -N command line switch(1,n), then newline does not termi-
       nate command entry. In this case, the server  will  read(2,n,1 builtins)  the  standard
       input  until  the end-of-file (EOF) marker, then process the input as a
       single command string. Backslash-newline is not  treated  specially  in(1,8)
       this case.

       To quit the session, type EOF (Control+D, usually).  If you've used -N,
       two consecutive EOFs are needed to exit.

       Note that the stand-alone server does not provide  sophisticated  line-
       editing features (no command history(1,3,n,1 builtins), for example).

       initdb(1), ipcclean(1), postmaster(1)

Application                       2003-11-02                       POSTGRES(1)

References for this manual (incoming links)