2
doc/src/sgml/ref/reindexdb.sgml
3
PostgreSQL documentation
6
<refentry id="APP-REINDEXDB">
8
<refentrytitle><application>reindexdb</application></refentrytitle>
9
<manvolnum>1</manvolnum>
10
<refmiscinfo>Application</refmiscinfo>
14
<refname id="reindexdb">reindexdb</refname>
15
<refpurpose>reindex a <productname>PostgreSQL</productname> database</refpurpose>
18
<indexterm zone="app-reindexdb">
19
<primary>reindexdb</primary>
24
<command>reindexdb</command>
25
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
26
<arg>--table | -t <replaceable>table</replaceable> </arg>
27
<arg>--index | -i <replaceable>index</replaceable> </arg>
28
<arg><replaceable>dbname</replaceable></arg>
32
<command>reindexdb</command>
33
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
38
<command>reindexdb</command>
39
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
40
<arg>--system | -s</arg>
41
<arg><replaceable>dbname</replaceable></arg>
47
<title>Description</title>
50
<application>reindexdb</application> is a utility for rebuilding indexes
51
in a <productname>PostgreSQL</productname> database.
55
<application>reindexdb</application> is a wrapper around the SQL
56
command <xref linkend="SQL-REINDEX">.
57
There is no effective difference between reindexing databases via
58
this utility and via other methods for accessing the server.
65
<title>Options</title>
68
<application>reindexdb</application> accepts the following command-line arguments:
72
<term><option>-a</></term>
73
<term><option>--all</></term>
76
Reindex all databases.
82
<term><option><optional>-d</> <replaceable class="parameter">dbname</replaceable></></term>
83
<term><option><optional>--dbname=</><replaceable class="parameter">dbname</replaceable></></term>
86
Specifies the name of the database to be reindexed.
87
If this is not specified and <option>-a</option> (or
88
<option>--all</option>) is not used, the database name is read
89
from the environment variable <envar>PGDATABASE</envar>. If
90
that is not set, the user name specified for the connection is
97
<term><option>-e</></term>
98
<term><option>--echo</></term>
101
Echo the commands that <application>reindexdb</application> generates
102
and sends to the server.
108
<term><option>-i <replaceable class="parameter">index</replaceable></></term>
109
<term><option>--index=<replaceable class="parameter">index</replaceable></></term>
112
Recreate <replaceable class="parameter">index</replaceable> only.
118
<term><option>-q</></term>
119
<term><option>--quiet</></term>
122
Do not display progress messages.
128
<term><option>-s</></term>
129
<term><option>--system</></term>
132
Reindex database's system catalogs.
138
<term><option>-t <replaceable class="parameter">table</replaceable></></term>
139
<term><option>--table=<replaceable class="parameter">table</replaceable></></term>
142
Reindex <replaceable class="parameter">table</replaceable> only.
148
<term><option>-V</></term>
149
<term><option>--version</></term>
152
Print the <application>reindexdb</application> version and exit.
158
<term><option>-?</></term>
159
<term><option>--help</></term>
162
Show help about <application>reindexdb</application> command line
173
<application>reindexdb</application> also accepts
174
the following command-line arguments for connection parameters:
178
<term><option>-h <replaceable class="parameter">host</replaceable></></term>
179
<term><option>--host=<replaceable class="parameter">host</replaceable></></term>
182
Specifies the host name of the machine on which the server is
183
running. If the value begins with a slash, it is used as the
184
directory for the Unix domain socket.
190
<term><option>-p <replaceable class="parameter">port</replaceable></></term>
191
<term><option>--port=<replaceable class="parameter">port</replaceable></></term>
194
Specifies the TCP port or local Unix domain socket file
195
extension on which the server
196
is listening for connections.
202
<term><option>-U <replaceable class="parameter">username</replaceable></></term>
203
<term><option>--username=<replaceable class="parameter">username</replaceable></></term>
206
User name to connect as.
212
<term><option>-w</></term>
213
<term><option>--no-password</></term>
216
Never issue a password prompt. If the server requires
217
password authentication and a password is not available by
218
other means such as a <filename>.pgpass</filename> file, the
219
connection attempt will fail. This option can be useful in
220
batch jobs and scripts where no user is present to enter a
227
<term><option>-W</></term>
228
<term><option>--password</></term>
231
Force <application>reindexdb</application> to prompt for a
232
password before connecting to a database.
236
This option is never essential, since
237
<application>reindexdb</application> will automatically prompt
238
for a password if the server demands password authentication.
239
However, <application>reindexdb</application> will waste a
240
connection attempt finding out that the server wants a password.
241
In some cases it is worth typing <option>-W</> to avoid the extra
252
<title>Environment</title>
256
<term><envar>PGDATABASE</envar></term>
257
<term><envar>PGHOST</envar></term>
258
<term><envar>PGPORT</envar></term>
259
<term><envar>PGUSER</envar></term>
263
Default connection parameters
270
This utility, like most other <productname>PostgreSQL</> utilities,
271
also uses the environment variables supported by <application>libpq</>
272
(see <xref linkend="libpq-envars">).
279
<title>Diagnostics</title>
282
In case of difficulty, see <xref linkend="SQL-REINDEX">
283
and <xref linkend="APP-PSQL"> for
284
discussions of potential problems and error messages.
285
The database server must be running at the
286
targeted host. Also, any default connection settings and environment
287
variables used by the <application>libpq</application> front-end
298
<application>reindexdb</application> might need to connect several
299
times to the <productname>PostgreSQL</productname> server, asking
300
for a password each time. It is convenient to have a
301
<filename>~/.pgpass</> file in such cases. See <xref
302
linkend="libpq-pgpass"> for more information.
308
<title>Examples</title>
311
To reindex the database <literal>test</literal>:
313
<prompt>$ </prompt><userinput>reindexdb test</userinput>
318
To reindex the table <literal>foo</literal> and the index
319
<literal>bar</literal> in a database named <literal>abcd</literal>:
321
<prompt>$ </prompt><userinput>reindexdb --table foo --index bar abcd</userinput>
328
<title>See Also</title>
330
<simplelist type="inline">
331
<member><xref linkend="sql-reindex"></member>