reindexdb
重建数据库中的索引。
概要
reindexdb [connection-option ...] [--table | -t table ]
[--index | -i index ] [dbname]
reindexdb [connection-option ...] --all | -a
reindexdb [connection-option ...] --system | -s [dbname]
reindexdb -? | --help
reindexdb -V | --version
描述
reindexdb是用于在Greenplum数据库中重建索引的工具。
reindexdb是SQL命令REINDEX的包装。 通过此工具和通过其他访问服务器的方法为数据库重新索引之间没有明显的区别。
选项
-a | —all
重新索引所有数据库。
[-d] dbname | [—dbname=]dbname
指定要重新建立索引的数据库的名称。 如果未指定并且未使用-all,则从环境变量PGDATABASE读取数据库名称。 如果未设置,则使用为连接指定的用户名。
-e | —echo
回显reindexdb生成并发送到服务器的命令。
-i index | —index=index
仅重新创建索引。
-q | —quiet
不显示响应。
-s | —system
重新索引系统catalog。
-t table | —table=table
仅重新索引表。可以通过编写多个-t开关为多个表重新索引。
-V | —version
打印reindexdb版本并退出。
-? | —help
显示有关reindexdb命令行参数的帮助,然后退出。
连接选项
-h host | —host=host
运行Greenplum master数据库服务器的计算机的主机名。 如果未指定,则从环境变量PGHOST读取或默认为localhost。
-p port | —port=port
Greenplum master数据库服务器正在侦听连接的TCP端口。 如果未指定,则从环境变量PGPORT读取或默认为5432。
-U username | —username=username
要用作连接的数据库角色名称。 如果未指定,则从环境变量PGUSER读取或默认为当前系统角色名称。
-w | —no-password
不发出密码提示。 如果服务器要求密码验证,而其他方式(例如.pgpass文件)无法使用密码,则连接尝试将失败。 此选项在没有用户输入密码的批处理作业和脚本中很有用。
-W | —password
强制输入密码提示。
--maintenance-db=dbname
指定要连接以发现应重新索引哪些其他数据库的数据库的名称。 如果未指定,将使用postgres数据库,如果不存在,将使用template1。
注解
reindexdb可能需要连接几次master服务器,每次都要求输入密码。 在这种情况下,使用~/.pgpass文件很方便。
示例
要重新索引数据库mydb:
reindexdb mydb
要在名为abcd的数据库中为表foo和索引bar重建索引:
reindexdb --table foo --index bar abcd