]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/vacuumdb.sgml
a4d1a4c26e41bd03b9dc3a18150b71802cfb2b24
[postgresql] / doc / src / sgml / ref / vacuumdb.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.18 2001/09/03 12:57:50 petere Exp $
3 Postgres documentation
4 -->
5
6 <refentry id="APP-VACUUMDB">
7  <docinfo>
8   <date>2000-11-11</date>
9  </docinfo>
10
11  <refmeta>
12   <refentrytitle id="APP-VACUUMDB-TITLE"><application>vacuumdb</application></refentrytitle>
13   <manvolnum>1</manvolnum>
14   <refmiscinfo>Application</refmiscinfo>
15  </refmeta>
16
17  <refnamediv>
18   <refname id="vacuumdb">vacuumdb</refname>
19   <refpurpose>garbage-collect and analyze a <productname>PostgreSQL</productname> database</refpurpose>
20  </refnamediv>
21
22  <refsynopsisdiv>
23   <cmdsynopsis>
24    <command>vacuumdb</command>
25    <arg rep="repeat"><replaceable>connection-options</replaceable></arg>
26    <arg><arg>-d</arg> <replaceable>dbname</replaceable></arg>
27    <group><arg>--full</arg><arg>-f</arg></group>
28    <group><arg>--verbose</arg><arg>-v</arg></group>
29    <group><arg>--analyze</arg><arg>-z</arg></group>
30    <arg>--table '<replaceable>table</replaceable>
31     <arg>( <replaceable class="parameter">column</replaceable> [,...] )</arg>'
32    </arg>
33    <sbr>
34    <command>vacuumdb</command>
35    <arg rep="repeat"><replaceable>connection-options</replaceable></arg>
36    <group><arg>--all</arg><arg>-a</arg></group>
37    <group><arg>--full</arg><arg>-f</arg></group>
38    <group><arg>--verbose</arg><arg>-v</arg></group>
39    <group><arg>--analyze</arg><arg>-z</arg></group>
40   </cmdsynopsis>
41
42   <refsect2 id="R2-APP-VACUUMDB-1">
43    <title>
44     Inputs
45    </title>
46    <para>
47     <application>vacuumdb</application> accepts the following command line arguments:
48     
49     <variablelist>
50      <varlistentry>
51       <term>-d <replaceable class="parameter">dbname</replaceable></term>
52       <term>--dbname <replaceable class="parameter">dbname</replaceable></term>
53       <listitem>
54        <para>
55         Specifies the name of the database to be cleaned or analyzed.
56        </para>
57       </listitem>
58      </varlistentry>
59
60      <varlistentry>
61       <term>-a</term>
62       <term>--alldb</term>
63       <listitem>
64        <para>
65         Vacuum all databases.
66        </para>
67       </listitem>
68      </varlistentry>
69
70      <varlistentry>
71       <term>-f</term>
72       <term>--full</term>
73       <listitem>
74        <para>
75         Perform <quote>full</quote> vacuuming.
76        </para>
77       </listitem>
78      </varlistentry>
79
80      <varlistentry>
81       <term>-v</term>
82       <term>--verbose</term>
83       <listitem>
84        <para>
85         Print detailed information during processing.
86        </para>
87       </listitem>
88      </varlistentry>
89
90      <varlistentry>
91       <term>-z</term>
92       <term>--analyze</term>
93       <listitem>
94        <para>
95         Calculate statistics for use by the optimizer.
96        </para>
97       </listitem>
98      </varlistentry>
99
100      <varlistentry>
101       <term>-t <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term>
102       <term>--table <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term>
103       <listitem>
104        <para>
105         Clean or analyze <replaceable class="parameter">table</replaceable> only.
106         Column names may be specified only in conjunction with
107         the <option>--analyze</option> option.
108        </para>
109        <tip>
110         <para>
111          If you specify columns to vacuum, you probably have to escape the parentheses
112          from the shell.
113         </para>
114        </tip>
115       </listitem>
116      </varlistentry>
117
118     </variablelist>
119    </para>
120
121    <para>
122     <application>vacuumdb</application> also accepts 
123     the following command line arguments for connection parameters:
124     
125     <variablelist>
126      <varlistentry>
127       <term>-h <replaceable class="parameter">host</replaceable></term>
128       <term>--host <replaceable class="parameter">host</replaceable></term>
129       <listitem>
130        <para>
131         Specifies the hostname of the machine on which the 
132         <application>postmaster</application>
133         is running.  If host begins with a slash, it is used 
134         as the directory for the unix domain socket.
135        </para>
136       </listitem>
137      </varlistentry>
138
139      <varlistentry>
140       <term>-p <replaceable class="parameter">port</replaceable></term>
141       <term>--port <replaceable class="parameter">port</replaceable></term>
142       <listitem>
143        <para>
144         Specifies the Internet TCP/IP port or local Unix domain socket file 
145         extension on which the <application>postmaster</application>
146         is listening for connections.
147        </para>
148       </listitem>
149      </varlistentry>
150
151      <varlistentry>
152       <term>-U <replaceable class="parameter">username</replaceable></term>
153       <term>--username <replaceable class="parameter">username</replaceable></term>
154       <listitem>
155        <para>
156         Username to connect as.
157        </para>
158       </listitem>
159      </varlistentry>
160
161      <varlistentry>
162       <term>-W</term>
163       <term>--password</term>
164       <listitem>
165        <para>
166         Force password prompt.
167        </para>
168       </listitem>
169      </varlistentry>
170
171      <varlistentry>
172       <term>-e</term>
173       <term>--echo</term>
174       <listitem>
175        <para>
176         Echo the commands that <application>vacuumdb</application> generates
177         and sends to the backend.
178        </para>
179       </listitem>
180      </varlistentry>
181
182      <varlistentry>
183       <term>-q</term>
184       <term>--quiet</term>
185       <listitem>
186        <para>
187         Do not display a response.
188        </para>
189       </listitem>
190      </varlistentry>
191     </variablelist>
192    </para>
193   </refsect2>
194
195   <refsect2 id="R2-APP-VACUUMDB-2">
196    <title>
197     Outputs
198    </title>
199    <para>
200     <variablelist>
201      <varlistentry>
202       <term><computeroutput>VACUUM</computeroutput></term>
203       <listitem>
204        <para>
205         Everything went well.
206        </para>
207       </listitem>
208      </varlistentry>
209
210      <varlistentry>
211       <term><computeroutput>vacuumdb: Vacuum failed.</computeroutput></term>
212       <listitem>
213        <para>
214         Something went wrong. <application>vacuumdb</application> is only a wrapper
215         script. See <xref linkend="SQL-VACUUM" endterm="SQL-VACUUM-title">
216         and <xref linkend="APP-PSQL"> for a detailed
217         discussion of error messages and potential problems.
218        </para>
219       </listitem>
220      </varlistentry>
221
222     </variablelist>
223    </para>
224
225    <para>
226    </para>
227
228   </refsect2>
229  </refsynopsisdiv>
230  
231  <refsect1 id="R1-APP-VACUUMDB-1">
232   <title>
233    Description
234   </title>
235
236   <para>
237    <application>vacuumdb</application> is a utility for cleaning a
238    <productname>Postgres</productname> database.
239    <application>vacuumdb</application> will also generate internal statistics
240    used by the <productname>Postgres</productname> query optimizer.
241   </para>
242
243   <para>
244    <application>vacuumdb</application> is a shell script wrapper around the
245    backend command
246    <xref linkend="SQL-VACUUM" endterm="SQL-VACUUM-title"> via
247    the <productname>Postgres</productname> interactive terminal
248    <xref linkend="APP-PSQL">. There is no effective
249    difference between vacuuming databases via this or other methods.
250    <application>psql</application> must be found by the script and
251    a database server must be running at the targeted host. Also, any default
252    settings and environment variables available to <application>psql</application>
253    and the <application>libpq</application> front-end library do apply.
254   </para>
255
256  </refsect1>
257
258  <refsect1 id="R1-APP-VACUUMDB-3">
259   <title>Usage</title>
260
261   <informalexample>
262    <para>
263     To clean the database <literal>test</literal>:
264 <screen>
265 <prompt>$ </prompt><userinput>vacuumdb test</userinput>
266 </screen>
267    </para>
268   </informalexample>
269
270   <informalexample>
271    <para>
272     To clean and analyze for the optimizer a database named
273     <literal>bigdb</literal>:
274 <screen>
275 <prompt>$ </prompt><userinput>vacuumdb --analyze bigdb</userinput>
276 </screen>
277    </para>
278   </informalexample>
279
280   <informalexample>
281    <para>
282     To clean a single table
283     <literal>foo</literal> in a database named
284     <literal>xyzzy</literal>, and analyze a single column
285     <literal>bar</literal> of the table for the optimizer:
286 <screen>
287 <prompt>$ </prompt><userinput>vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy</userinput>
288 </screen>
289    </para>
290   </informalexample>
291
292  </refsect1>
293 </refentry>
294
295 <!-- Keep this comment at the end of the file
296 Local variables:
297 mode: sgml
298 sgml-omittag:nil
299 sgml-shorttag:t
300 sgml-minimize-attributes:nil
301 sgml-always-quote-attributes:t
302 sgml-indent-step:1
303 sgml-indent-data:t
304 sgml-parent-document:nil
305 sgml-default-dtd-file:"../reference.ced"
306 sgml-exposed-tags:nil
307 sgml-local-catalogs:"/usr/lib/sgml/catalog"
308 sgml-local-ecat-files:nil
309 End:
310 -->