📄 postgres.1
字号:
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "POSTGRES" "1" "2008-01-03" "Application" "PostgreSQL Server Applications".SH NAMEpostgres \- PostgreSQL database server.SH SYNOPSIS.sp\fBpostgres\fR [ \fB\fIoption\fB\fR\fI...\fR ] .SH "DESCRIPTION".PP\fBpostgres\fR is thePostgreSQL database server. In orderfor a client application to access a database it connects (over anetwork or locally) to a running \fBpostgres\fR process.The \fBpostgres\fR instance then starts a separate serverprocess to handle the connection..PPOne \fBpostgres\fR instance always manages the data fromexactly one database cluster. A database cluster is a collectionof databases that is stored at a common file system location (the``data area''). More than one\fBpostgres\fR process can run on a system at onetime, so long as they use different data areas and differentcommunication ports (see below). When\fBpostgres\fR starts it needs to know the locationof the data area. The location must be specified by the\fB-D\fR option or the \fBPGDATA\fR environmentvariable; there is no default. Typically, \fB-D\fR or\fBPGDATA\fR points directly to the data area directorycreated by \fBinitdb\fR(1). Other possible file layouts arediscussed in in the documentation..PPBy default \fBpostgres\fR starts in theforeground and prints log messages to the standard error stream. Inpractical applications \fBpostgres\fRshould be started as a background process, perhaps at boot time..PPThe \fBpostgres\fR command can also be called insingle-user mode. The primary use for this mode is duringbootstrapping by \fBinitdb\fR(1). Sometimes it is usedfor debugging or disaster recovery (but note that running a single-userserver is not truly suitable for debugging the server, since norealistic interprocess communication and locking will happen).When invoked in single-usermode from the shell, the user can enter queries and the resultswill be printed to the screen, but in a form that is more usefulfor developers than end users. In the single-user mode,the session user will be set to the user with ID 1, and implicitsuperuser powers are granted to this user.This user does not actually have to exist, so the single-user modecan be used to manually recover from certainkinds of accidental damage to the system catalogs..SH "OPTIONS".PP\fBpostgres\fR accepts the following command-linearguments. For a detailed discussion of the options consult in the documentation. You can save typing most of theseoptions by setting up a configuration file. Some (safe) optionscan also be set from the connecting client in anapplication-dependent way to apply only for that session. Forexample, if the environment variable \fBPGOPTIONS\fR isset, then \fBlibpq\fR-based clients will pass thatstring to the server, which will interpret it as\fBpostgres\fR command-line options..SS "GENERAL PURPOSE".TP\fB-A 0|1\fREnables run-time assertion checks, which is a debugging aid todetect programming mistakes. This option is only available ifassertions were enabled when PostgreSQL wascompiled. If so, the default is on..TP\fB-B \fInbuffers\fB\fRSets the number of shared buffers for use by the serverprocesses. The default value of this parameter is chosenautomatically by \fBinitdb\fR; refer to in the documentation for more information..TP\fB-c \fIname\fB=\fIvalue\fB\fRSets a named run-time parameter. The configuration parameterssupported by PostgreSQL aredescribed in in the documentation. Most of theother command line options are in fact short forms of such aparameter assignment. \fB-c\fR can appear multiple timesto set multiple parameters..TP\fB-d \fIdebug-level\fB\fRSets the debug level. The higher this value is set, the moredebugging output is written to the server log. Values arefrom 1 to 5. It is also possible to pass -d0 for a specific session, which will prevent theserver log level of the parent \fBpostgres\fR process from beingpropagated to this session..TP\fB-D \fIdatadir\fB\fRSpecifies the file system location of the data directory orconfiguration file(s). Seein the documentation for details..TP\fB-e\fRSets the default date style to ``European'', that isDMY ordering of input date fields. This also causesthe day to be printed before the month in certain date output formats.See in the documentation for more information..TP\fB-F\fRDisables \fBfsync\fR calls for improvedperformance, at the risk of data corruption in the event of asystem crash. Specifying this option is equivalent todisabling the fsync configurationparameter. Read the detailed documentation before using this!.TP\fB-h \fIhostname\fB\fRSpecifies the IP host name or address on which\fBpostgres\fR is to listen for TCP/IPconnections from client applications. The value can also be acomma-separated list of addresses, or * to specifylistening on all available interfaces. An empty valuespecifies not listening on any IP addresses, in which caseonly Unix-domain sockets can be used to connect to theserver. Defaults to listening only on\fBlocalhost\fR.Specifying this option is equivalent to setting the listen_addresses configuration parameter..TP\fB-i\fRAllows remote clients to connect via TCP/IP (Internet domain)connections. Without this option, only local connections areaccepted. This option is equivalent to settinglisten_addresses to * in\fIpostgresql.conf\fR or via \fB-h\fR.This option is deprecated since it does not allow access to thefull functionality of listen_addresses.It's usually better to set listen_addresses directly..TP\fB-k \fIdirectory\fB\fRSpecifies the directory of the Unix-domain socket on which\fBpostgres\fR is to listen forconnections from client applications. The default is normally\fI/tmp\fR, but can be changed at build time..TP\fB-l\fREnables secure connections using SSL.PostgreSQL must have been compiled withsupport for SSL for this option to beavailable. For more information on using SSL,refer to in the documentation..TP\fB-N \fImax-connections\fB\fRSets the maximum number of client connections that thisserver will accept. Bydefault, this value is 32, but it can be set as high as yoursystem will support. (Note that\fB-B\fR is required to be at least twice\fB-N\fR. See in the documentation for a discussion ofsystem resource requirements for large numbers of clientconnections.) Specifying this option is equivalent to setting themax_connections configuration parameter..TP\fB-o \fIextra-options\fB\fRThe command line-style options specified in \fIextra-options\fR are passed toall server processes started by this\fBpostgres\fR process. If the option string containsany spaces, the entire string must be quoted.The use of this option is obsolete; all command-line optionsfor server processes can be specified directly on the\fBpostgres\fR command line..TP\fB-p \fIport\fB\fRSpecifies the TCP/IP port or local Unix domain socket fileextension on which \fBpostgres\fRis to listen for connections from client applications.Defaults to the value of the \fBPGPORT\fR environmentvariable, or if \fBPGPORT\fR is not set, thendefaults to the value established during compilation (normally5432). If you specify a port other than the default port,then all client applications must specify the same port usingeither command-line options or \fBPGPORT\fR..TP\fB-s\fRPrint time information and other statistics at the end of each command.This is useful for benchmarking or for use in tuning the number ofbuffers..TP\fB-S \fIwork-mem\fB\fRSpecifies the amount of memory to be used by internal sorts and hashesbefore resorting to temporary disk files. See the description of thework_mem configuration parameter in in the documentation..TP\fB--\fIname\fB=\fIvalue\fB\fRSets a named run-time parameter; a shorter form of\fB-c\fR..TP\fB--describe-config\fRThis option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited \fBCOPY\fR format.It is designed primarily for use by administration tools..SS "SEMI-INTERNAL OPTIONS".PPThere are several other options that may be specified, usedmainly for debugging purposes and in some cases to assist withrecovery of severely damaged databases. There should be no reasonto use them in a production database setup. These are listedhere only for the use by PostgreSQLsystem developers. Furthermore, any of these options maydisappear or change in a future release without notice..TP\fB-f { s | i | m | n | h }\fRForbids the use of particular scan and join methods:s and idisable sequential and index scans respectively, whilen, m, and hdisable nested-loop, merge and hash joins respectively.Neither sequential scans nor nested-loop joins can be disabledcompletely; the -fs and-fn options simply discourage the optimizerfrom using those plan types if it has any other alternative..TP\fB-n\fRThis option is for debugging problems that cause a serverprocess to die abnormally. The ordinary strategy in thissituation is to notify all other server processes that theymust terminate and then reinitialize the shared memory andsemaphores. This is because an errant server process couldhave corrupted some shared state before terminating. Thisoption specifies that \fBpostgres\fR willnot reinitialize shared data structures. A knowledgeablesystem programmer can then use a debugger to examine sharedmemory and semaphore state..TP\fB-O\fRAllows the structure of system tables to be modified. This isused by \fBinitdb\fR..TP\fB-P\fRIgnore system indexes when reading system tables (but still updatethe indexes when modifying the tables). This is useful whenrecovering from damaged system indexes..TP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -