2 doc/src/sgml/ref/reindexdb.sgml
3 PostgreSQL documentation
6 <refentry id="APP-REINDEXDB">
7 <indexterm zone="app-reindexdb">
8 <primary>reindexdb</primary>
12 <refentrytitle><application>reindexdb</application></refentrytitle>
13 <manvolnum>1</manvolnum>
14 <refmiscinfo>Application</refmiscinfo>
18 <refname id="reindexdb">reindexdb</refname>
19 <refpurpose>reindex a <productname>PostgreSQL</productname> database</refpurpose>
24 <command>reindexdb</command>
25 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
26 <arg rep="repeat"><replaceable>option</replaceable></arg>
28 <arg choice="plain" rep="repeat">
30 <group choice="plain">
31 <arg choice="plain"><option>--schema</option></arg>
32 <arg choice="plain"><option>-S</option></arg>
34 <replaceable>schema</replaceable>
38 <arg choice="plain" rep="repeat">
40 <group choice="plain">
41 <arg choice="plain"><option>--table</option></arg>
42 <arg choice="plain"><option>-t</option></arg>
44 <replaceable>table</replaceable>
48 <arg choice="plain" rep="repeat">
50 <group choice="plain">
51 <arg choice="plain"><option>--index</option></arg>
52 <arg choice="plain"><option>-i</option></arg>
54 <replaceable>index</replaceable>
58 <arg choice="opt"><replaceable>dbname</replaceable></arg>
62 <command>reindexdb</command>
63 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
64 <arg rep="repeat"><replaceable>option</replaceable></arg>
66 <group choice="plain">
67 <arg choice="plain"><option>--all</option></arg>
68 <arg choice="plain"><option>-a</option></arg>
73 <command>reindexdb</command>
74 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
75 <arg rep="repeat"><replaceable>option</replaceable></arg>
77 <group choice="plain">
78 <arg choice="plain"><option>--system</option></arg>
79 <arg choice="plain"><option>-s</option></arg>
81 <arg choice="opt"><replaceable>dbname</replaceable></arg>
87 <title>Description</title>
90 <application>reindexdb</application> is a utility for rebuilding indexes
91 in a <productname>PostgreSQL</productname> database.
95 <application>reindexdb</application> is a wrapper around the SQL
96 command <xref linkend="SQL-REINDEX">.
97 There is no effective difference between reindexing databases via
98 this utility and via other methods for accessing the server.
105 <title>Options</title>
108 <application>reindexdb</application> accepts the following command-line arguments:
112 <term><option>-a</></term>
113 <term><option>--all</></term>
116 Reindex all databases.
122 <term><option><optional>-d</> <replaceable class="parameter">dbname</replaceable></></term>
123 <term><option><optional>--dbname=</><replaceable class="parameter">dbname</replaceable></></term>
126 Specifies the name of the database to be reindexed.
127 If this is not specified and <option>-a</option> (or
128 <option>--all</option>) is not used, the database name is read
129 from the environment variable <envar>PGDATABASE</envar>. If
130 that is not set, the user name specified for the connection is
137 <term><option>-e</></term>
138 <term><option>--echo</></term>
141 Echo the commands that <application>reindexdb</application> generates
142 and sends to the server.
148 <term><option>-i <replaceable class="parameter">index</replaceable></></term>
149 <term><option>--index=<replaceable class="parameter">index</replaceable></></term>
152 Recreate <replaceable class="parameter">index</replaceable> only.
153 Multiple indexes can be recreated by writing multiple
154 <option>-i</> switches.
160 <term><option>-q</></term>
161 <term><option>--quiet</></term>
164 Do not display progress messages.
170 <term><option>-s</></term>
171 <term><option>--system</></term>
174 Reindex database's system catalogs.
180 <term><option>-S <replaceable class="parameter">schema</replaceable></></term>
181 <term><option>--schema=<replaceable class="parameter">schema</replaceable></></term>
184 Reindex <replaceable class="parameter">schema</replaceable> only.
185 Multiple schemas can be reindexed by writing multiple
186 <option>-S</> switches.
192 <term><option>-t <replaceable class="parameter">table</replaceable></></term>
193 <term><option>--table=<replaceable class="parameter">table</replaceable></></term>
196 Reindex <replaceable class="parameter">table</replaceable> only.
197 Multiple tables can be reindexed by writing multiple
198 <option>-t</> switches.
204 <term><option>-v</></term>
205 <term><option>--verbose</></term>
208 Print detailed information during processing.
214 <term><option>-V</></term>
215 <term><option>--version</></term>
218 Print the <application>reindexdb</application> version and exit.
224 <term><option>-?</></term>
225 <term><option>--help</></term>
228 Show help about <application>reindexdb</application> command line
239 <application>reindexdb</application> also accepts
240 the following command-line arguments for connection parameters:
244 <term><option>-h <replaceable class="parameter">host</replaceable></></term>
245 <term><option>--host=<replaceable class="parameter">host</replaceable></></term>
248 Specifies the host name of the machine on which the server is
249 running. If the value begins with a slash, it is used as the
250 directory for the Unix domain socket.
256 <term><option>-p <replaceable class="parameter">port</replaceable></></term>
257 <term><option>--port=<replaceable class="parameter">port</replaceable></></term>
260 Specifies the TCP port or local Unix domain socket file
261 extension on which the server
262 is listening for connections.
268 <term><option>-U <replaceable class="parameter">username</replaceable></></term>
269 <term><option>--username=<replaceable class="parameter">username</replaceable></></term>
272 User name to connect as.
278 <term><option>-w</></term>
279 <term><option>--no-password</></term>
282 Never issue a password prompt. If the server requires
283 password authentication and a password is not available by
284 other means such as a <filename>.pgpass</filename> file, the
285 connection attempt will fail. This option can be useful in
286 batch jobs and scripts where no user is present to enter a
293 <term><option>-W</></term>
294 <term><option>--password</></term>
297 Force <application>reindexdb</application> to prompt for a
298 password before connecting to a database.
302 This option is never essential, since
303 <application>reindexdb</application> will automatically prompt
304 for a password if the server demands password authentication.
305 However, <application>reindexdb</application> will waste a
306 connection attempt finding out that the server wants a password.
307 In some cases it is worth typing <option>-W</> to avoid the extra
314 <term><option>--maintenance-db=<replaceable class="parameter">dbname</replaceable></></term>
317 Specifies the name of the database to connect to discover what other
318 databases should be reindexed. If not specified, the
319 <literal>postgres</literal> database will be used,
320 and if that does not exist, <literal>template1</literal> will be used.
330 <title>Environment</title>
334 <term><envar>PGDATABASE</envar></term>
335 <term><envar>PGHOST</envar></term>
336 <term><envar>PGPORT</envar></term>
337 <term><envar>PGUSER</envar></term>
341 Default connection parameters
348 This utility, like most other <productname>PostgreSQL</> utilities,
349 also uses the environment variables supported by <application>libpq</>
350 (see <xref linkend="libpq-envars">).
357 <title>Diagnostics</title>
360 In case of difficulty, see <xref linkend="SQL-REINDEX">
361 and <xref linkend="APP-PSQL"> for
362 discussions of potential problems and error messages.
363 The database server must be running at the
364 targeted host. Also, any default connection settings and environment
365 variables used by the <application>libpq</application> front-end
376 <application>reindexdb</application> might need to connect several
377 times to the <productname>PostgreSQL</productname> server, asking
378 for a password each time. It is convenient to have a
379 <filename>~/.pgpass</> file in such cases. See <xref
380 linkend="libpq-pgpass"> for more information.
386 <title>Examples</title>
389 To reindex the database <literal>test</literal>:
391 <prompt>$ </prompt><userinput>reindexdb test</userinput>
396 To reindex the table <literal>foo</literal> and the index
397 <literal>bar</literal> in a database named <literal>abcd</literal>:
399 <prompt>$ </prompt><userinput>reindexdb --table=foo --index=bar abcd</userinput>
405 <title>See Also</title>
407 <simplelist type="inline">
408 <member><xref linkend="sql-reindex"></member>