3 PostgreSQL documentation
6 <refentry id=
"APP-REINDEXDB">
8 <refentrytitle id=
"APP-REINDEXDB-TITLE"><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>
30 <command>reindexdb
</command>
31 <arg rep=
"repeat"><replaceable>connection-option
</replaceable></arg>
34 <command>reindexdb
</command>
35 <arg rep=
"repeat"><replaceable>connection-option
</replaceable></arg>
36 <arg>--system | -s
</arg>
37 <arg><replaceable>dbname
</replaceable></arg>
43 <title>Description
</title>
46 <application>reindexdb
</application> is a utility for rebuilding indexes
47 in a
<productname>PostgreSQL
</productname> database.
51 <application>reindexdb
</application> is a wrapper around the SQL
52 command
<xref linkend=
"SQL-REINDEX" endterm=
"sql-reindex-title">.
53 There is no effective difference between reindexing databases via
54 this utility and via other methods for accessing the server.
61 <title>Options
</title>
64 <application>reindexdb
</application> accepts the following command-line arguments:
68 <term><option>-a<
/></term>
69 <term><option>--all<
/></term>
72 Reindex all databases.
78 <term><option><optional>-d<
/> <replaceable class=
"parameter">dbname
</replaceable><
/></term>
79 <term><option><optional>--dbname<
/> <replaceable class=
"parameter">dbname
</replaceable><
/></term>
82 Specifies the name of the database to be reindexed.
83 If this is not specified and
<option>-a
</option> (or
84 <option>--all
</option>) is not used, the database name is read
85 from the environment variable
<envar>PGDATABASE
</envar>. If
86 that is not set, the user name specified for the connection is
93 <term><option>-e<
/></term>
94 <term><option>--echo<
/></term>
97 Echo the commands that
<application>reindexdb
</application> generates
98 and sends to the server.
104 <term><option>-i
<replaceable class=
"parameter">index
</replaceable><
/></term>
105 <term><option>--index
<replaceable class=
"parameter">index
</replaceable><
/></term>
108 Recreate
<replaceable class=
"parameter">index
</replaceable> only.
114 <term><option>-q<
/></term>
115 <term><option>--quiet<
/></term>
118 Do not display progress messages.
124 <term><option>-s<
/></term>
125 <term><option>--system<
/></term>
128 Reindex database's system catalogs.
134 <term><option>-t
<replaceable class=
"parameter">table
</replaceable><
/></term>
135 <term><option>--table
<replaceable class=
"parameter">table
</replaceable><
/></term>
138 Reindex
<replaceable class=
"parameter">table
</replaceable> only.
146 <application>reindexdb
</application> also accepts
147 the following command-line arguments for connection parameters:
151 <term><option>-h
<replaceable class=
"parameter">host
</replaceable><
/></term>
152 <term><option>--host
<replaceable class=
"parameter">host
</replaceable><
/></term>
155 Specifies the host name of the machine on which the server is
156 running. If the value begins with a slash, it is used as the
157 directory for the Unix domain socket.
163 <term><option>-p
<replaceable class=
"parameter">port
</replaceable><
/></term>
164 <term><option>--port
<replaceable class=
"parameter">port
</replaceable><
/></term>
167 Specifies the TCP port or local Unix domain socket file
168 extension on which the server
169 is listening for connections.
175 <term><option>-U
<replaceable class=
"parameter">username
</replaceable><
/></term>
176 <term><option>--username
<replaceable class=
"parameter">username
</replaceable><
/></term>
179 User name to connect as.
185 <term><option>-w<
/></term>
186 <term><option>--no-password<
/></term>
189 Never issue a password prompt. If the server requires
190 password authentication and a password is not available by
191 other means such as a
<filename>.pgpass
</filename> file, the
192 connection attempt will fail. This option can be useful in
193 batch jobs and scripts where no user is present to enter a
200 <term><option>-W<
/></term>
201 <term><option>--password<
/></term>
204 Force
<application>reindexdb
</application> to prompt for a
205 password before connecting to a database.
209 This option is never essential, since
210 <application>reindexdb
</application> will automatically prompt
211 for a password if the server demands password authentication.
212 However,
<application>reindexdb
</application> will waste a
213 connection attempt finding out that the server wants a password.
214 In some cases it is worth typing
<option>-W<
/> to avoid the extra
225 <title>Environment
</title>
229 <term><envar>PGDATABASE
</envar></term>
230 <term><envar>PGHOST
</envar></term>
231 <term><envar>PGPORT
</envar></term>
232 <term><envar>PGUSER
</envar></term>
236 Default connection parameters
243 This utility, like most other
<productname>PostgreSQL<
/> utilities,
244 also uses the environment variables supported by
<application>libpq<
/>
245 (see
<xref linkend=
"libpq-envars">).
252 <title>Diagnostics
</title>
255 In case of difficulty, see
<xref linkend=
"SQL-REINDEX"
256 endterm=
"sql-reindex-title"> and
<xref linkend=
"APP-PSQL"> for
257 discussions of potential problems and error messages.
258 The database server must be running at the
259 targeted host. Also, any default connection settings and environment
260 variables used by the
<application>libpq
</application> front-end
271 <application>reindexdb
</application> might need to connect several
272 times to the
<productname>PostgreSQL
</productname> server, asking
273 for a password each time. It is convenient to have a
274 <filename>~/.pgpass<
/> file in such cases. See
<xref
275 linkend=
"libpq-pgpass"> for more information.
281 <title>Examples
</title>
284 To reindex the database
<literal>test
</literal>:
286 <prompt>$
</prompt><userinput>reindexdb test
</userinput>
291 To reindex the table
<literal>foo
</literal> and the index
292 <literal>bar
</literal> in a database named
<literal>abcd
</literal>:
294 <prompt>$
</prompt><userinput>reindexdb --table foo --index bar abcd
</userinput>
301 <title>See Also
</title>
303 <simplelist type=
"inline">
304 <member><xref linkend=
"sql-reindex" endterm=
"sql-reindex-title"></member>