Linux "reindexdb" Command Line Options and Examples
reindex a PostgreSQL database

reindexdb is a utility for rebuilding indexes in a PostgreSQL database. reindexdb is a wrapper around the SQL command REINDEX(7). There is no effective difference between reindexing databases via this utility and via other methods for accessing the server.


Usage:

reindexdb [connection-option...] [option...] [ --schema | -S schema ]... [ --table | -t table ]...
[ --index | -i index ]... [dbname]




Command Line Options:

--all
Reindex all databases.
reindexdb --all ...
--dbname
Specifies the name of the database to be reindexed. If this is not specified and -a (or --all) is notused, the database name is read from the environment variable PGDATABASE. If that is not set, the username specified for the connection is used.
reindexdb --dbname ...
--echo
Echo the commands that reindexdb generates and sends to the server.
reindexdb --echo ...
--index
Recreate index only. Multiple indexes can be recreated by writing multiple -i switches.
reindexdb --index ...
--quiet
Do not display progress messages.
reindexdb --quiet ...
--system
Reindex database's system catalogs.
reindexdb --system ...
--schema
Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches.
reindexdb --schema ...
--table
Reindex table only. Multiple tables can be reindexed by writing multiple -t switches.
reindexdb --table ...
--verbose
Print detailed information during processing.
reindexdb --verbose ...
--version
Print the reindexdb version and exit.
reindexdb --version ...
--help
Show help about reindexdb command line arguments, and exit.reindexdb also accepts the following command-line arguments for connection parameters:
reindexdb --help ...
--host
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.
reindexdb --host ...
--port
Specifies the TCP port or local Unix domain socket file extension on which the server is listening forconnections.
reindexdb --port ...
--username
User name to connect as.
reindexdb --username ...
--no-password
Never issue a password prompt. If the server requires password authentication and a password is notavailable by other means such as a .pgpass file, the connection attempt will fail. This option can beuseful in batch jobs and scripts where no user is present to enter a password.
reindexdb --no-password ...
--password
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 serverdemands password authentication. However, reindexdb will waste a connection attempt finding out that theserver wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.
reindexdb --password ...
--maintenance-db
Specifies the name of the database to connect to discover what other databases should be reindexed. If notspecified, the postgres database will be used, and if that does not exist, template1 will be used.ENVIRONMENTPGDATABASEPGHOSTPGPORTPGUSERDefault connection parametersThis utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq(see Section 33.14).DIAGNOSTICSIn case of difficulty, see REINDEX(7) and psql(1) for discussions of potential problems and error messages.The database server must be running at the targeted host. Also, any default connection settings andenvironment variables used by the libpq front-end library will apply.NOTESreindexdb might need to connect several times to the PostgreSQL server, asking for a password each time. It isconvenient to have a ~/.pgpass file in such cases. See Section 33.15 for more information.EXAMPLESTo reindex the database test:$ reindexdb testTo reindex the table foo and the index bar in a database named abcd:$ reindexdb --table=foo --index=bar abcd
reindexdb --maintenance-db ...