Add more explicit note that the parameters of MOVE are identical to FETCH.
[PostgreSQL.git] / doc / src / sgml / ref / reindexdb.sgml
blob936edb9c3daeec8f68f295188a44caac84da6c0f
1 <!--
2 $PostgreSQL $
3 PostgreSQL documentation
4 -->
6 <refentry id="APP-REINDEXDB">
7 <refmeta>
8 <refentrytitle id="APP-REINDEXDB-TITLE"><application>reindexdb</application></refentrytitle>
9 <manvolnum>1</manvolnum>
10 <refmiscinfo>Application</refmiscinfo>
11 </refmeta>
13 <refnamediv>
14 <refname id="reindexdb">reindexdb</refname>
15 <refpurpose>reindex a <productname>PostgreSQL</productname> database</refpurpose>
16 </refnamediv>
18 <indexterm zone="app-reindexdb">
19 <primary>reindexdb</primary>
20 </indexterm>
22 <refsynopsisdiv>
23 <cmdsynopsis>
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>
29 <sbr>
30 <command>reindexdb</command>
31 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
32 <arg>--all | -a</arg>
33 <sbr>
34 <command>reindexdb</command>
35 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
36 <arg>--system | -s</arg>
37 <arg><replaceable>dbname</replaceable></arg>
38 </cmdsynopsis>
39 </refsynopsisdiv>
42 <refsect1>
43 <title>Description</title>
45 <para>
46 <application>reindexdb</application> is a utility for rebuilding indexes
47 in a <productname>PostgreSQL</productname> database.
48 </para>
50 <para>
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.
55 </para>
57 </refsect1>
60 <refsect1>
61 <title>Options</title>
63 <para>
64 <application>reindexdb</application> accepts the following command-line arguments:
66 <variablelist>
67 <varlistentry>
68 <term><option>-a</></term>
69 <term><option>--all</></term>
70 <listitem>
71 <para>
72 Reindex all databases.
73 </para>
74 </listitem>
75 </varlistentry>
77 <varlistentry>
78 <term><option><optional>-d</> <replaceable class="parameter">dbname</replaceable></></term>
79 <term><option><optional>--dbname</> <replaceable class="parameter">dbname</replaceable></></term>
80 <listitem>
81 <para>
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
87 used.
88 </para>
89 </listitem>
90 </varlistentry>
92 <varlistentry>
93 <term><option>-e</></term>
94 <term><option>--echo</></term>
95 <listitem>
96 <para>
97 Echo the commands that <application>reindexdb</application> generates
98 and sends to the server.
99 </para>
100 </listitem>
101 </varlistentry>
103 <varlistentry>
104 <term><option>-i <replaceable class="parameter">index</replaceable></></term>
105 <term><option>--index <replaceable class="parameter">index</replaceable></></term>
106 <listitem>
107 <para>
108 Recreate <replaceable class="parameter">index</replaceable> only.
109 </para>
110 </listitem>
111 </varlistentry>
113 <varlistentry>
114 <term><option>-q</></term>
115 <term><option>--quiet</></term>
116 <listitem>
117 <para>
118 Do not display progress messages.
119 </para>
120 </listitem>
121 </varlistentry>
123 <varlistentry>
124 <term><option>-s</></term>
125 <term><option>--system</></term>
126 <listitem>
127 <para>
128 Reindex database's system catalogs.
129 </para>
130 </listitem>
131 </varlistentry>
133 <varlistentry>
134 <term><option>-t <replaceable class="parameter">table</replaceable></></term>
135 <term><option>--table <replaceable class="parameter">table</replaceable></></term>
136 <listitem>
137 <para>
138 Reindex <replaceable class="parameter">table</replaceable> only.
139 </para>
140 </listitem>
141 </varlistentry>
142 </variablelist>
143 </para>
145 <para>
146 <application>reindexdb</application> also accepts
147 the following command-line arguments for connection parameters:
149 <variablelist>
150 <varlistentry>
151 <term><option>-h <replaceable class="parameter">host</replaceable></></term>
152 <term><option>--host <replaceable class="parameter">host</replaceable></></term>
153 <listitem>
154 <para>
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.
158 </para>
159 </listitem>
160 </varlistentry>
162 <varlistentry>
163 <term><option>-p <replaceable class="parameter">port</replaceable></></term>
164 <term><option>--port <replaceable class="parameter">port</replaceable></></term>
165 <listitem>
166 <para>
167 Specifies the TCP port or local Unix domain socket file
168 extension on which the server
169 is listening for connections.
170 </para>
171 </listitem>
172 </varlistentry>
174 <varlistentry>
175 <term><option>-U <replaceable class="parameter">username</replaceable></></term>
176 <term><option>--username <replaceable class="parameter">username</replaceable></></term>
177 <listitem>
178 <para>
179 User name to connect as.
180 </para>
181 </listitem>
182 </varlistentry>
184 <varlistentry>
185 <term><option>-w</></term>
186 <term><option>--no-password</></term>
187 <listitem>
188 <para>
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
194 password.
195 </para>
196 </listitem>
197 </varlistentry>
199 <varlistentry>
200 <term><option>-W</></term>
201 <term><option>--password</></term>
202 <listitem>
203 <para>
204 Force <application>reindexdb</application> to prompt for a
205 password before connecting to a database.
206 </para>
208 <para>
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
215 connection attempt.
216 </para>
217 </listitem>
218 </varlistentry>
219 </variablelist>
220 </para>
221 </refsect1>
224 <refsect1>
225 <title>Environment</title>
227 <variablelist>
228 <varlistentry>
229 <term><envar>PGDATABASE</envar></term>
230 <term><envar>PGHOST</envar></term>
231 <term><envar>PGPORT</envar></term>
232 <term><envar>PGUSER</envar></term>
234 <listitem>
235 <para>
236 Default connection parameters
237 </para>
238 </listitem>
239 </varlistentry>
240 </variablelist>
242 <para>
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">).
246 </para>
248 </refsect1>
251 <refsect1>
252 <title>Diagnostics</title>
254 <para>
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
261 library will apply.
262 </para>
264 </refsect1>
267 <refsect1>
268 <title>Notes</title>
270 <para>
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.
276 </para>
277 </refsect1>
280 <refsect1>
281 <title>Examples</title>
283 <para>
284 To reindex the database <literal>test</literal>:
285 <screen>
286 <prompt>$ </prompt><userinput>reindexdb test</userinput>
287 </screen>
288 </para>
290 <para>
291 To reindex the table <literal>foo</literal> and the index
292 <literal>bar</literal> in a database named <literal>abcd</literal>:
293 <screen>
294 <prompt>$ </prompt><userinput>reindexdb --table foo --index bar abcd</userinput>
295 </screen>
296 </para>
298 </refsect1>
300 <refsect1>
301 <title>See Also</title>
303 <simplelist type="inline">
304 <member><xref linkend="sql-reindex" endterm="sql-reindex-title"></member>
305 </simplelist>
306 </refsect1>
308 </refentry>