4 reindexdb — reindex a PostgreSQL database
8 reindexdb [connection-option...] [option...] [ -S | --schema schema ]
9 ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s |
10 --system ] [ dbname | -a | --all ]
14 reindexdb is a utility for rebuilding indexes in a PostgreSQL database.
16 reindexdb is a wrapper around the SQL command REINDEX. There is no
17 effective difference between reindexing databases via this utility and
18 via other methods for accessing the server.
22 reindexdb accepts the following command-line arguments:
26 Reindex all databases.
29 Use the CONCURRENTLY option. See REINDEX, where all the caveats
30 of this option are explained in detail.
34 Specifies the name of the database to be reindexed, when
35 -a/--all is not used. If this is not specified, the database
36 name is read from the environment variable PGDATABASE. If that
37 is not set, the user name specified for the connection is used.
38 The dbname can be a connection string. If so, connection string
39 parameters will override any conflicting command line options.
43 Echo the commands that reindexdb generates and sends to the
48 Recreate index only. Multiple indexes can be recreated by
49 writing multiple -i switches.
53 Execute the reindex commands in parallel by running njobs
54 commands simultaneously. This option may reduce the processing
55 time but it also increases the load on the database server.
57 reindexdb will open njobs connections to the database, so make
58 sure your max_connections setting is high enough to accommodate
61 Note that this option is incompatible with the --system option.
65 Do not display progress messages.
69 Reindex database's system catalogs only.
73 Reindex schema only. Multiple schemas can be reindexed by
74 writing multiple -S switches.
78 Reindex table only. Multiple tables can be reindexed by writing
81 --tablespace=tablespace
82 Specifies the tablespace where indexes are rebuilt. (This name
83 is processed as a double-quoted identifier.)
87 Print detailed information during processing.
91 Print the reindexdb version and exit.
95 Show help about reindexdb command line arguments, and exit.
97 reindexdb also accepts the following command-line arguments for
98 connection parameters:
102 Specifies the host name of the machine on which the server is
103 running. If the value begins with a slash, it is used as the
104 directory for the Unix domain socket.
108 Specifies the TCP port or local Unix domain socket file
109 extension on which the server is listening for connections.
113 User name to connect as.
117 Never issue a password prompt. If the server requires password
118 authentication and a password is not available by other means
119 such as a .pgpass file, the connection attempt will fail. This
120 option can be useful in batch jobs and scripts where no user is
121 present to enter a password.
125 Force reindexdb to prompt for a password before connecting to a
128 This option is never essential, since reindexdb will
129 automatically prompt for a password if the server demands
130 password authentication. However, reindexdb will waste a
131 connection attempt finding out that the server wants a password.
132 In some cases it is worth typing -W to avoid the extra
135 --maintenance-db=dbname
136 When the -a/--all is used, connect to this database to gather
137 the list of databases to reindex. If not specified, the postgres
138 database will be used, or if that does not exist, template1 will
139 be used. This can be a connection string. If so, connection
140 string parameters will override any conflicting command line
141 options. Also, connection string parameters other than the
142 database name itself will be re-used when connecting to other
151 Default connection parameters
154 Specifies whether to use color in diagnostic messages. Possible
155 values are always, auto and never.
157 This utility, like most other PostgreSQL utilities, also uses the
158 environment variables supported by libpq (see Section 32.15).
162 In case of difficulty, see REINDEX and psql for discussions of
163 potential problems and error messages. The database server must be
164 running at the targeted host. Also, any default connection settings and
165 environment variables used by the libpq front-end library will apply.
169 To reindex the database test:
172 To reindex the table foo and the index bar in a database named abcd:
173 $ reindexdb --table=foo --index=bar abcd