1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>clusterdb</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="reference-client.html" title="PostgreSQL Client Applications">
<link rel="prev" href="reference-client.html" title="PostgreSQL Client Applications">
<link rel="next" href="app-createdb.html" title="createdb">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="app-clusterdb"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>clusterdb — cluster a <span class="productname">PostgreSQL</span> database</p>
</div>
<a name="id791263"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<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>
</div>
<div class="refsect1" lang="en">
<a name="id791347"></a><h2>Description</h2>
<p> <span class="application">clusterdb</span> is a utility for reclustering tables
in a <span class="productname">PostgreSQL</span> database. It finds tables
that have previously been clustered, and clusters them again on the same
index that was last used. Tables that have never been clustered are not
affected.
</p>
<p> <span class="application">clusterdb</span> is a wrapper around the SQL
command <a href="sql-cluster.html">CLUSTER</a>.
There is no effective difference between clustering databases via
this utility and via other methods for accessing the server.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id791394"></a><h2>Options</h2>
<p> <span class="application">clusterdb</span> accepts the following command-line arguments:
</p>
<div class="variablelist"><dl>
<dt>
<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>
</dt>
<dd><p> Cluster all databases.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Specifies the name of the database to be clustered.
If this is not specified and <code class="option">-a</code> (or
<code class="option">--all</code>) is not used, the database name is read
from the environment variable <code class="envar">PGDATABASE</code>. If
that is not set, the user name specified for the connection is
used.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Echo the commands that <span class="application">clusterdb</span> generates
and sends to the server.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Do not display a response.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Cluster <em class="replaceable"><code>table</code></em> only.
</p></dd>
</dl></div>
<p>
</p>
<p> <span class="application">clusterdb</span> also accepts
the following command-line arguments for connection parameters:
</p>
<div class="variablelist"><dl>
<dt>
<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>
</dt>
<dd><p> Specifies the host name of the machine on which the server is
running. If the value begins with a slash, it is used as the
directory for the Unix domain socket.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Specifies the TCP port or local Unix domain socket file
extension on which the server
is listening for connections.
</p></dd>
<dt>
<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>
</dt>
<dd><p> User name to connect as.
</p></dd>
<dt>
<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>
</dt>
<dd><p> Force password prompt.
</p></dd>
</dl></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id791630"></a><h2>Environment</h2>
<div class="variablelist"><dl>
<dt>
<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>
</dt>
<dd><p> Default connection parameters
</p></dd>
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id791656"></a><h2>Diagnostics</h2>
<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
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
variables used by the <span class="application">libpq</span> front-end
library will apply.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id791692"></a><h2>Examples</h2>
<p> To cluster the database <code class="literal">test</code>:
</p>
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>clusterdb test</code></strong></pre>
<p>
</p>
<p> To cluster a single table
<code class="literal">foo</code> in a database named
<code class="literal">xyzzy</code>:
</p>
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>clusterdb --table foo xyzzy</code></strong></pre>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id791751"></a><h2>See Also</h2>
<span class="simplelist"><a href="sql-cluster.html">CLUSTER</a>, Environment Variables (<a href="libpq-envars.html" title="28.11.Environment Variables">Section28.11, “Environment Variables”</a>)</span>
</div>
</div></body>
</html>
|