{"Entry":{"collection":"tool","key":"reindexdb","name":"reindexdb","aliases":["reindexdb"],"metadata":{"aliases":["reindexdb"],"category":"Client applications","content_hash":"7c57d260a7a1f456a6198273adf114e7b8ea15471472702ba54e77dc99929dcc","derived_content_hash":"850c52d0a08b3ede6164fdc349fe3802c6e41be874c5142c9c1d02020b865d73","imported_at":"2026-09-30T00:40:34.751485+08:00","name":"reindexdb","name_zh":"","slug":"reindexdb","summary":"reindexdb — reindex a PostgreSQL database"}},"Definition":{"Collection":"tool","Key":"reindexdb","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"reindexdb","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"options":[{"description":"Reindex all databases.","names":["-a","--all"],"signature":"-a --all"},{"description":"Use the CONCURRENTLY option. See REINDEX , where all the caveats of this option are explained in detail.","names":["--concurrently"],"signature":"--concurrently"},{"description":"Echo the commands that reindexdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo"},{"description":"Recreate index only. Multiple indexes can be recreated by writing multiple -i switches.","names":["-i index","--index= index"],"signature":"-i index --index= index"},{"description":"Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. reindexdb will open njobs connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Note that this option is incompatible with the --system option.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs"},{"description":"Do not display progress messages.","names":["-q","--quiet"],"signature":"-q --quiet"},{"description":"Reindex database's system catalogs only.","names":["-s","--system"],"signature":"-s --system"},{"description":"Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches.","names":["-S schema","--schema= schema"],"signature":"-S schema --schema= schema"},{"description":"Reindex table only. Multiple tables can be reindexed by writing multiple -t switches.","names":["-t table","--table= table"],"signature":"-t table --table= table"},{"description":"Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)","names":["--tablespace= tablespace"],"signature":"--tablespace= tablespace"},{"description":"Print detailed information during processing.","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"Print the reindexdb version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Show help about reindexdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force reindexdb to prompt for a password before connecting to a database. This option is never essential, since reindexdb will automatically prompt for a password if the server demands password authentication. However, reindexdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"When the -a / --all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname"}],"synopsis":["reindexdb [ connection-option ...] [ option ...] [ -S | --schema schema ] ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s | --system ] [ dbname | -a | --all ]"]},"comparison_hash":"3749162d5280a7ad1d0c2ac6f8c80c76188a0ae5656ec1cd48a1ae0b5b9660c9","description":["reindexdb — reindex a PostgreSQL database"],"description_zh":"描述 reindexdb 是用于重建 PostgreSQL 数据库中索引的工具。 reindexdb 是 SQL 命令 REINDEX 的一个包装器。通过该工具重建索引与通过其他方法访问服务器来重建索引，在效果上没有区别。 选项 reindexdb 接受下列命令行参数： -a --all 重建所有数据库的索引。 --concurrently 使用 CONCURRENTLY 选项。参见 REINDEX ，其中详细解释了该选项的所有注意事项。 [ -d ] dbname [ --dbname= ] dbname 在未使用 -a / --all 时，指定要重建索引的数据库名称。如果未指定该选项，则从环境变量 PGDATABASE 中读取数据库名称。如果该变量未设置，则使用为连接指定的用户名。 dbname 可以是一个 连接字符串 。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。 -e --echo 回显 reindexdb 生成并发送给服务器的命令。 -i index --index= index 只重建 index 。可以通过写多个 -i 开关来重建多个索引。 -j njobs --jobs= njobs 通过同时运行 njobs 个命令来并行执行重建索引命令。此选项可能缩短处理时间，但也会增加数据库服务器上的负载。 reindexdb 将打开 njobs 个到数据库的连接，因此请确保 max_connections 设置足够高，能容纳所有连接。 注意，该选项与 --system 选项不兼容。 -q --quiet 不显示进度消息。 -s --system 仅重建数据库的系统目录上的索引。 -S schema --schema= schema 只重建 schema 中的索引。可以通过写多个 -S 开关来重建多个模式中的索引。 -t table --table= table 只重建 table 上的索引。可以通过写多个 -t 开关来重建多个表上的索引。 --tablespace= tablespace 指定重建索引所在的表空间。（该名称会按双引号标识符处理。） -v ","description_zh_html":"\u003cp\u003e命令行工具 reindexdb [ connection-option ...] [ option ...] [ -S | --schema schema ] ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s | --system ] [ dbname | -a | --all ]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 是用于重建 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库中索引的工具。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 是 SQL 命令 \u003ca class=\"link\" href=\"/zh/docs/18/sql-reindex.html\"\u003e\u003ccode class=\"command\"\u003eREINDEX\u003c/code\u003e\u003c/a\u003e 的一个包装器。通过该工具重建索引与通过其他方法访问服务器来重建索引，在效果上没有区别。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ereindexdb\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-a\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--all\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--concurrently\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        使用 \u003ccode class=\"literal\"\u003eCONCURRENTLY\u003c/code\u003e 选项。参见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-reindex.html\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e，其中详细解释了该选项的所有注意事项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e-d\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e--dbname=\u003c/span\u003e]\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在未使用 \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e 时，指定要重建索引的数据库名称。如果未指定该选项，则从环境变量 \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e 中读取数据库名称。如果该变量未设置，则使用为连接指定的用户名。\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 可以是一个\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\"\u003e连接字符串\u003c/a\u003e。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        回显 \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 生成并发送给服务器的命令。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--index=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只重建 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e。可以通过写多个 \u003ccode class=\"option\"\u003e-i\u003c/code\u003e 开关来重建多个索引。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        通过同时运行 \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e 个命令来并行执行重建索引命令。此选项可能缩短处理时间，但也会增加数据库服务器上的负载。\n       \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 将打开 \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e 个到数据库的连接，因此请确保 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e 设置足够高，能容纳所有连接。\n       \u003c/p\u003e\u003cp\u003e\n        注意，该选项与 \u003ccode class=\"option\"\u003e--system\u003c/code\u003e 选项不兼容。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\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\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--system\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 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只重建 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e 中的索引。可以通过写多个 \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 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只重建 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e 上的索引。可以通过写多个 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 开关来重建多个表上的索引。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\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-v\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\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-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\"\u003ereindexdb\u003c/span\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\"\u003ereindexdb\u003c/span\u003e 命令行参数的帮助信息，并退出。\n      \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ereindexdb\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-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定服务器所在机器的主机名。如果该值以斜杠开头，则它将被用作 Unix 域套接字的目录。\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\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\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        指定服务器监听连接所用的 TCP 端口或本地 Unix 域套接字文件扩展名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\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-w\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        永远不发出密码提示。如果服务器要求密码认证，而又无法通过其他方式获取密码，例如通过\u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件，则连接尝试会失败。此选项可用于没有用户可输入密码的批处理作业和脚本。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        强制 \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 在连接数据库前提示输入密码。\n       \u003c/p\u003e\u003cp\u003e\n        该选项并非必需，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e 会先浪费一次连接尝试来确认服务器需要密码。在某些场景下，值得使用 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e，以避免这次额外的连接尝试。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当使用 \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e 时，连接到该数据库以收集要重建索引的数据库列表。如果未指定，则使用 \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e 数据库；如果它不存在，则使用 \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e。这可以是一个\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\"\u003e连接字符串\u003c/a\u003e。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。此外，除数据库名称本身以外的连接字符串参数，在连接到其他数据库时也会被重复使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/app-reindexdb.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","environment":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"facts":[{"label":"Documented executable","value":"reindexdb"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"19"}],"facts_zh":[{"label":"手册中的可执行程序","value":"reindexdb"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"19"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-REINDEXDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ereindexdb — reindex a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\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.4.22.4.1\"\u003e\u003ccode class=\"command\"\u003ereindexdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-S\u003c/code\u003e | \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-t\u003c/code\u003e | \u003ccode class=\"option\"\u003e--table\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-i\u003c/code\u003e | \u003ccode class=\"option\"\u003e--index\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-s\u003c/code\u003e | \u003ccode class=\"option\"\u003e--system\u003c/code\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e is a utility for rebuilding indexes in a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003ccode class=\"command\"\u003eREINDEX\u003c/code\u003e\u003c/a\u003e. There is no effective difference between reindexing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--concurrently\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the \u003ccode class=\"literal\"\u003eCONCURRENTLY\u003c/code\u003e option. See \u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e, where all the caveats of this option are explained in detail.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e-d\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e--dbname=\u003c/span\u003e]\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be reindexed, when \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--index=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRecreate \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e only. Multiple indexes can be recreated by writing multiple \u003ccode class=\"option\"\u003e-i\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the reindex commands in parallel by running \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that this option is incompatible with the \u003ccode class=\"option\"\u003e--system\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--system\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex database's system catalogs only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be reindexed by writing multiple \u003ccode class=\"option\"\u003e-S\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Multiple tables can be reindexed by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)\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--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\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\"\u003ereindexdb\u003c/span\u003e version and exit.\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\"\u003ereindexdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\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\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\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 port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to reindex. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\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.4.22.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\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo reindex the database \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ereindexdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reindex the table \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e and the index \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e in a database named \u003ccode class=\"literal\"\u003eabcd\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ereindexdb --table=foo --index=bar abcd\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-reindexdb.html","options":[{"description":"Reindex all databases.","names":["-a","--all"],"signature":"-a --all","source_url":"/docs/18/app-reindexdb.html","summary":"Reindex all databases."},{"description":"Use the CONCURRENTLY option. See REINDEX , where all the caveats of this option are explained in detail.","names":["--concurrently"],"signature":"--concurrently","source_url":"/docs/18/app-reindexdb.html","summary":"Use the CONCURRENTLY option. See REINDEX , where all the caveats of this option are explained in detail."},{"description":"Echo the commands that reindexdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo","source_url":"/docs/18/app-reindexdb.html","summary":"Echo the commands that reindexdb generates and sends to the server."},{"description":"Recreate index only. Multiple indexes can be recreated by writing multiple -i switches.","names":["-i index","--index= index"],"signature":"-i index --index= index","source_url":"/docs/18/app-reindexdb.html","summary":"Recreate index only. Multiple indexes can be recreated by writing multiple -i switches."},{"description":"Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. reindexdb will open njobs connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Note that this option is incompatible with the --system option.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs","source_url":"/docs/18/app-reindexdb.html","summary":"Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"description":"Do not display progress messages.","names":["-q","--quiet"],"signature":"-q --quiet","source_url":"/docs/18/app-reindexdb.html","summary":"Do not display progress messages."},{"description":"Reindex database's system catalogs only.","names":["-s","--system"],"signature":"-s --system","source_url":"/docs/18/app-reindexdb.html","summary":"Reindex database's system catalogs only."},{"description":"Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches.","names":["-S schema","--schema= schema"],"signature":"-S schema --schema= schema","source_url":"/docs/18/app-reindexdb.html","summary":"Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches."},{"description":"Reindex table only. Multiple tables can be reindexed by writing multiple -t switches.","names":["-t table","--table= table"],"signature":"-t table --table= table","source_url":"/docs/18/app-reindexdb.html","summary":"Reindex table only. Multiple tables can be reindexed by writing multiple -t switches."},{"description":"Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)","names":["--tablespace= tablespace"],"signature":"--tablespace= tablespace","source_url":"/docs/18/app-reindexdb.html","summary":"Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)"},{"description":"Print detailed information during processing.","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-reindexdb.html","summary":"Print detailed information during processing."},{"description":"Print the reindexdb version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-reindexdb.html","summary":"Print the reindexdb version and exit."},{"description":"Show help about reindexdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-reindexdb.html","summary":"Show help about reindexdb command line arguments, and exit."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-reindexdb.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-reindexdb.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-reindexdb.html","summary":"User name to connect as."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-reindexdb.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Force reindexdb to prompt for a password before connecting to a database. This option is never essential, since reindexdb will automatically prompt for a password if the server demands password authentication. However, reindexdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-reindexdb.html","summary":"Force reindexdb to prompt for a password before connecting to a database."},{"description":"When the -a / --all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname","source_url":"/docs/18/app-reindexdb.html","summary":"When the -a / --all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"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":"reindexdb [ connection-option ...] [ option ...] [ -S | --schema schema ] ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s | --system ] [ dbname | -a | --all ]","sources":[{"anchor":"","file":"app-reindexdb.html","label":"18.6 English manual · app-reindexdb.html","sha256":"5becfa58c6bf51dd972a77a669a1b1907dcefbe653e38109c29e7fa1bed27cb2","url":"/docs/18/app-reindexdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["reindexdb [ connection-option ...] [ option ...] [ -S | --schema schema ] ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s | --system ] [ dbname | -a | --all ]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --all","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex all databases."},{"signature":{"text":"--concurrently","url":"/docs/18/app-reindexdb.html"},"summary":"Use the CONCURRENTLY option. See REINDEX , where all the caveats of this option are explained in detail."},{"signature":{"text":"-e --echo","url":"/docs/18/app-reindexdb.html"},"summary":"Echo the commands that reindexdb generates and sends to the server."},{"signature":{"text":"-i index --index= index","url":"/docs/18/app-reindexdb.html"},"summary":"Recreate index only. Multiple indexes can be recreated by writing multiple -i switches."},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-reindexdb.html"},"summary":"Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-reindexdb.html"},"summary":"Do not display progress messages."},{"signature":{"text":"-s --system","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex database's system catalogs only."},{"signature":{"text":"-S schema --schema= schema","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches."},{"signature":{"text":"-t table --table= table","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex table only. Multiple tables can be reindexed by writing multiple -t switches."},{"signature":{"text":"--tablespace= tablespace","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-reindexdb.html"},"summary":"Print detailed information during processing."},{"signature":{"text":"-V --version","url":"/docs/18/app-reindexdb.html"},"summary":"Print the reindexdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-reindexdb.html"},"summary":"Show help about reindexdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-reindexdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-reindexdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-reindexdb.html"},"summary":"Force reindexdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-reindexdb.html"},"summary":"When the -a / --all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-a --all","url":"/docs/18/app-reindexdb.html"},"summary":"重建所有数据库的索引。"},{"signature":{"text":"--concurrently","url":"/docs/18/app-reindexdb.html"},"summary":"使用 CONCURRENTLY 选项。参见 REINDEX ，其中详细解释了该选项的所有注意事项。"},{"signature":{"text":"-e --echo","url":"/docs/18/app-reindexdb.html"},"summary":"回显 reindexdb 生成并发送给服务器的命令。"},{"signature":{"text":"-i index --index= index","url":"/docs/18/app-reindexdb.html"},"summary":"只重建 index 。可以通过写多个 -i 开关来重建多个索引。"},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-reindexdb.html"},"summary":"通过同时运行 njobs 个命令来并行执行重建索引命令。此选项可能缩短处理时间，但也会增加数据库服务器上的负载。"},{"signature":{"text":"-q --quiet","url":"/docs/18/app-reindexdb.html"},"summary":"不显示进度消息。"},{"signature":{"text":"-s --system","url":"/docs/18/app-reindexdb.html"},"summary":"仅重建数据库的系统目录上的索引。"},{"signature":{"text":"-S schema --schema= schema","url":"/docs/18/app-reindexdb.html"},"summary":"只重建 schema 中的索引。可以通过写多个 -S 开关来重建多个模式中的索引。"},{"signature":{"text":"-t table --table= table","url":"/docs/18/app-reindexdb.html"},"summary":"只重建 table 上的索引。可以通过写多个 -t 开关来重建多个表上的索引。"},{"signature":{"text":"--tablespace= tablespace","url":"/docs/18/app-reindexdb.html"},"summary":"指定重建索引所在的表空间。（该名称会按双引号标识符处理。）"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-reindexdb.html"},"summary":"在处理过程中打印详细信息。"},{"signature":{"text":"-V --version","url":"/docs/18/app-reindexdb.html"},"summary":"打印 reindexdb 的版本并退出。"},{"signature":{"text":"-? --help","url":"/docs/18/app-reindexdb.html"},"summary":"显示关于 reindexdb 命令行参数的帮助信息，并退出。"},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-reindexdb.html"},"summary":"指定服务器所在机器的主机名。如果该值以斜杠开头，则它将被用作 Unix 域套接字的目录。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-reindexdb.html"},"summary":"指定服务器监听连接所用的 TCP 端口或本地 Unix 域套接字文件扩展名。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-reindexdb.html"},"summary":"连接时所使用的用户名。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-reindexdb.html"},"summary":"永远不发出密码提示。如果服务器要求密码认证，而又无法通过其他方式获取密码，例如通过 .pgpass 文件，则连接尝试会失败。此选项可用于没有用户可输入密码的批处理作业和脚本。"},{"signature":{"text":"-W --password","url":"/docs/18/app-reindexdb.html"},"summary":"强制 reindexdb 在连接数据库前提示输入密码。"},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-reindexdb.html"},"summary":"当使用 -a / --all 时，连接到该数据库以收集要重建索引的数据库列表。如果未指定，则使用 postgres 数据库；如果它不存在，则使用 template1 。这可以是一个 连接字符串 。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。此外，除数据库名称本身以外的连接字符串参数，在连接到其他数据库时也会被重复使用。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"默认连接参数","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"指定诊断消息是否使用颜色。可选值为 always 、 auto 和 never 。","name":"PG_COLOR"}],"title":"环境变量"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"3b70b45e976043643de08c1439be034f486bc7145b488179a736ae9b671a681c","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"dcad334ee93a0f71fc5ada36134aa0940ac4c332b119ca5b4aa08a9a246e7719","locale":"zh-Hans","page_key":"app-reindexdb.html","source_hash":"9689f113a408d178a5c0383b7cd394e5d9f75bc8cb7845665b6b5c8fb00ba270","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-reindexdb.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"ManualEvidence":{"manual_path":"app-reindexdb.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-reindexdb.html","label":"18.6 English manual · app-reindexdb.html","sha256":"5becfa58c6bf51dd972a77a669a1b1907dcefbe653e38109c29e7fa1bed27cb2","url":"/docs/18/app-reindexdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"reindexdb","SourceDatabase":"center","Version":"18","Locale":"en","Title":"reindexdb","Summary":"reindexdb — reindex a PostgreSQL database","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-REINDEXDB\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003ereindexdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ereindexdb — reindex a \u003cspan\u003ePostgreSQL\u003c/span\u003e database\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.4.22.4.1\"\u003e\u003ccode\u003ereindexdb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode\u003e-S\u003c/code\u003e | \u003ccode\u003e--schema\u003c/code\u003e \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode\u003e-t\u003c/code\u003e | \u003ccode\u003e--table\u003c/code\u003e \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode\u003e-i\u003c/code\u003e | \u003ccode\u003e--index\u003c/code\u003e \u003cem\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode\u003e-s\u003c/code\u003e | \u003ccode\u003e--system\u003c/code\u003e ] [ \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode\u003e-a\u003c/code\u003e | \u003ccode\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.22.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ereindexdb\u003c/span\u003e is a utility for rebuilding indexes in a \u003cspan\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ereindexdb\u003c/span\u003e is a wrapper around the SQL command \u003ca href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\" rel=\"nofollow\"\u003e\u003ccode\u003eREINDEX\u003c/code\u003e\u003c/a\u003e. There is no effective difference between reindexing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.22.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ereindexdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--concurrently\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the \u003ccode\u003eCONCURRENTLY\u003c/code\u003e option. See \u003ca href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\" rel=\"nofollow\"\u003e\u003cspan\u003eREINDEX\u003c/span\u003e\u003c/a\u003e, where all the caveats of this option are explained in detail.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e[\u003cspan\u003e-d\u003c/span\u003e] \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e[\u003cspan\u003e--dbname=\u003c/span\u003e]\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be reindexed, when \u003ccode\u003e-a\u003c/code\u003e/\u003ccode\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan\u003ereindexdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-i \u003cem\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--index=\u003cem\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRecreate \u003cem\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e only. Multiple indexes can be recreated by writing multiple \u003ccode\u003e-i\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-j \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--jobs=\u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the reindex commands in parallel by running \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ereindexdb\u003c/span\u003e will open \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\" rel=\"nofollow\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that this option is incompatible with the \u003ccode\u003e--system\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--system\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex database\u0026#39;s system catalogs only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--schema=\u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be reindexed by writing multiple \u003ccode\u003e-S\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--table=\u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Multiple tables can be reindexed by writing multiple \u003ccode\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--tablespace=\u003cem\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)\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--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\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\u003ereindexdb\u003c/span\u003e version and exit.\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\u003ereindexdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan\u003ereindexdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\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\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\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 port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003ereindexdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003ereindexdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003ereindexdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--maintenance-db=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode\u003e-a\u003c/code\u003e/\u003ccode\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to reindex. If not specified, the \u003ccode\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\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.4.22.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.22.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\" rel=\"nofollow\"\u003e\u003cspan\u003eREINDEX\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.22.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo reindex the database \u003ccode\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ereindexdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reindex the table \u003ccode\u003efoo\u003c/code\u003e and the index \u003ccode\u003ebar\u003c/code\u003e in a database named \u003ccode\u003eabcd\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ereindexdb --table=foo --index=bar abcd\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.22.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\" rel=\"nofollow\"\u003e\u003cspan\u003eREINDEX\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"47508cfbba550685be11ba5ece7f69b5ad8f599cd5890c27f83e40b5ad772851","Payload":{"description":["reindexdb — reindex a PostgreSQL database"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-REINDEXDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ereindexdb — reindex a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\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.4.22.4.1\"\u003e\u003ccode class=\"command\"\u003ereindexdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-S\u003c/code\u003e | \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-t\u003c/code\u003e | \u003ccode class=\"option\"\u003e--table\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-i\u003c/code\u003e | \u003ccode class=\"option\"\u003e--index\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e ] ... [ \u003ccode class=\"option\"\u003e-s\u003c/code\u003e | \u003ccode class=\"option\"\u003e--system\u003c/code\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e is a utility for rebuilding indexes in a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003ccode class=\"command\"\u003eREINDEX\u003c/code\u003e\u003c/a\u003e. There is no effective difference between reindexing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--concurrently\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the \u003ccode class=\"literal\"\u003eCONCURRENTLY\u003c/code\u003e option. See \u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e, where all the caveats of this option are explained in detail.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e-d\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e--dbname=\u003c/span\u003e]\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be reindexed, when \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--index=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRecreate \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex\u003c/code\u003e\u003c/em\u003e only. Multiple indexes can be recreated by writing multiple \u003ccode class=\"option\"\u003e-i\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the reindex commands in parallel by running \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that this option is incompatible with the \u003ccode class=\"option\"\u003e--system\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--system\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex database's system catalogs only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be reindexed by writing multiple \u003ccode class=\"option\"\u003e-S\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReindex \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Multiple tables can be reindexed by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)\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--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\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\"\u003ereindexdb\u003c/span\u003e version and exit.\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\"\u003ereindexdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\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\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\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 port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ereindexdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to reindex. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\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.4.22.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\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo reindex the database \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ereindexdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reindex the table \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e and the index \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e in a database named \u003ccode class=\"literal\"\u003eabcd\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ereindexdb --table=foo --index=bar abcd\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.22.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-reindex.html\" title=\"REINDEX\"\u003e\u003cspan class=\"refentrytitle\"\u003eREINDEX\u003c/span\u003e\u003c/a\u003e\u003c/span\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":"-a --all","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex all databases."},{"signature":{"text":"--concurrently","url":"/docs/18/app-reindexdb.html"},"summary":"Use the CONCURRENTLY option. See REINDEX , where all the caveats of this option are explained in detail."},{"signature":{"text":"-e --echo","url":"/docs/18/app-reindexdb.html"},"summary":"Echo the commands that reindexdb generates and sends to the server."},{"signature":{"text":"-i index --index= index","url":"/docs/18/app-reindexdb.html"},"summary":"Recreate index only. Multiple indexes can be recreated by writing multiple -i switches."},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-reindexdb.html"},"summary":"Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-reindexdb.html"},"summary":"Do not display progress messages."},{"signature":{"text":"-s --system","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex database's system catalogs only."},{"signature":{"text":"-S schema --schema= schema","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches."},{"signature":{"text":"-t table --table= table","url":"/docs/18/app-reindexdb.html"},"summary":"Reindex table only. Multiple tables can be reindexed by writing multiple -t switches."},{"signature":{"text":"--tablespace= tablespace","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-reindexdb.html"},"summary":"Print detailed information during processing."},{"signature":{"text":"-V --version","url":"/docs/18/app-reindexdb.html"},"summary":"Print the reindexdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-reindexdb.html"},"summary":"Show help about reindexdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-reindexdb.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-reindexdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-reindexdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-reindexdb.html"},"summary":"Force reindexdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-reindexdb.html"},"summary":"When the -a / --all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"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}
