3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4
<title>clusterdb</title>
5
<link rel="stylesheet" href="stylesheet.css" type="text/css">
6
<link rev="made" href="pgsql-docs@postgresql.org">
7
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
8
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
9
<link rel="up" href="reference-client.html" title="PostgreSQL Client Applications">
10
<link rel="prev" href="reference-client.html" title="PostgreSQL Client Applications">
11
<link rel="next" href="app-createdb.html" title="createdb">
12
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
15
<a name="app-clusterdb"></a><div class="titlepage"></div>
16
<div class="refnamediv">
18
<p>clusterdb — cluster a <span class="productname">PostgreSQL</span> database</p>
20
<a name="id791263"></a><div class="refsynopsisdiv">
22
<div class="cmdsynopsis"><p><code class="command">clusterdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [--table | -t <em class="replaceable"><code>table</code></em> ] [<em class="replaceable"><code>dbname</code></em>]<br><code class="command">clusterdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [[--all] | [-a]]</p></div>
24
<div class="refsect1" lang="en">
25
<a name="id791347"></a><h2>Description</h2>
26
<p> <span class="application">clusterdb</span> is a utility for reclustering tables
27
in a <span class="productname">PostgreSQL</span> database. It finds tables
28
that have previously been clustered, and clusters them again on the same
29
index that was last used. Tables that have never been clustered are not
32
<p> <span class="application">clusterdb</span> is a wrapper around the SQL
33
command <a href="sql-cluster.html">CLUSTER</a>.
34
There is no effective difference between clustering databases via
35
this utility and via other methods for accessing the server.
38
<div class="refsect1" lang="en">
39
<a name="id791394"></a><h2>Options</h2>
40
<p> <span class="application">clusterdb</span> accepts the following command-line arguments:
43
<div class="variablelist"><dl>
45
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-a</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--all</code></span>
47
<dd><p> Cluster all databases.
50
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">[<span class="optional">-d</span>] <em class="replaceable"><code>dbname</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">[<span class="optional">--dbname</span>] <em class="replaceable"><code>dbname</code></em></code></span>
52
<dd><p> Specifies the name of the database to be clustered.
53
If this is not specified and <code class="option">-a</code> (or
54
<code class="option">--all</code>) is not used, the database name is read
55
from the environment variable <code class="envar">PGDATABASE</code>. If
56
that is not set, the user name specified for the connection is
60
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-e</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--echo</code></span>
62
<dd><p> Echo the commands that <span class="application">clusterdb</span> generates
63
and sends to the server.
66
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-q</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--quiet</code></span>
68
<dd><p> Do not display a response.
71
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-t <em class="replaceable"><code>table</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--table <em class="replaceable"><code>table</code></em></code></span>
73
<dd><p> Cluster <em class="replaceable"><code>table</code></em> only.
78
<p> <span class="application">clusterdb</span> also accepts
79
the following command-line arguments for connection parameters:
82
<div class="variablelist"><dl>
84
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-h <em class="replaceable"><code>host</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--host <em class="replaceable"><code>host</code></em></code></span>
86
<dd><p> Specifies the host name of the machine on which the server is
87
running. If the value begins with a slash, it is used as the
88
directory for the Unix domain socket.
91
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-p <em class="replaceable"><code>port</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--port <em class="replaceable"><code>port</code></em></code></span>
93
<dd><p> Specifies the TCP port or local Unix domain socket file
94
extension on which the server
95
is listening for connections.
98
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-U <em class="replaceable"><code>username</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--username <em class="replaceable"><code>username</code></em></code></span>
100
<dd><p> User name to connect as.
103
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-W</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--password</code></span>
105
<dd><p> Force password prompt.
111
<div class="refsect1" lang="en">
112
<a name="id791630"></a><h2>Environment</h2>
113
<div class="variablelist"><dl>
115
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="envar">PGDATABASE</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="envar">PGHOST</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="envar">PGPORT</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="envar">PGUSER</code></span>
117
<dd><p> Default connection parameters
121
<div class="refsect1" lang="en">
122
<a name="id791656"></a><h2>Diagnostics</h2>
123
<p> In case of difficulty, see <a href="sql-cluster.html">CLUSTER</a> and <a href="app-psql.html" title="psql"><span class="refentrytitle"><a name="app-psql-title"></a><span class="application">psql</span></span></a> for
124
discussions of potential problems and error messages.
125
The database server must be running at the
126
targeted host. Also, any default connection settings and environment
127
variables used by the <span class="application">libpq</span> front-end
131
<div class="refsect1" lang="en">
132
<a name="id791692"></a><h2>Examples</h2>
133
<p> To cluster the database <code class="literal">test</code>:
135
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>clusterdb test</code></strong></pre>
138
<p> To cluster a single table
139
<code class="literal">foo</code> in a database named
140
<code class="literal">xyzzy</code>:
142
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>clusterdb --table foo xyzzy</code></strong></pre>
146
<div class="refsect1" lang="en">
147
<a name="id791751"></a><h2>See Also</h2>
148
<span class="simplelist"><a href="sql-cluster.html">CLUSTER</a>, Environment Variables (<a href="libpq-envars.html" title="28.11.�Environment Variables">Section�28.11, “Environment Variables”</a>)</span>