reindexdb
Rebuilds indexes in a database.
Synopsis
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
Description
reindexdb is a utility for rebuilding indexes in Greengage DB.
reindexdb is a wrapper around the SQL command REINDEX.
There is no effective difference between reindexing databases via this utility and via other methods for accessing the server.
Options
- -a | --all
-
Reindex all databases.
- [-d] <dbname> | [--dbname=]<dbname>
-
The name of the database to be reindexed. If this is not specified and
--allis not used, the database name is read from the environment variablePGDATABASE. If that is not set, the user name specified for the connection is used. - -e | --echo
-
Echo the commands that
reindexdbgenerates and sends to the server. - -i <index> | --index=<index>
-
Recreate the specified index only.
- -q | --quiet
-
Do not display a response.
- -s | --system
-
Reindex system catalogs.
- -t <table> | --table=<table>
-
Reindex the specified table only. Multiple tables can be reindexed by writing multiple
-tswitches. - -V | --version
-
Print the
reindexdbversion and exit. - -? | --help
-
Show help about
reindexdbcommand line arguments, and exit.
Connection options
- -h <host> | --host=<host>
-
The host name of the machine on which the Greengage DB master is running. If not specified, reads from the
PGHOSTenvironment variable or defaults tolocalhost. - -p <port> | --port=<port>
-
The TCP port on which the Greengage DB master is listening for connections. If not specified, reads from the
PGPORTenvironment variable or defaults to5432. - -U <username> | --username=<username>
-
The database role name to connect as. If not specified, reads from the environment variable
PGUSERor defaults to the current system user name. - -w | --no-password
-
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.
- -W | --password
-
Force a password prompt.
- --maintenance-db=<dbname>
-
The name of the database to connect to discover what other databases should be reindexed. If not specified, the
postgresdatabase will be used, and if that does not exist,template1will be used.
Notes
reindexdb causes locking of system catalog tables, which could affect currently running queries.
To avoid disrupting ongoing business operations, schedule the reindexdb operation during a period of low activity.
reindexdb might need to connect several times to the master server, asking for a password each time.
It is convenient to have a ~/.pgpass file in such cases.
Examples
Reindex the mydb database:
$ reindexdb mydb
Reindex the foo table and the bar index in a database named abcd:
$ reindexdb --table foo --index bar abcd