合 PG中的reindexdb和reindex命令
Tags: PGPostgreSQLreindexreindexdb
reindexdb
reindexdb — 重索引一个PostgreSQL数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | postgres@lhrpg13:~$ reindexdb --help reindexdb reindexes a PostgreSQL database. Usage: reindexdb [OPTION]... [DBNAME] Options: -a, --all reindex all databases --concurrently reindex concurrently -d, --dbname=DBNAME database to reindex -e, --echo show the commands being sent to the server -i, --index=INDEX recreate specific index(es) only -j, --jobs=NUM use this many concurrent connections to reindex -q, --quiet don't write any messages -s, --system reindex system catalogs only -S, --schema=SCHEMA reindex specific schema(s) only -t, --table=TABLE reindex specific table(s) only -v, --verbose write a lot of output -V, --version output version information, then exit -?, --help show this help, then exit Connection options: -h, --host=HOSTNAME database server host or socket directory -p, --port=PORT database server port -U, --username=USERNAME user name to connect as -w, --no-password never prompt for password -W, --password force password prompt --maintenance-db=DBNAME alternate maintenance database Read the description of the SQL command REINDEX for details. Report bugs to <pgsql-bugs@lists.postgresql.org>. PostgreSQL home page: <https://www.postgresql.org/> |
大纲
1 2 3 4 5 | reindexdb [connection-option...] [option...] [ --schema | -S schema ] ... [ --table | -t table ] ... [ --index | -i index ] ... [dbname] reindexdb [connection-option...] [option...] --all | -a reindexdb [connection-option...] [option...] --system | -s [dbname] |
描述
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
命令并行执行 reindex 命令。 此选项可能会减少处理时间,但也会增加数据库服务器上的负载。reindexdb将打开到数据库的njobs
连接,因此请确保max_connections设置足够高,可以容纳所有连接。请注意,此选项与--index
和--system
选项不兼容。-q
--quiet
不显示进度消息。
-s
--system
索引数据库的系统目录。
-S *
schema*
--schema=*
schema*
只对
schema
重建索引。 通过写多个-S
开关可以指定多个要重建索引的模式。-t *
table*
--table=*
table*
只索引
table
。可以通过写多个-t
开关来重索引多个表。本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信db_bao,谢谢!