{"Entry":{"collection":"tool","key":"postgres","name":"postgres","aliases":["postgres"],"metadata":{"aliases":["postgres"],"category":"Server applications","content_hash":"2a052b09c42028fa2662c482d2d61c89c1050f1404a262f1a4705d3820b2cc88","derived_content_hash":"2565d9dcc53a30a9ef3523e1bd6bbad70c4215cfaf26265b441140e219d8c654","imported_at":"2026-09-30T00:40:34.589868+08:00","name":"postgres","name_zh":"","slug":"postgres","summary":"postgres — PostgreSQL database server"}},"Definition":{"Collection":"tool","Key":"postgres","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"postgres","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.","name":"PGCLIENTENCODING"},{"description":"Default data directory location","name":"PGDATA"},{"description":"Default value of the DateStyle run-time parameter. (The use of this environment variable is deprecated.)","name":"PGDATESTYLE"},{"description":"Default port number (preferably set in the configuration file)","name":"PGPORT"}],"options":[{"description":"Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the shared_buffers configuration parameter.","names":["-B nbuffers"],"signature":"-B nbuffers"},{"description":"Sets a named run-time parameter. The configuration parameters supported by PostgreSQL are described in Chapter 19 . Most of the other command line options are in fact short forms of such a parameter assignment. -c can appear multiple times to set multiple parameters.","names":["-c name = value"],"signature":"-c name = value"},{"description":"Prints the value of the named run-time parameter, and exits. (See the -c option above for details.) This returns values from postgresql.conf , modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started. This can be used on a running server for most parameters. However, the server must be shut down for some runtime-computed parameters (e.g., shared_memory_size , shared_memory_size_in_huge_pages , and wal_segment_size ). This option is meant for other programs that interact with a server instance, such as pg_ctl , to query configuration parameter values. User-facing applications should instead use SHOW or the pg_settings view.","names":["-C name"],"signature":"-C name"},{"description":"Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass -d 0 for a specific session, which will prevent the server log level of the parent postgres process from being propagated to this session.","names":["-d debug-level"],"signature":"-d debug-level"},{"description":"Specifies the file system location of the database configuration files. See Section 19.2 for details.","names":["-D datadir"],"signature":"-D datadir"},{"description":"Sets the default date style to “ European ” , that is DMY ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See Section 8.5 for more information.","names":["-e"],"signature":"-e"},{"description":"Disables fsync calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the fsync configuration parameter. Read the detailed documentation before using this!","names":["-F"],"signature":"-F"},{"description":"Specifies the IP host name or address on which postgres is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or * to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on localhost . Specifying this option is equivalent to setting the listen_addresses configuration parameter.","names":["-h hostname"],"signature":"-h hostname"},{"description":"Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h . This option is deprecated since it does not allow access to the full functionality of listen_addresses . It's usually better to set listen_addresses directly.","names":["-i"],"signature":"-i"},{"description":"Specifies the directory of the Unix-domain socket on which postgres is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp , but that can be changed at build time. Specifying this option is equivalent to setting the unix_socket_directories configuration parameter.","names":["-k directory"],"signature":"-k directory"},{"description":"Enables secure connections using SSL . PostgreSQL must have been compiled with support for SSL for this option to be available. For more information on using SSL , refer to Section 18.9 .","names":["-l"],"signature":"-l"},{"description":"Sets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the max_connections configuration parameter.","names":["-N max-connections"],"signature":"-N max-connections"},{"description":"Specifies the TCP/IP port or local Unix domain socket file extension on which postgres is to listen for connections from client applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or PGPORT .","names":["-p port"],"signature":"-p port"},{"description":"Print time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers.","names":["-s"],"signature":"-s"},{"description":"Specifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the work_mem configuration parameter in Section 19.4.1 .","names":["-S"],"signature":"-S work-mem"},{"description":"Print the postgres version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Sets a named run-time parameter; a shorter form of -c .","names":["-- name = value"],"signature":"-- name = value"},{"description":"This option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited COPY format. It is designed primarily for use by administration tools.","names":["--describe-config"],"signature":"--describe-config"},{"description":"Show help about postgres command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, o , b and t disable index-only scans, bitmap index scans, and TID scans respectively, while n , m , and h disable nested-loop, merge and hash joins respectively. 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.","names":["-f"],"signature":"-f { s | i | o | b | t | n | m | h }"},{"description":"Allows the structure of system tables to be modified. This is used by initdb .","names":["-O"],"signature":"-O"},{"description":"Ignore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes.","names":["-P"],"signature":"-P"},{"description":"Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the -s option.","names":["-t"],"signature":"-t pa[rser] | pl[anner] | e[xecutor]"},{"description":"This option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them SIGQUIT signals. With this option, SIGABRT will be sent instead, resulting in production of core dump files.","names":["-T"],"signature":"-T"},{"description":"Specifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only.","names":["-v"],"signature":"-v protocol"},{"description":"A delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger.","names":["-W"],"signature":"-W seconds"},{"description":"Selects the single-user mode. This must be the first argument on the command line.","names":["--single"],"signature":"--single"},{"description":"Echo all commands to standard output before executing them.","names":["-E"],"signature":"-E"},{"description":"Use semicolon followed by two newlines, rather than just newline, as the command entry terminator.","names":["-j"],"signature":"-j"},{"description":"Send all server log output to filename . This option is only honored when supplied as a command-line option.","names":["-r"],"signature":"-r filename"}],"synopsis":["postgres [ option ...]"]},"comparison_hash":"30509748ef5aa6efd93c214ffb28fb9023e0efecf59598655674d069faddb18d","description":["postgres — PostgreSQL database server"],"description_zh":"描述 postgres 是 PostgreSQL 数据库服务器。客户端应用要访问数据库时，会（通过网络或本地）连接到一个正在运行的 postgres 实例。该 postgres 实例随后会启动一个独立的服务器进程来处理该连接。 一个 postgres 实例始终只管理一个数据库集簇的数据。数据库集簇是一组存储在同一文件系统位置（ “ 数据区域 ” ）中的数据库。只要使用不同的数据区域和不同的通信端口（见下文），一个系统上就可以同时运行多个 postgres 实例。当 postgres 启动时，它需要知道数据区域的位置。该位置必须通过 -D 选项或 PGDATA 环境变量指定；没有默认值。通常， -D 或 PGDATA 会直接指向由 initdb 创建的数据区域目录。其他可能的文件布局见 第 19.2 节 。 默认情况下， postgres 在前台启动，并将日志消息打印到标准错误流。在实际应用中， postgres 应作为后台进程启动，例如在系统启动时启动。 postgres 命令也可以在单用户模式下调用。这种模式的主要用途是在 initdb 执行引导期间使用。有时也会用它来调试或进行灾难恢复；但请注意，运行单用户服务器其实并不适合调试服务器，因为不会发生真实的进程间通信和锁定。从 shell 以单用户模式调用时，用户可以输入查询，结果会打印到屏幕上，但其形式对开发者更有用，而非面向终端用户。在单用户模式下，会话用户会被设置为 ID 为 1 的用户，并向该用户隐式授予超级用户权限。该用户实际上不必存在，因此单用户模式可用于手工恢复系统目录遭受某些意外损坏的情况。 选项 postgres 接受以下命令行参数。有关这些选项的详细讨论，请参阅 第 19 章 。通过设置配置文件，你可以省去键入其中大多数选项的麻烦。某些（安全的）选项还可以由连接的客户端以应用相关的方式设置，并且仅对该会话生效。例如，如果设置了环境变量 PGOPTIONS ，那么基于 libpq 的客户端就会将该字符串传给服务器，服务器会将其解释为 postgres 命令行选项。 通用选项 -B nbuffers 设","description_zh_html":"\u003cp\u003e命令行工具 postgres [ option ...]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 是\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库服务器。客户端应用要访问数据库时，会（通过网络或本地）连接到一个正在运行的 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 实例。该 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 实例随后会启动一个独立的服务器进程来处理该连接。\n  \u003c/p\u003e\u003cp\u003e\n   一个 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 实例始终只管理一个数据库集簇的数据。数据库集簇是一组存储在同一文件系统位置（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e数据区域\u003c/span\u003e”\u003c/span\u003e）中的数据库。只要使用不同的数据区域和不同的通信端口（见下文），一个系统上就可以同时运行多个\n   \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 实例。当\n   \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 启动时，它需要知道数据区域的位置。该位置必须通过\n   \u003ccode class=\"option\"\u003e-D\u003c/code\u003e 选项或 \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e 环境变量指定；没有默认值。通常，\u003ccode class=\"option\"\u003e-D\u003c/code\u003e 或\n   \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e 会直接指向由 \u003ca class=\"xref\" href=\"/zh/docs/18/app-initdb.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 创建的数据区域目录。其他可能的文件布局见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-file-locations.html\"\u003e第 19.2 节\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   默认情况下，\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 在前台启动，并将日志消息打印到标准错误流。在实际应用中，\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e\n   应作为后台进程启动，例如在系统启动时启动。\n  \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 命令也可以在单用户模式下调用。这种模式的主要用途是在 \u003ca class=\"xref\" href=\"/zh/docs/18/app-initdb.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 执行引导期间使用。有时也会用它来调试或进行灾难恢复；但请注意，运行单用户服务器其实并不适合调试服务器，因为不会发生真实的进程间通信和锁定。从 shell 以单用户模式调用时，用户可以输入查询，结果会打印到屏幕上，但其形式对开发者更有用，而非面向终端用户。在单用户模式下，会话用户会被设置为 ID 为 1 的用户，并向该用户隐式授予超级用户权限。该用户实际上不必存在，因此单用户模式可用于手工恢复系统目录遭受某些意外损坏的情况。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 接受以下命令行参数。有关这些选项的详细讨论，请参阅\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config.html\"\u003e第 19 章\u003c/a\u003e。通过设置配置文件，你可以省去键入其中大多数选项的麻烦。某些（安全的）选项还可以由连接的客户端以应用相关的方式设置，并且仅对该会话生效。例如，如果设置了环境变量 \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e，那么基于 \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 的客户端就会将该字符串传给服务器，服务器会将其解释为\n    \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 命令行选项。\n   \u003c/p\u003e\u003cdiv class=\"refsect2\"\u003e\u003ch3\u003e通用选项\u003c/h3\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-B \u003cem class=\"replaceable\"\u003e\u003ccode\u003enbuffers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置供服务器进程使用的共享缓冲区数量。该参数的默认值由 \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e 自动选择。指定此选项等效于设置 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\"\u003eshared_buffers\u003c/a\u003e 配置参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置一个命名的运行时参数。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 支持的配置参数见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config.html\"\u003e第 19 章\u003c/a\u003e。大多数其他命令行选项实际上都是这种参数赋值的简写形式。\u003ccode class=\"option\"\u003e-c\u003c/code\u003e 可以出现多次以设置多个参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打印指定运行时参数的值并退出。（详情见上面的 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项。）这会返回\n        \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 中的值，并应用本次调用中提供的任何参数修改。它不反映集簇启动时提供的参数。\n       \u003c/p\u003e\u003cp\u003e\n        对于大多数参数，这个选项可以在运行中的服务器上使用。不过，对于某些在运行时计算出的参数，服务器必须先关闭（例如 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE\"\u003eshared_memory_size\u003c/a\u003e、\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES\"\u003eshared_memory_size_in_huge_pages\u003c/a\u003e 和 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-preset.html#GUC-WAL-SEGMENT-SIZE\"\u003ewal_segment_size\u003c/a\u003e）。\n       \u003c/p\u003e\u003cp\u003e\n        该选项供其他与服务器实例交互的程序（例如 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pg-ctl.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e）查询配置参数值之用。面向用户的应用则应使用 \u003ca class=\"link\" href=\"/zh/docs/18/sql-show.html\"\u003e\u003ccode class=\"command\"\u003eSHOW\u003c/code\u003e\u003c/a\u003e 或 \u003ccode class=\"structname\"\u003epg_settings\u003c/code\u003e 视图。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edebug-level\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置调试级别。该值设得越高，写入服务器日志的调试输出就越多。取值范围是\n        1 到 5。还可以针对某个特定会话传入 \u003ccode class=\"literal\"\u003e-d\n        0\u003c/code\u003e，从而阻止父 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 进程的服务器日志级别传播到该会话。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatadir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定数据库配置文件在文件系统中的位置。详见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-file-locations.html\"\u003e第 19.2 节\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        将默认日期风格设置为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eEuropean\u003c/span\u003e”\u003c/span\u003e，即输入日期字段采用\n        \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e 顺序。这也会在某些日期输出格式中使日期显示为日在月前。更多信息见\u003ca class=\"xref\" href=\"/zh/docs/18/datatype-datetime.html\"\u003e第 8.5 节\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        禁用 \u003ccode class=\"function\"\u003efsync\u003c/code\u003e 调用以提高性能，但在系统崩溃时会有数据损坏的风险。指定此选项等效于禁用 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-wal.html#GUC-FSYNC\"\u003efsync\u003c/a\u003e 配置参数。使用前请先阅读详细文档！\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 用来侦听来自客户端应用的 TCP/IP\n        连接的 IP 主机名或地址。该值也可以是逗号分隔的地址列表，或者用\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 指定侦听所有可用接口。空值表示不侦听任何 IP 地址，在这种情况下只能使用 Unix 域套接字连接到服务器。默认只侦听\n        \u003cspan class=\"systemitem\"\u003elocalhost\u003c/span\u003e。指定此选项等效于设置 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e 配置参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许远程客户端通过 TCP/IP（Internet 域）连接。没有此选项时，只接受本地连接。该选项等效于在\n        \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 中，或通过 \u003ccode class=\"option\"\u003e-h\u003c/code\u003e 将\n        \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e 设置为\u003ccode class=\"literal\"\u003e*\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        该选项已被弃用，因为它无法访问 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e 的全部功能。通常最好直接设置 \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-k \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e 用来侦听客户端应用连接的 Unix 域套接字所在目录。该值也可以是逗号分隔的目录列表。空值表示不侦听任何 Unix 域套接字，在这种情况下只能使用 TCP/IP 套接字连接到服务器。默认值通常是\n        \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e，但可以在编译时更改。指定此选项等效于设置 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES\"\u003eunix_socket_directories\u003c/a\u003e 配置参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        启用使用 \u003cacronym class=\"acronym\"\u003eSSL\u003c/acronym\u003e 的安全连接。若要使用此选项，\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 必须在编译时启用\n        \u003cacronym class=\"acronym\"\u003eSSL\u003c/acronym\u003e 支持。关于使用 \u003cacronym class=\"acronym\"\u003eSSL\u003c/acronym\u003e 的更多信息，请参阅\u003ca class=\"xref\" href=\"/zh/docs/18/ssl-tcp.html\"\u003e第 18.9 节\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003emax-connections\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置该服务器将接受的最大客户端连接数。该参数的默认值由 \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e 自动选择。指定此选项等效于设置 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e 配置参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定 \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e\n        用来侦听客户端应用连接的 TCP/IP 端口或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量；如果 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 未设置，则默认值就是在编译期间确定的值（通常为 5432）。如果你指定了非默认端口，那么所有客户端应用都必须通过命令行选项或 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 指定相同的端口。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在每条命令结束时打印时间信息和其他统计信息。这对基准测试或者调整缓冲区数量很有用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003ework-mem\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定排序和 hash 表在转而使用临时磁盘文件之前可使用的基础内存量。请参阅\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY\"\u003e第 19.4.1 节\u003c/a\u003e中对 \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e 配置参数的说明。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打印 \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e 的版本并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置一个命名的运行时参数；这是 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 的较短形式。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--describe-config\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        该选项会以制表符分隔的 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 格式导出服务器内部配置变量、说明以及默认值。它主要是为管理工具设计的。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示 \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e 命令行参数的帮助并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\"\u003e\u003ch3\u003e半内部选项\u003c/h3\u003e\u003cp\u003e\n     这里描述的选项主要用于调试，并且在某些情况下可协助恢复严重损坏的数据库。在生产数据库环境中没有理由使用它们。这里列出这些选项，仅供 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n     系统开发者使用。此外，这些选项在未来版本中可能会更改或被移除，且不另行通知。\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f\u003c/code\u003e \u003ccode class=\"literal\"\u003e{ s | i | o | b | t | n | m | h }\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        禁止使用某些扫描和连接方法：\u003ccode class=\"literal\"\u003es\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003ei\u003c/code\u003e\n        分别禁用顺序扫描和索引扫描，\u003ccode class=\"literal\"\u003eo\u003c/code\u003e、\u003ccode class=\"literal\"\u003eb\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003et\u003c/code\u003e\n        分别禁用仅索引扫描、位图索引扫描和 TID 扫描，而 \u003ccode class=\"literal\"\u003en\u003c/code\u003e、\u003ccode class=\"literal\"\u003em\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eh\u003c/code\u003e\n        则分别禁用嵌套循环连接、归并连接和哈希连接。\n       \u003c/p\u003e\u003cp\u003e\n        顺序扫描和嵌套循环连接都无法被完全禁用；\u003ccode class=\"literal\"\u003e-fs\u003c/code\u003e 和\n        \u003ccode class=\"literal\"\u003e-fn\u003c/code\u003e 选项只是在优化器有其他选择时，尽量不使用这些计划类型。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许修改系统表的结构。该选项由\n        \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e 使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        读取系统表时忽略系统索引，但在修改表时仍然更新这些索引。这在从损坏的系统索引中恢复时很有用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e \u003ccode class=\"literal\"\u003epa[rser] | pl[anner] | e[xecutor]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打印与各个主要系统模块相关的每个查询的时间统计信息。该选项不能与 \u003ccode class=\"option\"\u003e-s\u003c/code\u003e 选项一起使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        该选项用于调试导致服务器进程异常终止的问题。在这种情况下，通常的策略是通过向所有其他服务器进程发送 \u003cspan class=\"systemitem\"\u003eSIGQUIT\u003c/span\u003e\n        信号，通知它们必须终止。使用此选项时，则会改为发送 \u003cspan class=\"systemitem\"\u003eSIGABRT\u003c/span\u003e，从而生成核心转储文件。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprotocol\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定特定会话要使用的前端/后端协议版本号。该选项仅供内部使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新服务器进程在完成认证过程后，会延迟这么多秒。这是为了给调试器附着到该服务器进程提供机会。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\"\u003e\u003ch3\u003e用于单用户模式的选项\u003c/h3\u003e\u003ca class=\"indexterm\"\u003e\u003c/a\u003e\u003cp\u003e\n     以下选项仅适用于单用户模式（见下文\u003ca class=\"xref\" href=\"/zh/docs/18/app-postgres.html#APP-POSTGRES-SINGLE-USER\"\u003e单用户模式\u003c/a\u003e）。\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        选择单用户模式。这必须是命令行上的第一个参数。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定要访问的数据库名称。这必须是命令行上的最后一个参数。如果省略，则默认为用户名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在执行前将所有命令回显到标准输出。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        使用“分号后跟两个换行符”而不是单个换行符，作为命令输入终止符。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        将所有服务器日志输出发送到 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e。只有将此选项作为命令行选项提供时，它才会生效。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/app-postgres.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","environment":[{"description":"Default character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.","name":"PGCLIENTENCODING"},{"description":"Default data directory location","name":"PGDATA"},{"description":"Default value of the DateStyle run-time parameter. (The use of this environment variable is deprecated.)","name":"PGDATESTYLE"},{"description":"Default port number (preferably set in the configuration file)","name":"PGPORT"}],"facts":[{"label":"Documented executable","value":"postgres"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Server applications"},{"label":"Option definition groups","value":"30"}],"facts_zh":[{"label":"手册中的可执行程序","value":"postgres"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"服务端程序"},{"label":"选项定义组","value":"30"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-POSTGRES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epostgres — \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.5.16.4.1\"\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server. In order for a client application to access a database it connects (over a network or locally) to a running \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance. The \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance then starts a separate server process to handle the connection.\u003c/p\u003e\n\u003cp\u003eOne \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance always manages the data of exactly one database cluster. A database cluster is a collection of databases that is stored at a common file system location (the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edata area\u003c/span\u003e”\u003c/span\u003e). More than one \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance can run on a system at one time, so long as they use different data areas and different communication ports (see below). When \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e starts it needs to know the location of the data area. The location must be specified by the \u003ccode class=\"option\"\u003e-D\u003c/code\u003e option or the \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e environment variable; there is no default. Typically, \u003ccode class=\"option\"\u003e-D\u003c/code\u003e or \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e points directly to the data area directory created by \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Other possible file layouts are discussed in \u003ca class=\"xref\" href=\"/docs/18/runtime-config-file-locations.html\" title=\"19.2. File Locations\"\u003eSection 19.2\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eBy default \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e starts in the foreground and prints log messages to the standard error stream. In practical applications \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e should be started as a background process, perhaps at boot time.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e command can also be called in single-user mode. The primary use for this mode is during bootstrapping by \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Sometimes it is used for debugging or disaster recovery; note that running a single-user server is not truly suitable for debugging the server, since no realistic interprocess communication and locking will happen. When invoked in single-user mode from the shell, the user can enter queries and the results will be printed to the screen, but in a form that is more useful for developers than end users. In the single-user mode, the session user will be set to the user with ID 1, and implicit superuser powers are granted to this user. This user does not actually have to exist, so the single-user mode can be used to manually recover from certain kinds of accidental damage to the system catalogs.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e accepts the following command-line arguments. For a detailed discussion of the options consult \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. You can save typing most of these options by setting up a configuration file. Some (safe) options can also be set from the connecting client in an application-dependent way to apply only for that session. For example, if the environment variable \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e is set, then \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e-based clients will pass that string to the server, which will interpret it as \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e command-line options.\u003c/p\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.3\"\u003e\n\u003ch3\u003eGeneral Purpose\u003c/h3\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-B \u003cem class=\"replaceable\"\u003e\u003ccode\u003enbuffers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\"\u003eshared_buffers\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter. The configuration parameters supported by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e are described in \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. Most of the other command line options are in fact short forms of such a parameter assignment. \u003ccode class=\"option\"\u003e-c\u003c/code\u003e can appear multiple times to set multiple parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrints the value of the named run-time parameter, and exits. (See the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option above for details.) This returns values from \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e, modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started.\u003c/p\u003e\n\u003cp\u003eThis can be used on a running server for most parameters. However, the server must be shut down for some runtime-computed parameters (e.g., \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE\"\u003eshared_memory_size\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES\"\u003eshared_memory_size_in_huge_pages\u003c/a\u003e, and \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-WAL-SEGMENT-SIZE\"\u003ewal_segment_size\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThis option is meant for other programs that interact with a server instance, such as \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, to query configuration parameter values. User-facing applications should instead use \u003ca class=\"link\" href=\"/docs/18/sql-show.html\" title=\"SHOW\"\u003e\u003ccode class=\"command\"\u003eSHOW\u003c/code\u003e\u003c/a\u003e or the \u003ccode class=\"structname\"\u003epg_settings\u003c/code\u003e view.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edebug-level\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass \u003ccode class=\"literal\"\u003e-d 0\u003c/code\u003e for a specific session, which will prevent the server log level of the parent \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e process from being propagated to this session.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatadir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file system location of the database configuration files. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-file-locations.html\" title=\"19.2. File Locations\"\u003eSection 19.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default date style to \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eEuropean\u003c/span\u003e”\u003c/span\u003e, that is \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html\" title=\"8.5. Date/Time Types\"\u003eSection 8.5\u003c/a\u003e for more information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisables \u003ccode class=\"function\"\u003efsync\u003c/code\u003e calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\"\u003efsync\u003c/a\u003e configuration parameter. Read the detailed documentation before using this!\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the IP host name or address on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or \u003ccode class=\"literal\"\u003e*\u003c/code\u003e to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on \u003cspan class=\"systemitem\"\u003elocalhost\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e to \u003ccode class=\"literal\"\u003e*\u003c/code\u003e in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e or via \u003ccode class=\"option\"\u003e-h\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is deprecated since it does not allow access to the full functionality of \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e. It's usually better to set \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e directly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-k \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory of the Unix-domain socket on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e, but that can be changed at build time. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES\"\u003eunix_socket_directories\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables secure connections using SSL. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e must have been compiled with support for SSL for this option to be available. For more information on using SSL, refer to \u003ca class=\"xref\" href=\"/docs/18/ssl-tcp.html\" title=\"18.9. Secure TCP/IP Connections with SSL\"\u003eSection 18.9\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003emax-connections\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP/IP port or local Unix domain socket file extension on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for connections from client applications. Defaults to the value of the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, or if \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003ework-mem\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e configuration parameter in \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY\" title=\"19.4.1. Memory\"\u003eSection 19.4.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter; a shorter form of \u003ccode class=\"option\"\u003e-c\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--describe-config\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e format. It is designed primarily for use by administration tools.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.4\"\u003e\n\u003ch3\u003eSemi-Internal Options\u003c/h3\u003e\n\u003cp\u003eThe options described here are used mainly for debugging purposes, and in some cases to assist with recovery of severely damaged databases. There should be no reason to use them in a production database setup. They are listed here only for use by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e system developers. Furthermore, these options might change or be removed in a future release without notice.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f\u003c/code\u003e \u003ccode class=\"literal\"\u003e{ s | i | o | b | t | n | m | h }\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForbids the use of particular scan and join methods: \u003ccode class=\"literal\"\u003es\u003c/code\u003e and \u003ccode class=\"literal\"\u003ei\u003c/code\u003e disable sequential and index scans respectively, \u003ccode class=\"literal\"\u003eo\u003c/code\u003e, \u003ccode class=\"literal\"\u003eb\u003c/code\u003e and \u003ccode class=\"literal\"\u003et\u003c/code\u003e disable index-only scans, bitmap index scans, and TID scans respectively, while \u003ccode class=\"literal\"\u003en\u003c/code\u003e, \u003ccode class=\"literal\"\u003em\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eh\u003c/code\u003e disable nested-loop, merge and hash joins respectively.\u003c/p\u003e\n\u003cp\u003eNeither sequential scans nor nested-loop joins can be disabled completely; the \u003ccode class=\"literal\"\u003e-fs\u003c/code\u003e and \u003ccode class=\"literal\"\u003e-fn\u003c/code\u003e options simply discourage the optimizer from using those plan types if it has any other alternative.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows the structure of system tables to be modified. This is used by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIgnore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e \u003ccode class=\"literal\"\u003epa[rser] | pl[anner] | e[xecutor]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint timing statistics for each query relating to each of the major system modules. This option cannot be used together with the \u003ccode class=\"option\"\u003e-s\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them \u003cspan class=\"systemitem\"\u003eSIGQUIT\u003c/span\u003e signals. With this option, \u003cspan class=\"systemitem\"\u003eSIGABRT\u003c/span\u003e will be sent instead, resulting in production of core dump files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprotocol\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eA delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.5\"\u003e\n\u003ch3\u003eOptions for Single-User Mode\u003c/h3\u003e\n\u003cp\u003eThe following options only apply to the single-user mode (see \u003ca class=\"xref\" href=\"/docs/18/app-postgres.html#APP-POSTGRES-SINGLE-USER\" title=\"Single-User Mode\"\u003eSingle-User Mode\u003c/a\u003e below).\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the single-user mode. This must be the first argument on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be accessed. This must be the last argument on the command line. If it is omitted it defaults to the user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho all commands to standard output before executing them.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse semicolon followed by two newlines, rather than just newline, as the command entry terminator.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend all server log output to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This option is only honored when supplied as a command-line option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault data directory location\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATESTYLE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault value of the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e run-time parameter. (The use of this environment variable is deprecated.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault port number (preferably set in the configuration file)\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eA failure message mentioning \u003ccode class=\"literal\"\u003esemget\u003c/code\u003e or \u003ccode class=\"literal\"\u003eshmget\u003c/code\u003e probably indicates you need to configure your kernel to provide adequate shared memory and semaphores. For more discussion see \u003ca class=\"xref\" href=\"/docs/18/kernel-resources.html\" title=\"18.4. Managing Kernel Resources\"\u003eSection 18.4\u003c/a\u003e. You might be able to postpone reconfiguring your kernel by decreasing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\"\u003eshared_buffers\u003c/a\u003e to reduce the shared memory consumption of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, and/or by reducing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e to reduce the semaphore consumption.\u003c/p\u003e\n\u003cp\u003eA failure message suggesting that another server is already running should be checked carefully, for example by using the command\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eps ax | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eps -ef | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003edepending on your system. If you are certain that no conflicting server is running, you can remove the lock file mentioned in the message and try again.\u003c/p\u003e\n\u003cp\u003eA failure message indicating inability to bind to a port might indicate that that port is already in use by some non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e process. You might also get this error if you terminate \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e and immediately restart it using the same port; in this case, you must simply wait a few seconds until the operating system closes the port before trying again. Finally, you might get this error if you specify a port number that your operating system considers to be reserved. For example, many versions of Unix consider port numbers under 1024 to be \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003etrusted\u003c/span\u003e”\u003c/span\u003e and only permit the Unix superuser to access them.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eThe utility command \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to start and shut down the \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server safely and comfortably.\u003c/p\u003e\n\u003cp\u003eIf at all possible, \u003cspan class=\"emphasis\"\u003e\u003cem\u003edo not\u003c/em\u003e\u003c/span\u003e use \u003ccode class=\"literal\"\u003eSIGKILL\u003c/code\u003e to kill the main \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server. Doing so will prevent \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e from freeing the system resources (e.g., shared memory and semaphores) that it holds before terminating. This might cause problems for starting a fresh \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e run.\u003c/p\u003e\n\u003cp\u003eTo terminate the \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server normally, the signals \u003ccode class=\"literal\"\u003eSIGTERM\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSIGINT\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eSIGQUIT\u003c/code\u003e can be used. The first will wait for all clients to terminate before quitting, the second will forcefully disconnect all clients, and the third will quit immediately without proper shutdown, resulting in a recovery run during restart.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"literal\"\u003eSIGHUP\u003c/code\u003e signal will reload the server configuration files. It is also possible to send \u003ccode class=\"literal\"\u003eSIGHUP\u003c/code\u003e to an individual server process, but that is usually not sensible.\u003c/p\u003e\n\u003cp\u003eTo cancel a running query, send the \u003ccode class=\"literal\"\u003eSIGINT\u003c/code\u003e signal to the process running that command. To terminate a backend process cleanly, send \u003ccode class=\"literal\"\u003eSIGTERM\u003c/code\u003e to that process. See also \u003ccode class=\"function\"\u003epg_cancel_backend\u003c/code\u003e and \u003ccode class=\"function\"\u003epg_terminate_backend\u003c/code\u003e in \u003ca class=\"xref\" href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL\" title=\"9.28.2. Server Signaling Functions\"\u003eSection 9.28.2\u003c/a\u003e for the SQL-callable equivalents of these two actions.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server uses \u003ccode class=\"literal\"\u003eSIGQUIT\u003c/code\u003e to tell subordinate server processes to terminate without normal cleanup. This signal \u003cspan class=\"emphasis\"\u003e\u003cem\u003eshould not\u003c/em\u003e\u003c/span\u003e be used by users. It is also unwise to send \u003ccode class=\"literal\"\u003eSIGKILL\u003c/code\u003e to a server process — the main \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e process will interpret this as a crash and will force all the sibling processes to quit as part of its standard crash-recovery procedure.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-BUGS\"\u003e\n\u003ch2\u003eBugs\u003c/h2\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--\u003c/code\u003e options will not work on \u003cspan class=\"systemitem\"\u003eFreeBSD\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003eOpenBSD\u003c/span\u003e. Use \u003ccode class=\"option\"\u003e-c\u003c/code\u003e instead. This is a bug in the affected operating systems; a future release of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will provide a workaround if this is not fixed.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-SINGLE-USER\"\u003e\n\u003ch2\u003eSingle-User Mode\u003c/h2\u003e\n\u003cp\u003eTo start a single-user mode server, use a command like\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres --single -D /usr/local/pgsql/data \u003cem class=\"replaceable\"\u003e\u003ccode\u003eother-options\u003c/code\u003e\u003c/em\u003e my_database\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eProvide the correct path to the database directory with \u003ccode class=\"option\"\u003e-D\u003c/code\u003e, or make sure that the environment variable \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e is set. Also specify the name of the particular database you want to work in.\u003c/p\u003e\n\u003cp\u003eNormally, the single-user mode server treats newline as the command entry terminator; there is no intelligence about semicolons, as there is in \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. To continue a command across multiple lines, you must type backslash just before each newline except the last one. The backslash and adjacent newline are both dropped from the input command. Note that this will happen even when within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eBut if you use the \u003ccode class=\"option\"\u003e-j\u003c/code\u003e command line switch, a single newline does not terminate command entry; instead, the sequence semicolon-newline-newline does. That is, type a semicolon immediately followed by a completely empty line. Backslash-newline is not treated specially in this mode. Again, there is no intelligence about such a sequence appearing within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eIn either input mode, if you type a semicolon that is not just before or part of a command entry terminator, it is considered a command separator. When you do type a command entry terminator, the multiple statements you've entered will be executed as a single transaction.\u003c/p\u003e\n\u003cp\u003eTo quit the session, type EOF (\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e, usually). If you've entered any text since the last command entry terminator, then EOF will be taken as a command entry terminator, and another EOF will be needed to exit.\u003c/p\u003e\n\u003cp\u003eNote that the single-user mode server does not provide sophisticated line-editing features (no command history, for example). Single-user mode also does not do any background processing, such as automatic checkpoints or replication.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo start \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e in the background using default values, type:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003enohup postgres \u0026gt;logfile 2\u0026gt;\u0026amp;1 \u0026lt;/dev/null \u0026amp;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo start \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e with a specific port, e.g., 1234:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo connect to this server using \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, specify this port with the -p option:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor set the environment variable \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eexport PGPORT=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eNamed run-time parameters can be set in either of these styles:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres -c work_mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres --work-mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eEither form overrides whatever setting might exist for \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e. Notice that underscores in parameter names can be written as either underscore or dash on the command line. Except for short-term experiments, it's probably better practice to edit the setting in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e than to rely on a command-line switch to set a parameter.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.13\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-postgres.html","options":[{"description":"Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the shared_buffers configuration parameter.","names":["-B nbuffers"],"signature":"-B nbuffers","source_url":"/docs/18/app-postgres.html","summary":"Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the shared_buffers configuration parameter."},{"description":"Sets a named run-time parameter. The configuration parameters supported by PostgreSQL are described in Chapter 19 . Most of the other command line options are in fact short forms of such a parameter assignment. -c can appear multiple times to set multiple parameters.","names":["-c name = value"],"signature":"-c name = value","source_url":"/docs/18/app-postgres.html","summary":"Sets a named run-time parameter. The configuration parameters supported by PostgreSQL are described in Chapter 19 . Most of the other command line options are in fact short forms of such a parameter assignment. -c can appear multiple times to set multiple parameters."},{"description":"Prints the value of the named run-time parameter, and exits. (See the -c option above for details.) This returns values from postgresql.conf , modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started. This can be used on a running server for most parameters. However, the server must be shut down for some runtime-computed parameters (e.g., shared_memory_size , shared_memory_size_in_huge_pages , and wal_segment_size ). This option is meant for other programs that interact with a server instance, such as pg_ctl , to query configuration parameter values. User-facing applications should instead use SHOW or the pg_settings view.","names":["-C name"],"signature":"-C name","source_url":"/docs/18/app-postgres.html","summary":"Prints the value of the named run-time parameter, and exits. (See the -c option above for details.) This returns values from postgresql.conf , modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started."},{"description":"Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass -d 0 for a specific session, which will prevent the server log level of the parent postgres process from being propagated to this session.","names":["-d debug-level"],"signature":"-d debug-level","source_url":"/docs/18/app-postgres.html","summary":"Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass -d 0 for a specific session, which will prevent the server log level of the parent postgres process from being propagated to this session."},{"description":"Specifies the file system location of the database configuration files. See Section 19.2 for details.","names":["-D datadir"],"signature":"-D datadir","source_url":"/docs/18/app-postgres.html","summary":"Specifies the file system location of the database configuration files. See Section 19.2 for details."},{"description":"Sets the default date style to “ European ” , that is DMY ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See Section 8.5 for more information.","names":["-e"],"signature":"-e","source_url":"/docs/18/app-postgres.html","summary":"Sets the default date style to “ European ” , that is DMY ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See Section 8.5 for more information."},{"description":"Disables fsync calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the fsync configuration parameter. Read the detailed documentation before using this!","names":["-F"],"signature":"-F","source_url":"/docs/18/app-postgres.html","summary":"Disables fsync calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the fsync configuration parameter. Read the detailed documentation before using this!"},{"description":"Specifies the IP host name or address on which postgres is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or * to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on localhost . Specifying this option is equivalent to setting the listen_addresses configuration parameter.","names":["-h hostname"],"signature":"-h hostname","source_url":"/docs/18/app-postgres.html","summary":"Specifies the IP host name or address on which postgres is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or * to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on localhost . Specifying this option is equivalent to setting the listen_addresses configuration parameter."},{"description":"Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h . This option is deprecated since it does not allow access to the full functionality of listen_addresses . It's usually better to set listen_addresses directly.","names":["-i"],"signature":"-i","source_url":"/docs/18/app-postgres.html","summary":"Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h ."},{"description":"Specifies the directory of the Unix-domain socket on which postgres is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp , but that can be changed at build time. Specifying this option is equivalent to setting the unix_socket_directories configuration parameter.","names":["-k directory"],"signature":"-k directory","source_url":"/docs/18/app-postgres.html","summary":"Specifies the directory of the Unix-domain socket on which postgres is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp , but that can be changed at build time. Specifying this option is equivalent to setting the unix_socket_directories configuration parameter."},{"description":"Enables secure connections using SSL . PostgreSQL must have been compiled with support for SSL for this option to be available. For more information on using SSL , refer to Section 18.9 .","names":["-l"],"signature":"-l","source_url":"/docs/18/app-postgres.html","summary":"Enables secure connections using SSL . PostgreSQL must have been compiled with support for SSL for this option to be available. For more information on using SSL , refer to Section 18.9 ."},{"description":"Sets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the max_connections configuration parameter.","names":["-N max-connections"],"signature":"-N max-connections","source_url":"/docs/18/app-postgres.html","summary":"Sets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the max_connections configuration parameter."},{"description":"Specifies the TCP/IP port or local Unix domain socket file extension on which postgres is to listen for connections from client applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or PGPORT .","names":["-p port"],"signature":"-p port","source_url":"/docs/18/app-postgres.html","summary":"Specifies the TCP/IP port or local Unix domain socket file extension on which postgres is to listen for connections from client applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or PGPORT ."},{"description":"Print time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers.","names":["-s"],"signature":"-s","source_url":"/docs/18/app-postgres.html","summary":"Print time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers."},{"description":"Specifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the work_mem configuration parameter in Section 19.4.1 .","names":["-S"],"signature":"-S work-mem","source_url":"/docs/18/app-postgres.html","summary":"Specifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the work_mem configuration parameter in Section 19.4.1 ."},{"description":"Print the postgres version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-postgres.html","summary":"Print the postgres version and exit."},{"description":"Sets a named run-time parameter; a shorter form of -c .","names":["-- name = value"],"signature":"-- name = value","source_url":"/docs/18/app-postgres.html","summary":"Sets a named run-time parameter; a shorter form of -c ."},{"description":"This option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited COPY format. It is designed primarily for use by administration tools.","names":["--describe-config"],"signature":"--describe-config","source_url":"/docs/18/app-postgres.html","summary":"This option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited COPY format. It is designed primarily for use by administration tools."},{"description":"Show help about postgres command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-postgres.html","summary":"Show help about postgres command line arguments, and exit."},{"description":"Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, o , b and t disable index-only scans, bitmap index scans, and TID scans respectively, while n , m , and h disable nested-loop, merge and hash joins respectively. 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.","names":["-f"],"signature":"-f { s | i | o | b | t | n | m | h }","source_url":"/docs/18/app-postgres.html","summary":"Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, o , b and t disable index-only scans, bitmap index scans, and TID scans respectively, while n , m , and h disable nested-loop, merge and hash joins respectively."},{"description":"Allows the structure of system tables to be modified. This is used by initdb .","names":["-O"],"signature":"-O","source_url":"/docs/18/app-postgres.html","summary":"Allows the structure of system tables to be modified. This is used by initdb ."},{"description":"Ignore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes.","names":["-P"],"signature":"-P","source_url":"/docs/18/app-postgres.html","summary":"Ignore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes."},{"description":"Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the -s option.","names":["-t"],"signature":"-t pa[rser] | pl[anner] | e[xecutor]","source_url":"/docs/18/app-postgres.html","summary":"Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the -s option."},{"description":"This option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them SIGQUIT signals. With this option, SIGABRT will be sent instead, resulting in production of core dump files.","names":["-T"],"signature":"-T","source_url":"/docs/18/app-postgres.html","summary":"This option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them SIGQUIT signals. With this option, SIGABRT will be sent instead, resulting in production of core dump files."},{"description":"Specifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only.","names":["-v"],"signature":"-v protocol","source_url":"/docs/18/app-postgres.html","summary":"Specifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only."},{"description":"A delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger.","names":["-W"],"signature":"-W seconds","source_url":"/docs/18/app-postgres.html","summary":"A delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger."},{"description":"Selects the single-user mode. This must be the first argument on the command line.","names":["--single"],"signature":"--single","source_url":"/docs/18/app-postgres.html","summary":"Selects the single-user mode. This must be the first argument on the command line."},{"description":"Echo all commands to standard output before executing them.","names":["-E"],"signature":"-E","source_url":"/docs/18/app-postgres.html","summary":"Echo all commands to standard output before executing them."},{"description":"Use semicolon followed by two newlines, rather than just newline, as the command entry terminator.","names":["-j"],"signature":"-j","source_url":"/docs/18/app-postgres.html","summary":"Use semicolon followed by two newlines, rather than just newline, as the command entry terminator."},{"description":"Send all server log output to filename . This option is only honored when supplied as a command-line option.","names":["-r"],"signature":"-r filename","source_url":"/docs/18/app-postgres.html","summary":"Send all server log output to filename . This option is only honored when supplied as a command-line option."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"postgres [ option ...]","sources":[{"anchor":"","file":"app-postgres.html","label":"18.6 English manual · app-postgres.html","sha256":"7cc002e0a51fcdb1577e15fe6c728be6ed61dc0e6575c078234f0cbec1c7005d","url":"/docs/18/app-postgres.html"},{"anchor":"","file":"reference-server.html","label":"Server applications inventory","sha256":"e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3","url":"/docs/18/reference-server.html"}],"synopsis":["postgres [ option ...]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-B nbuffers","url":"/docs/18/app-postgres.html"},"summary":"Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the shared_buffers configuration parameter."},{"signature":{"text":"-c name = value","url":"/docs/18/app-postgres.html"},"summary":"Sets a named run-time parameter. The configuration parameters supported by PostgreSQL are described in Chapter 19 . Most of the other command line options are in fact short forms of such a parameter assignment. -c can appear multiple times to set multiple parameters."},{"signature":{"text":"-C name","url":"/docs/18/app-postgres.html"},"summary":"Prints the value of the named run-time parameter, and exits. (See the -c option above for details.) This returns values from postgresql.conf , modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started."},{"signature":{"text":"-d debug-level","url":"/docs/18/app-postgres.html"},"summary":"Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass -d 0 for a specific session, which will prevent the server log level of the parent postgres process from being propagated to this session."},{"signature":{"text":"-D datadir","url":"/docs/18/app-postgres.html"},"summary":"Specifies the file system location of the database configuration files. See Section 19.2 for details."},{"signature":{"text":"-e","url":"/docs/18/app-postgres.html"},"summary":"Sets the default date style to “ European ” , that is DMY ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See Section 8.5 for more information."},{"signature":{"text":"-F","url":"/docs/18/app-postgres.html"},"summary":"Disables fsync calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the fsync configuration parameter. Read the detailed documentation before using this!"},{"signature":{"text":"-h hostname","url":"/docs/18/app-postgres.html"},"summary":"Specifies the IP host name or address on which postgres is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or * to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on localhost . Specifying this option is equivalent to setting the listen_addresses configuration parameter."},{"signature":{"text":"-i","url":"/docs/18/app-postgres.html"},"summary":"Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h ."},{"signature":{"text":"-k directory","url":"/docs/18/app-postgres.html"},"summary":"Specifies the directory of the Unix-domain socket on which postgres is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp , but that can be changed at build time. Specifying this option is equivalent to setting the unix_socket_directories configuration parameter."},{"signature":{"text":"-l","url":"/docs/18/app-postgres.html"},"summary":"Enables secure connections using SSL . PostgreSQL must have been compiled with support for SSL for this option to be available. For more information on using SSL , refer to Section 18.9 ."},{"signature":{"text":"-N max-connections","url":"/docs/18/app-postgres.html"},"summary":"Sets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the max_connections configuration parameter."},{"signature":{"text":"-p port","url":"/docs/18/app-postgres.html"},"summary":"Specifies the TCP/IP port or local Unix domain socket file extension on which postgres is to listen for connections from client applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or PGPORT ."},{"signature":{"text":"-s","url":"/docs/18/app-postgres.html"},"summary":"Print time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers."},{"signature":{"text":"-S work-mem","url":"/docs/18/app-postgres.html"},"summary":"Specifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the work_mem configuration parameter in Section 19.4.1 ."},{"signature":{"text":"-V --version","url":"/docs/18/app-postgres.html"},"summary":"Print the postgres version and exit."},{"signature":{"text":"-- name = value","url":"/docs/18/app-postgres.html"},"summary":"Sets a named run-time parameter; a shorter form of -c ."},{"signature":{"text":"--describe-config","url":"/docs/18/app-postgres.html"},"summary":"This option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited COPY format. It is designed primarily for use by administration tools."},{"signature":{"text":"-? --help","url":"/docs/18/app-postgres.html"},"summary":"Show help about postgres command line arguments, and exit."},{"signature":{"text":"-f { s | i | o | b | t | n | m | h }","url":"/docs/18/app-postgres.html"},"summary":"Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, o , b and t disable index-only scans, bitmap index scans, and TID scans respectively, while n , m , and h disable nested-loop, merge and hash joins respectively."},{"signature":{"text":"-O","url":"/docs/18/app-postgres.html"},"summary":"Allows the structure of system tables to be modified. This is used by initdb ."},{"signature":{"text":"-P","url":"/docs/18/app-postgres.html"},"summary":"Ignore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes."},{"signature":{"text":"-t pa[rser] | pl[anner] | e[xecutor]","url":"/docs/18/app-postgres.html"},"summary":"Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the -s option."},{"signature":{"text":"-T","url":"/docs/18/app-postgres.html"},"summary":"This option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them SIGQUIT signals. With this option, SIGABRT will be sent instead, resulting in production of core dump files."},{"signature":{"text":"-v protocol","url":"/docs/18/app-postgres.html"},"summary":"Specifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only."},{"signature":{"text":"-W seconds","url":"/docs/18/app-postgres.html"},"summary":"A delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger."},{"signature":{"text":"--single","url":"/docs/18/app-postgres.html"},"summary":"Selects the single-user mode. This must be the first argument on the command line."},{"signature":{"text":"-E","url":"/docs/18/app-postgres.html"},"summary":"Echo all commands to standard output before executing them."},{"signature":{"text":"-j","url":"/docs/18/app-postgres.html"},"summary":"Use semicolon followed by two newlines, rather than just newline, as the command entry terminator."},{"signature":{"text":"-r filename","url":"/docs/18/app-postgres.html"},"summary":"Send all server log output to filename . This option is only honored when supplied as a command-line option."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.","name":"PGCLIENTENCODING"},{"description":"Default data directory location","name":"PGDATA"},{"description":"Default value of the DateStyle run-time parameter. (The use of this environment variable is deprecated.)","name":"PGDATESTYLE"},{"description":"Default port number (preferably set in the configuration file)","name":"PGPORT"}],"title":"Environment variables"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-B nbuffers","url":"/docs/18/app-postgres.html"},"summary":"设置供服务器进程使用的共享缓冲区数量。该参数的默认值由 initdb 自动选择。指定此选项等效于设置 shared_buffers 配置参数。"},{"signature":{"text":"-c name = value","url":"/docs/18/app-postgres.html"},"summary":"设置一个命名的运行时参数。 PostgreSQL 支持的配置参数见 第 19 章 。大多数其他命令行选项实际上都是这种参数赋值的简写形式。 -c 可以出现多次以设置多个参数。"},{"signature":{"text":"-C name","url":"/docs/18/app-postgres.html"},"summary":"打印指定运行时参数的值并退出。（详情见上面的 -c 选项。）这会返回 postgresql.conf 中的值，并应用本次调用中提供的任何参数修改。它不反映集簇启动时提供的参数。"},{"signature":{"text":"-d debug-level","url":"/docs/18/app-postgres.html"},"summary":"设置调试级别。值越大，写入服务器日志的调试输出越多。取值范围为 1 到 5。也可以为特定会话传入 -d 0，阻止父 postgres 进程的服务器日志级别传播到该会话。"},{"signature":{"text":"-D datadir","url":"/docs/18/app-postgres.html"},"summary":"指定数据库配置文件在文件系统中的位置。详见 第 19.2 节 。"},{"signature":{"text":"-e","url":"/docs/18/app-postgres.html"},"summary":"将默认日期风格设置为 “ European ” ，即输入日期字段采用 DMY 顺序。这也会在某些日期输出格式中使日期显示为日在月前。更多信息见 第 8.5 节 。"},{"signature":{"text":"-F","url":"/docs/18/app-postgres.html"},"summary":"禁用 fsync 调用以提高性能，但在系统崩溃时会有数据损坏的风险。指定此选项等效于禁用 fsync 配置参数。使用前请先阅读详细文档！"},{"signature":{"text":"-h hostname","url":"/docs/18/app-postgres.html"},"summary":"指定 postgres 用来侦听来自客户端应用的 TCP/IP 连接的 IP 主机名或地址。该值也可以是逗号分隔的地址列表，或者用 * 指定侦听所有可用接口。空值表示不侦听任何 IP 地址，在这种情况下只能使用 Unix 域套接字连接到服务器。默认只侦听 localhost 。指定此选项等效于设置 listen_addresses 配置参数。"},{"signature":{"text":"-i","url":"/docs/18/app-postgres.html"},"summary":"允许远程客户端通过 TCP/IP（互联网域）连接。没有此选项时，只接受本地连接。此选项等同于在 postgresql.conf 中或通过 -h 将 listen_addresses 设为 *。"},{"signature":{"text":"-k directory","url":"/docs/18/app-postgres.html"},"summary":"指定 postgres 用来侦听客户端应用连接的 Unix 域套接字所在目录。该值也可以是逗号分隔的目录列表。空值表示不侦听任何 Unix 域套接字，在这种情况下只能使用 TCP/IP 套接字连接到服务器。默认值通常是 /tmp ，但可以在编译时更改。指定此选项等效于设置 unix_socket_directories 配置参数。"},{"signature":{"text":"-l","url":"/docs/18/app-postgres.html"},"summary":"启用使用 SSL 的安全连接。若要使用此选项， PostgreSQL 必须在编译时启用 SSL 支持。关于使用 SSL 的更多信息，请参阅 第 18.9 节 。"},{"signature":{"text":"-N max-connections","url":"/docs/18/app-postgres.html"},"summary":"设置该服务器将接受的最大客户端连接数。该参数的默认值由 initdb 自动选择。指定此选项等效于设置 max_connections 配置参数。"},{"signature":{"text":"-p port","url":"/docs/18/app-postgres.html"},"summary":"指定 postgres 用来侦听客户端应用连接的 TCP/IP 端口或本地 Unix 域套接字文件扩展名。默认值取自 PGPORT 环境变量；如果 PGPORT 未设置，则默认值就是在编译期间确定的值（通常为 5432）。如果你指定了非默认端口，那么所有客户端应用都必须通过命令行选项或 PGPORT 指定相同的端口。"},{"signature":{"text":"-s","url":"/docs/18/app-postgres.html"},"summary":"在每条命令结束时打印时间信息和其他统计信息。这对基准测试或者调整缓冲区数量很有用。"},{"signature":{"text":"-S work-mem","url":"/docs/18/app-postgres.html"},"summary":"指定排序和 hash 表在转而使用临时磁盘文件之前可使用的基础内存量。请参阅 第 19.4.1 节 中对 work_mem 配置参数的说明。"},{"signature":{"text":"-V --version","url":"/docs/18/app-postgres.html"},"summary":"打印 postgres 的版本并退出。"},{"signature":{"text":"-- name = value","url":"/docs/18/app-postgres.html"},"summary":"设置一个命名的运行时参数；这是 -c 的较短形式。"},{"signature":{"text":"--describe-config","url":"/docs/18/app-postgres.html"},"summary":"该选项会以制表符分隔的 COPY 格式导出服务器内部配置变量、说明以及默认值。它主要是为管理工具设计的。"},{"signature":{"text":"-? --help","url":"/docs/18/app-postgres.html"},"summary":"显示 postgres 命令行参数的帮助并退出。"},{"signature":{"text":"-f { s | i | o | b | t | n | m | h }","url":"/docs/18/app-postgres.html"},"summary":"禁止使用某些扫描和连接方法： s 和 i 分别禁用顺序扫描和索引扫描， o 、 b 和 t 分别禁用仅索引扫描、位图索引扫描和 TID 扫描，而 n 、 m 和 h 则分别禁用嵌套循环连接、归并连接和哈希连接。"},{"signature":{"text":"-O","url":"/docs/18/app-postgres.html"},"summary":"允许修改系统表的结构。该选项由 initdb 使用。"},{"signature":{"text":"-P","url":"/docs/18/app-postgres.html"},"summary":"读取系统表时忽略系统索引，但在修改表时仍然更新这些索引。这在从损坏的系统索引中恢复时很有用。"},{"signature":{"text":"-t pa[rser] | pl[anner] | e[xecutor]","url":"/docs/18/app-postgres.html"},"summary":"打印与各个主要系统模块相关的每个查询的时间统计信息。该选项不能与 -s 选项一起使用。"},{"signature":{"text":"-T","url":"/docs/18/app-postgres.html"},"summary":"该选项用于调试导致服务器进程异常终止的问题。在这种情况下，通常的策略是通过向所有其他服务器进程发送 SIGQUIT 信号，通知它们必须终止。使用此选项时，则会改为发送 SIGABRT ，从而生成核心转储文件。"},{"signature":{"text":"-v protocol","url":"/docs/18/app-postgres.html"},"summary":"指定特定会话要使用的前端/后端协议版本号。该选项仅供内部使用。"},{"signature":{"text":"-W seconds","url":"/docs/18/app-postgres.html"},"summary":"新服务器进程在完成认证过程后，会延迟这么多秒。这是为了给调试器附着到该服务器进程提供机会。"},{"signature":{"text":"--single","url":"/docs/18/app-postgres.html"},"summary":"选择单用户模式。这必须是命令行上的第一个参数。"},{"signature":{"text":"-E","url":"/docs/18/app-postgres.html"},"summary":"在执行前将所有命令回显到标准输出。"},{"signature":{"text":"-j","url":"/docs/18/app-postgres.html"},"summary":"使用“分号后跟两个换行符”而不是单个换行符，作为命令输入终止符。"},{"signature":{"text":"-r filename","url":"/docs/18/app-postgres.html"},"summary":"将所有服务器日志输出发送到 filename 。只有将此选项作为命令行选项提供时，它才会生效。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"客户端使用的默认字符编码。（客户端可以单独覆盖它。）该值也可以在配置文件中设置。","name":"PGCLIENTENCODING"},{"description":"默认数据目录位置","name":"PGDATA"},{"description":"DateStyle 运行时参数的默认值。（该环境变量的用法已被弃用。）","name":"PGDATESTYLE"},{"description":"默认端口号（最好在配置文件中设置）","name":"PGPORT"}],"title":"环境变量"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"379dd7d95faa0f47e371e9889ef34d97de8eac7f887057811b83173c09eba6e8","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"59cd0d71e6eb952238aa2c87dce045a827759f72c80dccbb1cd2e2fef3fc8a92","locale":"zh-Hans","page_key":"app-postgres.html","source_hash":"7cf5803ee91273413478d3567584089e3eea85df5982b1235c03f93571f328e0","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-postgres.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"ManualEvidence":{"manual_path":"app-postgres.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-postgres.html","label":"18.6 English manual · app-postgres.html","sha256":"7cc002e0a51fcdb1577e15fe6c728be6ed61dc0e6575c078234f0cbec1c7005d","url":"/docs/18/app-postgres.html"},{"anchor":"","file":"reference-server.html","label":"Server applications inventory","sha256":"e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3","url":"/docs/18/reference-server.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"postgres","SourceDatabase":"center","Version":"18","Locale":"en","Title":"postgres","Summary":"postgres — PostgreSQL database server","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-POSTGRES\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epostgres — \u003cspan\u003ePostgreSQL\u003c/span\u003e database server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.5.16.4.1\"\u003e\u003ccode\u003epostgres\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003epostgres\u003c/code\u003e is the \u003cspan\u003ePostgreSQL\u003c/span\u003e database server. In order for a client application to access a database it connects (over a network or locally) to a running \u003ccode\u003epostgres\u003c/code\u003e instance. The \u003ccode\u003epostgres\u003c/code\u003e instance then starts a separate server process to handle the connection.\u003c/p\u003e\n\u003cp\u003eOne \u003ccode\u003epostgres\u003c/code\u003e instance always manages the data of exactly one database cluster. A database cluster is a collection of databases that is stored at a common file system location (the \u003cspan\u003e“\u003cspan\u003edata area\u003c/span\u003e”\u003c/span\u003e). More than one \u003ccode\u003epostgres\u003c/code\u003e instance can run on a system at one time, so long as they use different data areas and different communication ports (see below). When \u003ccode\u003epostgres\u003c/code\u003e starts it needs to know the location of the data area. The location must be specified by the \u003ccode\u003e-D\u003c/code\u003e option or the \u003ccode\u003ePGDATA\u003c/code\u003e environment variable; there is no default. Typically, \u003ccode\u003e-D\u003c/code\u003e or \u003ccode\u003ePGDATA\u003c/code\u003e points directly to the data area directory created by \u003ca href=\"/docs/18/app-initdb.html\" title=\"initdb\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Other possible file layouts are discussed in \u003ca href=\"/docs/18/runtime-config-file-locations.html\" rel=\"nofollow\"\u003eSection 19.2\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eBy default \u003ccode\u003epostgres\u003c/code\u003e starts in the foreground and prints log messages to the standard error stream. In practical applications \u003ccode\u003epostgres\u003c/code\u003e should be started as a background process, perhaps at boot time.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003epostgres\u003c/code\u003e command can also be called in single-user mode. The primary use for this mode is during bootstrapping by \u003ca href=\"/docs/18/app-initdb.html\" title=\"initdb\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Sometimes it is used for debugging or disaster recovery; note that running a single-user server is not truly suitable for debugging the server, since no realistic interprocess communication and locking will happen. When invoked in single-user mode from the shell, the user can enter queries and the results will be printed to the screen, but in a form that is more useful for developers than end users. In the single-user mode, the session user will be set to the user with ID 1, and implicit superuser powers are granted to this user. This user does not actually have to exist, so the single-user mode can be used to manually recover from certain kinds of accidental damage to the system catalogs.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-POSTGRES-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003epostgres\u003c/code\u003e accepts the following command-line arguments. For a detailed discussion of the options consult \u003ca href=\"/docs/18/runtime-config.html\" rel=\"nofollow\"\u003eChapter 19\u003c/a\u003e. You can save typing most of these options by setting up a configuration file. Some (safe) options can also be set from the connecting client in an application-dependent way to apply only for that session. For example, if the environment variable \u003ccode\u003ePGOPTIONS\u003c/code\u003e is set, then \u003cspan\u003elibpq\u003c/span\u003e-based clients will pass that string to the server, which will interpret it as \u003ccode\u003epostgres\u003c/code\u003e command-line options.\u003c/p\u003e\n\u003cdiv id=\"id-1.9.5.16.6.3\"\u003e\n\u003ch3\u003eGeneral Purpose\u003c/h3\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-B \u003cem\u003e\u003ccode\u003enbuffers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by \u003cspan\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\" rel=\"nofollow\"\u003eshared_buffers\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter. The configuration parameters supported by \u003cspan\u003ePostgreSQL\u003c/span\u003e are described in \u003ca href=\"/docs/18/runtime-config.html\" rel=\"nofollow\"\u003eChapter 19\u003c/a\u003e. Most of the other command line options are in fact short forms of such a parameter assignment. \u003ccode\u003e-c\u003c/code\u003e can appear multiple times to set multiple parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-C \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrints the value of the named run-time parameter, and exits. (See the \u003ccode\u003e-c\u003c/code\u003e option above for details.) This returns values from \u003ccode\u003epostgresql.conf\u003c/code\u003e, modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started.\u003c/p\u003e\n\u003cp\u003eThis can be used on a running server for most parameters. However, the server must be shut down for some runtime-computed parameters (e.g., \u003ca href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE\" rel=\"nofollow\"\u003eshared_memory_size\u003c/a\u003e, \u003ca href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES\" rel=\"nofollow\"\u003eshared_memory_size_in_huge_pages\u003c/a\u003e, and \u003ca href=\"/docs/18/runtime-config-preset.html#GUC-WAL-SEGMENT-SIZE\" rel=\"nofollow\"\u003ewal_segment_size\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThis option is meant for other programs that interact with a server instance, such as \u003ca href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, to query configuration parameter values. User-facing applications should instead use \u003ca href=\"/docs/18/sql-show.html\" title=\"SHOW\" rel=\"nofollow\"\u003e\u003ccode\u003eSHOW\u003c/code\u003e\u003c/a\u003e or the \u003ccode\u003epg_settings\u003c/code\u003e view.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003edebug-level\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass \u003ccode\u003e-d 0\u003c/code\u003e for a specific session, which will prevent the server log level of the parent \u003ccode\u003epostgres\u003c/code\u003e process from being propagated to this session.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-D \u003cem\u003e\u003ccode\u003edatadir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file system location of the database configuration files. See \u003ca href=\"/docs/18/runtime-config-file-locations.html\" rel=\"nofollow\"\u003eSection 19.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default date style to \u003cspan\u003e“\u003cspan\u003eEuropean\u003c/span\u003e”\u003c/span\u003e, that is \u003ccode\u003eDMY\u003c/code\u003e ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See \u003ca href=\"/docs/18/datatype-datetime.html\" rel=\"nofollow\"\u003eSection 8.5\u003c/a\u003e for more information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-F\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisables \u003ccode\u003efsync\u003c/code\u003e calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the \u003ca href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\" rel=\"nofollow\"\u003efsync\u003c/a\u003e configuration parameter. Read the detailed documentation before using this!\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the IP host name or address on which \u003ccode\u003epostgres\u003c/code\u003e is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or \u003ccode\u003e*\u003c/code\u003e to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on \u003cspan\u003elocalhost\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\" rel=\"nofollow\"\u003elisten_addresses\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting \u003ccode\u003elisten_addresses\u003c/code\u003e to \u003ccode\u003e*\u003c/code\u003e in \u003ccode\u003epostgresql.conf\u003c/code\u003e or via \u003ccode\u003e-h\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is deprecated since it does not allow access to the full functionality of \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\" rel=\"nofollow\"\u003elisten_addresses\u003c/a\u003e. It\u0026#39;s usually better to set \u003ccode\u003elisten_addresses\u003c/code\u003e directly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-k \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory of the Unix-domain socket on which \u003ccode\u003epostgres\u003c/code\u003e is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally \u003ccode\u003e/tmp\u003c/code\u003e, but that can be changed at build time. Specifying this option is equivalent to setting the \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES\" rel=\"nofollow\"\u003eunix_socket_directories\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-l\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables secure connections using SSL. \u003cspan\u003ePostgreSQL\u003c/span\u003e must have been compiled with support for SSL for this option to be available. For more information on using SSL, refer to \u003ca href=\"/docs/18/ssl-tcp.html\" rel=\"nofollow\"\u003eSection 18.9\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-N \u003cem\u003e\u003ccode\u003emax-connections\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by \u003cspan\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\" rel=\"nofollow\"\u003emax_connections\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP/IP port or local Unix domain socket file extension on which \u003ccode\u003epostgres\u003c/code\u003e is to listen for connections from client applications. Defaults to the value of the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, or if \u003ccode\u003ePGPORT\u003c/code\u003e is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or \u003ccode\u003ePGPORT\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S\u003c/code\u003e \u003cem\u003e\u003ccode\u003ework-mem\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the \u003ccode\u003ework_mem\u003c/code\u003e configuration parameter in \u003ca href=\"/docs/18/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY\" rel=\"nofollow\"\u003eSection 19.4.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003epostgres\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter; a shorter form of \u003ccode\u003e-c\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--describe-config\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option dumps out the server\u0026#39;s internal configuration variables, descriptions, and defaults in tab-delimited \u003ccode\u003eCOPY\u003c/code\u003e format. It is designed primarily for use by administration tools.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003epostgres\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.6.4\"\u003e\n\u003ch3\u003eSemi-Internal Options\u003c/h3\u003e\n\u003cp\u003eThe options described here are used mainly for debugging purposes, and in some cases to assist with recovery of severely damaged databases. There should be no reason to use them in a production database setup. They are listed here only for use by \u003cspan\u003ePostgreSQL\u003c/span\u003e system developers. Furthermore, these options might change or be removed in a future release without notice.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-f\u003c/code\u003e \u003ccode\u003e{ s | i | o | b | t | n | m | h }\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForbids the use of particular scan and join methods: \u003ccode\u003es\u003c/code\u003e and \u003ccode\u003ei\u003c/code\u003e disable sequential and index scans respectively, \u003ccode\u003eo\u003c/code\u003e, \u003ccode\u003eb\u003c/code\u003e and \u003ccode\u003et\u003c/code\u003e disable index-only scans, bitmap index scans, and TID scans respectively, while \u003ccode\u003en\u003c/code\u003e, \u003ccode\u003em\u003c/code\u003e, and \u003ccode\u003eh\u003c/code\u003e disable nested-loop, merge and hash joins respectively.\u003c/p\u003e\n\u003cp\u003eNeither sequential scans nor nested-loop joins can be disabled completely; the \u003ccode\u003e-fs\u003c/code\u003e and \u003ccode\u003e-fn\u003c/code\u003e options simply discourage the optimizer from using those plan types if it has any other alternative.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-O\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows the structure of system tables to be modified. This is used by \u003ccode\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-P\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIgnore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t\u003c/code\u003e \u003ccode\u003epa[rser] | pl[anner] | e[xecutor]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint timing statistics for each query relating to each of the major system modules. This option cannot be used together with the \u003ccode\u003e-s\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-T\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them \u003cspan\u003eSIGQUIT\u003c/span\u003e signals. With this option, \u003cspan\u003eSIGABRT\u003c/span\u003e will be sent instead, resulting in production of core dump files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e \u003cem\u003e\u003ccode\u003eprotocol\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e \u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eA delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.6.5\"\u003e\n\u003ch3\u003eOptions for Single-User Mode\u003c/h3\u003e\n\u003cp\u003eThe following options only apply to the single-user mode (see \u003ca href=\"/docs/18/app-postgres.html#APP-POSTGRES-SINGLE-USER\" title=\"Single-User Mode\" rel=\"nofollow\"\u003eSingle-User Mode\u003c/a\u003e below).\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--single\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the single-user mode. This must be the first argument on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003edatabase\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be accessed. This must be the last argument on the command line. If it is omitted it defaults to the user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho all commands to standard output before executing them.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-j\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse semicolon followed by two newlines, rather than just newline, as the command entry terminator.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-r\u003c/code\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend all server log output to \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This option is only honored when supplied as a command-line option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGCLIENTENCODING\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATA\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault data directory location\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATESTYLE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault value of the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\" rel=\"nofollow\"\u003eDateStyle\u003c/a\u003e run-time parameter. (The use of this environment variable is deprecated.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault port number (preferably set in the configuration file)\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eA failure message mentioning \u003ccode\u003esemget\u003c/code\u003e or \u003ccode\u003eshmget\u003c/code\u003e probably indicates you need to configure your kernel to provide adequate shared memory and semaphores. For more discussion see \u003ca href=\"/docs/18/kernel-resources.html\" rel=\"nofollow\"\u003eSection 18.4\u003c/a\u003e. You might be able to postpone reconfiguring your kernel by decreasing \u003ca href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\" rel=\"nofollow\"\u003eshared_buffers\u003c/a\u003e to reduce the shared memory consumption of \u003cspan\u003ePostgreSQL\u003c/span\u003e, and/or by reducing \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\" rel=\"nofollow\"\u003emax_connections\u003c/a\u003e to reduce the semaphore consumption.\u003c/p\u003e\n\u003cp\u003eA failure message suggesting that another server is already running should be checked carefully, for example by using the command\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eps ax | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eps -ef | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003edepending on your system. If you are certain that no conflicting server is running, you can remove the lock file mentioned in the message and try again.\u003c/p\u003e\n\u003cp\u003eA failure message indicating inability to bind to a port might indicate that that port is already in use by some non-\u003cspan\u003ePostgreSQL\u003c/span\u003e process. You might also get this error if you terminate \u003ccode\u003epostgres\u003c/code\u003e and immediately restart it using the same port; in this case, you must simply wait a few seconds until the operating system closes the port before trying again. Finally, you might get this error if you specify a port number that your operating system considers to be reserved. For example, many versions of Unix consider port numbers under 1024 to be \u003cspan\u003e“\u003cspan\u003etrusted\u003c/span\u003e”\u003c/span\u003e and only permit the Unix superuser to access them.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eThe utility command \u003ca href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to start and shut down the \u003ccode\u003epostgres\u003c/code\u003e server safely and comfortably.\u003c/p\u003e\n\u003cp\u003eIf at all possible, \u003cspan\u003e\u003cem\u003edo not\u003c/em\u003e\u003c/span\u003e use \u003ccode\u003eSIGKILL\u003c/code\u003e to kill the main \u003ccode\u003epostgres\u003c/code\u003e server. Doing so will prevent \u003ccode\u003epostgres\u003c/code\u003e from freeing the system resources (e.g., shared memory and semaphores) that it holds before terminating. This might cause problems for starting a fresh \u003ccode\u003epostgres\u003c/code\u003e run.\u003c/p\u003e\n\u003cp\u003eTo terminate the \u003ccode\u003epostgres\u003c/code\u003e server normally, the signals \u003ccode\u003eSIGTERM\u003c/code\u003e, \u003ccode\u003eSIGINT\u003c/code\u003e, or \u003ccode\u003eSIGQUIT\u003c/code\u003e can be used. The first will wait for all clients to terminate before quitting, the second will forcefully disconnect all clients, and the third will quit immediately without proper shutdown, resulting in a recovery run during restart.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003eSIGHUP\u003c/code\u003e signal will reload the server configuration files. It is also possible to send \u003ccode\u003eSIGHUP\u003c/code\u003e to an individual server process, but that is usually not sensible.\u003c/p\u003e\n\u003cp\u003eTo cancel a running query, send the \u003ccode\u003eSIGINT\u003c/code\u003e signal to the process running that command. To terminate a backend process cleanly, send \u003ccode\u003eSIGTERM\u003c/code\u003e to that process. See also \u003ccode\u003epg_cancel_backend\u003c/code\u003e and \u003ccode\u003epg_terminate_backend\u003c/code\u003e in \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL\" rel=\"nofollow\"\u003eSection 9.28.2\u003c/a\u003e for the SQL-callable equivalents of these two actions.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003epostgres\u003c/code\u003e server uses \u003ccode\u003eSIGQUIT\u003c/code\u003e to tell subordinate server processes to terminate without normal cleanup. This signal \u003cspan\u003e\u003cem\u003eshould not\u003c/em\u003e\u003c/span\u003e be used by users. It is also unwise to send \u003ccode\u003eSIGKILL\u003c/code\u003e to a server process — the main \u003ccode\u003epostgres\u003c/code\u003e process will interpret this as a crash and will force all the sibling processes to quit as part of its standard crash-recovery procedure.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-POSTGRES-BUGS\"\u003e\n\u003ch2\u003eBugs\u003c/h2\u003e\n\u003cp\u003eThe \u003ccode\u003e--\u003c/code\u003e options will not work on \u003cspan\u003eFreeBSD\u003c/span\u003e or \u003cspan\u003eOpenBSD\u003c/span\u003e. Use \u003ccode\u003e-c\u003c/code\u003e instead. This is a bug in the affected operating systems; a future release of \u003cspan\u003ePostgreSQL\u003c/span\u003e will provide a workaround if this is not fixed.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-POSTGRES-SINGLE-USER\"\u003e\n\u003ch2\u003eSingle-User Mode\u003c/h2\u003e\n\u003cp\u003eTo start a single-user mode server, use a command like\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003e\u003ccode\u003epostgres --single -D /usr/local/pgsql/data \u003cem\u003e\u003ccode\u003eother-options\u003c/code\u003e\u003c/em\u003e my_database\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eProvide the correct path to the database directory with \u003ccode\u003e-D\u003c/code\u003e, or make sure that the environment variable \u003ccode\u003ePGDATA\u003c/code\u003e is set. Also specify the name of the particular database you want to work in.\u003c/p\u003e\n\u003cp\u003eNormally, the single-user mode server treats newline as the command entry terminator; there is no intelligence about semicolons, as there is in \u003cspan\u003epsql\u003c/span\u003e. To continue a command across multiple lines, you must type backslash just before each newline except the last one. The backslash and adjacent newline are both dropped from the input command. Note that this will happen even when within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eBut if you use the \u003ccode\u003e-j\u003c/code\u003e command line switch, a single newline does not terminate command entry; instead, the sequence semicolon-newline-newline does. That is, type a semicolon immediately followed by a completely empty line. Backslash-newline is not treated specially in this mode. Again, there is no intelligence about such a sequence appearing within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eIn either input mode, if you type a semicolon that is not just before or part of a command entry terminator, it is considered a command separator. When you do type a command entry terminator, the multiple statements you\u0026#39;ve entered will be executed as a single transaction.\u003c/p\u003e\n\u003cp\u003eTo quit the session, type EOF (\u003cspan\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e, usually). If you\u0026#39;ve entered any text since the last command entry terminator, then EOF will be taken as a command entry terminator, and another EOF will be needed to exit.\u003c/p\u003e\n\u003cp\u003eNote that the single-user mode server does not provide sophisticated line-editing features (no command history, for example). Single-user mode also does not do any background processing, such as automatic checkpoints or replication.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-POSTGRES-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo start \u003ccode\u003epostgres\u003c/code\u003e in the background using default values, type:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003enohup postgres \u0026gt;logfile 2\u0026gt;\u0026amp;1 \u0026lt;/dev/null \u0026amp;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo start \u003ccode\u003epostgres\u003c/code\u003e with a specific port, e.g., 1234:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epostgres -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo connect to this server using \u003cspan\u003epsql\u003c/span\u003e, specify this port with the -p option:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epsql -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor set the environment variable \u003ccode\u003ePGPORT\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eexport PGPORT=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epsql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eNamed run-time parameters can be set in either of these styles:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epostgres -c work_mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epostgres --work-mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eEither form overrides whatever setting might exist for \u003ccode\u003ework_mem\u003c/code\u003e in \u003ccode\u003epostgresql.conf\u003c/code\u003e. Notice that underscores in parameter names can be written as either underscore or dash on the command line. Except for short-term experiments, it\u0026#39;s probably better practice to edit the setting in \u003ccode\u003epostgresql.conf\u003c/code\u003e than to rely on a command-line switch to set a parameter.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.16.13\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003e\u003ca href=\"/docs/18/app-initdb.html\" title=\"initdb\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"eafa5d2ea881102df14b10a8646677800fc490e53abe90af3c9e7a7bc88d6f2d","Payload":{"description":["postgres — PostgreSQL database server"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-POSTGRES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epostgres — \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.5.16.4.1\"\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server. In order for a client application to access a database it connects (over a network or locally) to a running \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance. The \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance then starts a separate server process to handle the connection.\u003c/p\u003e\n\u003cp\u003eOne \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance always manages the data of exactly one database cluster. A database cluster is a collection of databases that is stored at a common file system location (the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edata area\u003c/span\u003e”\u003c/span\u003e). More than one \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e instance can run on a system at one time, so long as they use different data areas and different communication ports (see below). When \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e starts it needs to know the location of the data area. The location must be specified by the \u003ccode class=\"option\"\u003e-D\u003c/code\u003e option or the \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e environment variable; there is no default. Typically, \u003ccode class=\"option\"\u003e-D\u003c/code\u003e or \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e points directly to the data area directory created by \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Other possible file layouts are discussed in \u003ca class=\"xref\" href=\"/docs/18/runtime-config-file-locations.html\" title=\"19.2. File Locations\"\u003eSection 19.2\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eBy default \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e starts in the foreground and prints log messages to the standard error stream. In practical applications \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e should be started as a background process, perhaps at boot time.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e command can also be called in single-user mode. The primary use for this mode is during bootstrapping by \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Sometimes it is used for debugging or disaster recovery; note that running a single-user server is not truly suitable for debugging the server, since no realistic interprocess communication and locking will happen. When invoked in single-user mode from the shell, the user can enter queries and the results will be printed to the screen, but in a form that is more useful for developers than end users. In the single-user mode, the session user will be set to the user with ID 1, and implicit superuser powers are granted to this user. This user does not actually have to exist, so the single-user mode can be used to manually recover from certain kinds of accidental damage to the system catalogs.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e accepts the following command-line arguments. For a detailed discussion of the options consult \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. You can save typing most of these options by setting up a configuration file. Some (safe) options can also be set from the connecting client in an application-dependent way to apply only for that session. For example, if the environment variable \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e is set, then \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e-based clients will pass that string to the server, which will interpret it as \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e command-line options.\u003c/p\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.3\"\u003e\n\u003ch3\u003eGeneral Purpose\u003c/h3\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-B \u003cem class=\"replaceable\"\u003e\u003ccode\u003enbuffers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\"\u003eshared_buffers\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter. The configuration parameters supported by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e are described in \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. Most of the other command line options are in fact short forms of such a parameter assignment. \u003ccode class=\"option\"\u003e-c\u003c/code\u003e can appear multiple times to set multiple parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrints the value of the named run-time parameter, and exits. (See the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option above for details.) This returns values from \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e, modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started.\u003c/p\u003e\n\u003cp\u003eThis can be used on a running server for most parameters. However, the server must be shut down for some runtime-computed parameters (e.g., \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE\"\u003eshared_memory_size\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES\"\u003eshared_memory_size_in_huge_pages\u003c/a\u003e, and \u003ca class=\"xref\" href=\"/docs/18/runtime-config-preset.html#GUC-WAL-SEGMENT-SIZE\"\u003ewal_segment_size\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThis option is meant for other programs that interact with a server instance, such as \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, to query configuration parameter values. User-facing applications should instead use \u003ca class=\"link\" href=\"/docs/18/sql-show.html\" title=\"SHOW\"\u003e\u003ccode class=\"command\"\u003eSHOW\u003c/code\u003e\u003c/a\u003e or the \u003ccode class=\"structname\"\u003epg_settings\u003c/code\u003e view.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edebug-level\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass \u003ccode class=\"literal\"\u003e-d 0\u003c/code\u003e for a specific session, which will prevent the server log level of the parent \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e process from being propagated to this session.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatadir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file system location of the database configuration files. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-file-locations.html\" title=\"19.2. File Locations\"\u003eSection 19.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default date style to \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eEuropean\u003c/span\u003e”\u003c/span\u003e, that is \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html\" title=\"8.5. Date/Time Types\"\u003eSection 8.5\u003c/a\u003e for more information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisables \u003ccode class=\"function\"\u003efsync\u003c/code\u003e calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\"\u003efsync\u003c/a\u003e configuration parameter. Read the detailed documentation before using this!\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the IP host name or address on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or \u003ccode class=\"literal\"\u003e*\u003c/code\u003e to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on \u003cspan class=\"systemitem\"\u003elocalhost\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e to \u003ccode class=\"literal\"\u003e*\u003c/code\u003e in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e or via \u003ccode class=\"option\"\u003e-h\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is deprecated since it does not allow access to the full functionality of \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-LISTEN-ADDRESSES\"\u003elisten_addresses\u003c/a\u003e. It's usually better to set \u003ccode class=\"varname\"\u003elisten_addresses\u003c/code\u003e directly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-k \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory of the Unix-domain socket on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e, but that can be changed at build time. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES\"\u003eunix_socket_directories\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables secure connections using SSL. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e must have been compiled with support for SSL for this option to be available. For more information on using SSL, refer to \u003ca class=\"xref\" href=\"/docs/18/ssl-tcp.html\" title=\"18.9. Secure TCP/IP Connections with SSL\"\u003eSection 18.9\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003emax-connections\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e. Specifying this option is equivalent to setting the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e configuration parameter.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP/IP port or local Unix domain socket file extension on which \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e is to listen for connections from client applications. Defaults to the value of the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, or if \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003ework-mem\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e configuration parameter in \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY\" title=\"19.4.1. Memory\"\u003eSection 19.4.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets a named run-time parameter; a shorter form of \u003ccode class=\"option\"\u003e-c\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--describe-config\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e format. It is designed primarily for use by administration tools.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epostgres\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.4\"\u003e\n\u003ch3\u003eSemi-Internal Options\u003c/h3\u003e\n\u003cp\u003eThe options described here are used mainly for debugging purposes, and in some cases to assist with recovery of severely damaged databases. There should be no reason to use them in a production database setup. They are listed here only for use by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e system developers. Furthermore, these options might change or be removed in a future release without notice.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f\u003c/code\u003e \u003ccode class=\"literal\"\u003e{ s | i | o | b | t | n | m | h }\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForbids the use of particular scan and join methods: \u003ccode class=\"literal\"\u003es\u003c/code\u003e and \u003ccode class=\"literal\"\u003ei\u003c/code\u003e disable sequential and index scans respectively, \u003ccode class=\"literal\"\u003eo\u003c/code\u003e, \u003ccode class=\"literal\"\u003eb\u003c/code\u003e and \u003ccode class=\"literal\"\u003et\u003c/code\u003e disable index-only scans, bitmap index scans, and TID scans respectively, while \u003ccode class=\"literal\"\u003en\u003c/code\u003e, \u003ccode class=\"literal\"\u003em\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eh\u003c/code\u003e disable nested-loop, merge and hash joins respectively.\u003c/p\u003e\n\u003cp\u003eNeither sequential scans nor nested-loop joins can be disabled completely; the \u003ccode class=\"literal\"\u003e-fs\u003c/code\u003e and \u003ccode class=\"literal\"\u003e-fn\u003c/code\u003e options simply discourage the optimizer from using those plan types if it has any other alternative.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows the structure of system tables to be modified. This is used by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIgnore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e \u003ccode class=\"literal\"\u003epa[rser] | pl[anner] | e[xecutor]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint timing statistics for each query relating to each of the major system modules. This option cannot be used together with the \u003ccode class=\"option\"\u003e-s\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them \u003cspan class=\"systemitem\"\u003eSIGQUIT\u003c/span\u003e signals. With this option, \u003cspan class=\"systemitem\"\u003eSIGABRT\u003c/span\u003e will be sent instead, resulting in production of core dump files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprotocol\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eA delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect2\" id=\"id-1.9.5.16.6.5\"\u003e\n\u003ch3\u003eOptions for Single-User Mode\u003c/h3\u003e\n\u003cp\u003eThe following options only apply to the single-user mode (see \u003ca class=\"xref\" href=\"/docs/18/app-postgres.html#APP-POSTGRES-SINGLE-USER\" title=\"Single-User Mode\"\u003eSingle-User Mode\u003c/a\u003e below).\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the single-user mode. This must be the first argument on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be accessed. This must be the last argument on the command line. If it is omitted it defaults to the user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho all commands to standard output before executing them.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse semicolon followed by two newlines, rather than just newline, as the command entry terminator.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend all server log output to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This option is only honored when supplied as a command-line option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault data directory location\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATESTYLE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault value of the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e run-time parameter. (The use of this environment variable is deprecated.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault port number (preferably set in the configuration file)\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eA failure message mentioning \u003ccode class=\"literal\"\u003esemget\u003c/code\u003e or \u003ccode class=\"literal\"\u003eshmget\u003c/code\u003e probably indicates you need to configure your kernel to provide adequate shared memory and semaphores. For more discussion see \u003ca class=\"xref\" href=\"/docs/18/kernel-resources.html\" title=\"18.4. Managing Kernel Resources\"\u003eSection 18.4\u003c/a\u003e. You might be able to postpone reconfiguring your kernel by decreasing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-resource.html#GUC-SHARED-BUFFERS\"\u003eshared_buffers\u003c/a\u003e to reduce the shared memory consumption of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, and/or by reducing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e to reduce the semaphore consumption.\u003c/p\u003e\n\u003cp\u003eA failure message suggesting that another server is already running should be checked carefully, for example by using the command\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eps ax | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eps -ef | grep postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003edepending on your system. If you are certain that no conflicting server is running, you can remove the lock file mentioned in the message and try again.\u003c/p\u003e\n\u003cp\u003eA failure message indicating inability to bind to a port might indicate that that port is already in use by some non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e process. You might also get this error if you terminate \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e and immediately restart it using the same port; in this case, you must simply wait a few seconds until the operating system closes the port before trying again. Finally, you might get this error if you specify a port number that your operating system considers to be reserved. For example, many versions of Unix consider port numbers under 1024 to be \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003etrusted\u003c/span\u003e”\u003c/span\u003e and only permit the Unix superuser to access them.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eThe utility command \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to start and shut down the \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server safely and comfortably.\u003c/p\u003e\n\u003cp\u003eIf at all possible, \u003cspan class=\"emphasis\"\u003e\u003cem\u003edo not\u003c/em\u003e\u003c/span\u003e use \u003ccode class=\"literal\"\u003eSIGKILL\u003c/code\u003e to kill the main \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server. Doing so will prevent \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e from freeing the system resources (e.g., shared memory and semaphores) that it holds before terminating. This might cause problems for starting a fresh \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e run.\u003c/p\u003e\n\u003cp\u003eTo terminate the \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server normally, the signals \u003ccode class=\"literal\"\u003eSIGTERM\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSIGINT\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eSIGQUIT\u003c/code\u003e can be used. The first will wait for all clients to terminate before quitting, the second will forcefully disconnect all clients, and the third will quit immediately without proper shutdown, resulting in a recovery run during restart.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"literal\"\u003eSIGHUP\u003c/code\u003e signal will reload the server configuration files. It is also possible to send \u003ccode class=\"literal\"\u003eSIGHUP\u003c/code\u003e to an individual server process, but that is usually not sensible.\u003c/p\u003e\n\u003cp\u003eTo cancel a running query, send the \u003ccode class=\"literal\"\u003eSIGINT\u003c/code\u003e signal to the process running that command. To terminate a backend process cleanly, send \u003ccode class=\"literal\"\u003eSIGTERM\u003c/code\u003e to that process. See also \u003ccode class=\"function\"\u003epg_cancel_backend\u003c/code\u003e and \u003ccode class=\"function\"\u003epg_terminate_backend\u003c/code\u003e in \u003ca class=\"xref\" href=\"/docs/18/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL\" title=\"9.28.2. Server Signaling Functions\"\u003eSection 9.28.2\u003c/a\u003e for the SQL-callable equivalents of these two actions.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e server uses \u003ccode class=\"literal\"\u003eSIGQUIT\u003c/code\u003e to tell subordinate server processes to terminate without normal cleanup. This signal \u003cspan class=\"emphasis\"\u003e\u003cem\u003eshould not\u003c/em\u003e\u003c/span\u003e be used by users. It is also unwise to send \u003ccode class=\"literal\"\u003eSIGKILL\u003c/code\u003e to a server process — the main \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e process will interpret this as a crash and will force all the sibling processes to quit as part of its standard crash-recovery procedure.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-BUGS\"\u003e\n\u003ch2\u003eBugs\u003c/h2\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--\u003c/code\u003e options will not work on \u003cspan class=\"systemitem\"\u003eFreeBSD\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003eOpenBSD\u003c/span\u003e. Use \u003ccode class=\"option\"\u003e-c\u003c/code\u003e instead. This is a bug in the affected operating systems; a future release of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will provide a workaround if this is not fixed.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-SINGLE-USER\"\u003e\n\u003ch2\u003eSingle-User Mode\u003c/h2\u003e\n\u003cp\u003eTo start a single-user mode server, use a command like\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres --single -D /usr/local/pgsql/data \u003cem class=\"replaceable\"\u003e\u003ccode\u003eother-options\u003c/code\u003e\u003c/em\u003e my_database\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eProvide the correct path to the database directory with \u003ccode class=\"option\"\u003e-D\u003c/code\u003e, or make sure that the environment variable \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e is set. Also specify the name of the particular database you want to work in.\u003c/p\u003e\n\u003cp\u003eNormally, the single-user mode server treats newline as the command entry terminator; there is no intelligence about semicolons, as there is in \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. To continue a command across multiple lines, you must type backslash just before each newline except the last one. The backslash and adjacent newline are both dropped from the input command. Note that this will happen even when within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eBut if you use the \u003ccode class=\"option\"\u003e-j\u003c/code\u003e command line switch, a single newline does not terminate command entry; instead, the sequence semicolon-newline-newline does. That is, type a semicolon immediately followed by a completely empty line. Backslash-newline is not treated specially in this mode. Again, there is no intelligence about such a sequence appearing within a string literal or comment.\u003c/p\u003e\n\u003cp\u003eIn either input mode, if you type a semicolon that is not just before or part of a command entry terminator, it is considered a command separator. When you do type a command entry terminator, the multiple statements you've entered will be executed as a single transaction.\u003c/p\u003e\n\u003cp\u003eTo quit the session, type EOF (\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e, usually). If you've entered any text since the last command entry terminator, then EOF will be taken as a command entry terminator, and another EOF will be needed to exit.\u003c/p\u003e\n\u003cp\u003eNote that the single-user mode server does not provide sophisticated line-editing features (no command history, for example). Single-user mode also does not do any background processing, such as automatic checkpoints or replication.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-POSTGRES-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo start \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e in the background using default values, type:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003enohup postgres \u0026gt;logfile 2\u0026gt;\u0026amp;1 \u0026lt;/dev/null \u0026amp;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo start \u003ccode class=\"command\"\u003epostgres\u003c/code\u003e with a specific port, e.g., 1234:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo connect to this server using \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, specify this port with the -p option:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -p 1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eor set the environment variable \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eexport PGPORT=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eNamed run-time parameters can be set in either of these styles:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres -c work_mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epostgres --work-mem=1234\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eEither form overrides whatever setting might exist for \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e. Notice that underscores in parameter names can be written as either underscore or dash on the command line. Except for short-term experiments, it's probably better practice to edit the setting in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e than to rely on a command-line switch to set a parameter.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.16.13\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/app-initdb.html\" title=\"initdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-B nbuffers","url":"/docs/18/app-postgres.html"},"summary":"Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the shared_buffers configuration parameter."},{"signature":{"text":"-c name = value","url":"/docs/18/app-postgres.html"},"summary":"Sets a named run-time parameter. The configuration parameters supported by PostgreSQL are described in Chapter 19 . Most of the other command line options are in fact short forms of such a parameter assignment. -c can appear multiple times to set multiple parameters."},{"signature":{"text":"-C name","url":"/docs/18/app-postgres.html"},"summary":"Prints the value of the named run-time parameter, and exits. (See the -c option above for details.) This returns values from postgresql.conf , modified by any parameters supplied in this invocation. It does not reflect parameters supplied when the cluster was started."},{"signature":{"text":"-d debug-level","url":"/docs/18/app-postgres.html"},"summary":"Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. It is also possible to pass -d 0 for a specific session, which will prevent the server log level of the parent postgres process from being propagated to this session."},{"signature":{"text":"-D datadir","url":"/docs/18/app-postgres.html"},"summary":"Specifies the file system location of the database configuration files. See Section 19.2 for details."},{"signature":{"text":"-e","url":"/docs/18/app-postgres.html"},"summary":"Sets the default date style to “ European ” , that is DMY ordering of input date fields. This also causes the day to be printed before the month in certain date output formats. See Section 8.5 for more information."},{"signature":{"text":"-F","url":"/docs/18/app-postgres.html"},"summary":"Disables fsync calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the fsync configuration parameter. Read the detailed documentation before using this!"},{"signature":{"text":"-h hostname","url":"/docs/18/app-postgres.html"},"summary":"Specifies the IP host name or address on which postgres is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or * to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the server. Defaults to listening only on localhost . Specifying this option is equivalent to setting the listen_addresses configuration parameter."},{"signature":{"text":"-i","url":"/docs/18/app-postgres.html"},"summary":"Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h ."},{"signature":{"text":"-k directory","url":"/docs/18/app-postgres.html"},"summary":"Specifies the directory of the Unix-domain socket on which postgres is to listen for connections from client applications. The value can also be a comma-separated list of directories. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp , but that can be changed at build time. Specifying this option is equivalent to setting the unix_socket_directories configuration parameter."},{"signature":{"text":"-l","url":"/docs/18/app-postgres.html"},"summary":"Enables secure connections using SSL . PostgreSQL must have been compiled with support for SSL for this option to be available. For more information on using SSL , refer to Section 18.9 ."},{"signature":{"text":"-N max-connections","url":"/docs/18/app-postgres.html"},"summary":"Sets the maximum number of client connections that this server will accept. The default value of this parameter is chosen automatically by initdb . Specifying this option is equivalent to setting the max_connections configuration parameter."},{"signature":{"text":"-p port","url":"/docs/18/app-postgres.html"},"summary":"Specifies the TCP/IP port or local Unix domain socket file extension on which postgres is to listen for connections from client applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or PGPORT ."},{"signature":{"text":"-s","url":"/docs/18/app-postgres.html"},"summary":"Print time information and other statistics at the end of each command. This is useful for benchmarking or for use in tuning the number of buffers."},{"signature":{"text":"-S work-mem","url":"/docs/18/app-postgres.html"},"summary":"Specifies the base amount of memory to be used by sorts and hash tables before resorting to temporary disk files. See the description of the work_mem configuration parameter in Section 19.4.1 ."},{"signature":{"text":"-V --version","url":"/docs/18/app-postgres.html"},"summary":"Print the postgres version and exit."},{"signature":{"text":"-- name = value","url":"/docs/18/app-postgres.html"},"summary":"Sets a named run-time parameter; a shorter form of -c ."},{"signature":{"text":"--describe-config","url":"/docs/18/app-postgres.html"},"summary":"This option dumps out the server's internal configuration variables, descriptions, and defaults in tab-delimited COPY format. It is designed primarily for use by administration tools."},{"signature":{"text":"-? --help","url":"/docs/18/app-postgres.html"},"summary":"Show help about postgres command line arguments, and exit."},{"signature":{"text":"-f { s | i | o | b | t | n | m | h }","url":"/docs/18/app-postgres.html"},"summary":"Forbids the use of particular scan and join methods: s and i disable sequential and index scans respectively, o , b and t disable index-only scans, bitmap index scans, and TID scans respectively, while n , m , and h disable nested-loop, merge and hash joins respectively."},{"signature":{"text":"-O","url":"/docs/18/app-postgres.html"},"summary":"Allows the structure of system tables to be modified. This is used by initdb ."},{"signature":{"text":"-P","url":"/docs/18/app-postgres.html"},"summary":"Ignore system indexes when reading system tables, but still update the indexes when modifying the tables. This is useful when recovering from damaged system indexes."},{"signature":{"text":"-t pa[rser] | pl[anner] | e[xecutor]","url":"/docs/18/app-postgres.html"},"summary":"Print timing statistics for each query relating to each of the major system modules. This option cannot be used together with the -s option."},{"signature":{"text":"-T","url":"/docs/18/app-postgres.html"},"summary":"This option is for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate, by sending them SIGQUIT signals. With this option, SIGABRT will be sent instead, resulting in production of core dump files."},{"signature":{"text":"-v protocol","url":"/docs/18/app-postgres.html"},"summary":"Specifies the version number of the frontend/backend protocol to be used for a particular session. This option is for internal use only."},{"signature":{"text":"-W seconds","url":"/docs/18/app-postgres.html"},"summary":"A delay of this many seconds occurs when a new server process is started, after it conducts the authentication procedure. This is intended to give an opportunity to attach to the server process with a debugger."},{"signature":{"text":"--single","url":"/docs/18/app-postgres.html"},"summary":"Selects the single-user mode. This must be the first argument on the command line."},{"signature":{"text":"-E","url":"/docs/18/app-postgres.html"},"summary":"Echo all commands to standard output before executing them."},{"signature":{"text":"-j","url":"/docs/18/app-postgres.html"},"summary":"Use semicolon followed by two newlines, rather than just newline, as the command entry terminator."},{"signature":{"text":"-r filename","url":"/docs/18/app-postgres.html"},"summary":"Send all server log output to filename . This option is only honored when supplied as a command-line option."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default character encoding used by clients. (The clients can override this individually.) This value can also be set in the configuration file.","name":"PGCLIENTENCODING"},{"description":"Default data directory location","name":"PGDATA"},{"description":"Default value of the DateStyle run-time parameter. (The use of this environment variable is deprecated.)","name":"PGDATESTYLE"},{"description":"Default port number (preferably set in the configuration file)","name":"PGPORT"}],"title":"Environment variables"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
