2002-08-27 05:38:28 +02:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/clusterdb.sgml
|
2002-08-27 05:38:28 +02:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
2017-10-20 03:16:39 +02:00
|
|
|
<refentry id="app-clusterdb">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="app-clusterdb">
|
|
|
|
<primary>clusterdb</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle><application>clusterdb</application></refentrytitle>
|
2002-08-27 05:38:28 +02:00
|
|
|
<manvolnum>1</manvolnum>
|
|
|
|
<refmiscinfo>Application</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname id="clusterdb">clusterdb</refname>
|
|
|
|
<refpurpose>cluster a <productname>PostgreSQL</productname> database</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<cmdsynopsis>
|
|
|
|
<command>clusterdb</command>
|
2003-03-24 15:32:51 +01:00
|
|
|
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
|
2012-05-03 21:50:04 +02:00
|
|
|
<group choice="opt"><arg choice="plain"><option>--verbose</option></arg><arg choice="plain"><option>-v</option></arg></group>
|
2013-01-17 11:24:47 +01:00
|
|
|
|
|
|
|
<arg choice="plain" rep="repeat">
|
|
|
|
<arg choice="opt">
|
|
|
|
<group choice="plain">
|
|
|
|
<arg choice="plain"><option>--table</option></arg>
|
|
|
|
<arg choice="plain"><option>-t</option></arg>
|
|
|
|
</group>
|
|
|
|
<replaceable>table</replaceable>
|
|
|
|
</arg>
|
|
|
|
</arg>
|
|
|
|
|
2012-05-03 21:50:04 +02:00
|
|
|
<arg choice="opt"><replaceable>dbname</replaceable></arg>
|
2010-09-25 08:57:09 +02:00
|
|
|
</cmdsynopsis>
|
|
|
|
|
|
|
|
<cmdsynopsis>
|
2002-08-27 05:38:28 +02:00
|
|
|
<command>clusterdb</command>
|
2003-03-24 15:32:51 +01:00
|
|
|
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
|
2012-05-03 21:50:04 +02:00
|
|
|
<group choice="opt"><arg choice="plain"><option>--verbose</option></arg><arg choice="plain"><option>-v</option></arg></group>
|
|
|
|
<group choice="plain"><arg choice="plain"><option>--all</option></arg><arg choice="plain"><option>-a</option></arg></group>
|
2002-08-27 05:38:28 +02:00
|
|
|
</cmdsynopsis>
|
|
|
|
</refsynopsisdiv>
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
2002-10-12 01:03:48 +02:00
|
|
|
<application>clusterdb</application> is a utility for reclustering tables
|
|
|
|
in a <productname>PostgreSQL</productname> database. It finds tables
|
2002-09-03 03:11:37 +02:00
|
|
|
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
|
2003-02-19 05:06:28 +01:00
|
|
|
affected.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2003-06-18 14:19:11 +02:00
|
|
|
<application>clusterdb</application> is a wrapper around the SQL
|
2017-10-20 03:16:39 +02:00
|
|
|
command <xref linkend="sql-cluster">.
|
2003-06-18 14:19:11 +02:00
|
|
|
There is no effective difference between clustering databases via
|
2003-09-12 02:12:47 +02:00
|
|
|
this utility and via other methods for accessing the server.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Options</title>
|
|
|
|
|
|
|
|
<para>
|
2002-10-12 01:03:48 +02:00
|
|
|
<application>clusterdb</application> accepts the following command-line arguments:
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-a</option></term>
|
|
|
|
<term><option>--all</option></term>
|
2002-10-12 01:03:48 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Cluster all databases.
|
2002-10-12 01:03:48 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option><optional>-d</optional> <replaceable class="parameter">dbname</replaceable></option></term>
|
|
|
|
<term><option><optional>--dbname=</optional><replaceable class="parameter">dbname</replaceable></option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Specifies the name of the database to be clustered.
|
|
|
|
If this is not specified and <option>-a</option> (or
|
|
|
|
<option>--all</option>) is not used, the database name is read
|
|
|
|
from the environment variable <envar>PGDATABASE</envar>. If
|
|
|
|
that is not set, the user name specified for the connection is
|
|
|
|
used.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-e</option></term>
|
|
|
|
<term><option>--echo</option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-10-12 01:03:48 +02:00
|
|
|
Echo the commands that <application>clusterdb</application> generates
|
2007-02-22 00:21:12 +01:00
|
|
|
and sends to the server.
|
2002-10-12 01:03:48 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-q</option></term>
|
|
|
|
<term><option>--quiet</option></term>
|
2002-10-12 01:03:48 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-06-04 12:02:40 +02:00
|
|
|
Do not display progress messages.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-t <replaceable class="parameter">table</replaceable></option></term>
|
|
|
|
<term><option>--table=<replaceable class="parameter">table</replaceable></option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Cluster <replaceable class="parameter">table</replaceable> only.
|
2013-01-17 11:24:47 +01:00
|
|
|
Multiple tables can be clustered by writing multiple
|
2017-10-09 03:44:17 +02:00
|
|
|
<option>-t</option> switches.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2008-11-24 09:46:04 +01:00
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-v</option></term>
|
|
|
|
<term><option>--verbose</option></term>
|
2008-11-24 09:46:04 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Print detailed information during processing.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2010-02-19 15:36:45 +01:00
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-V</option></term>
|
|
|
|
<term><option>--version</option></term>
|
2010-02-19 15:36:45 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Print the <application>clusterdb</application> version and exit.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-?</option></term>
|
|
|
|
<term><option>--help</option></term>
|
2010-02-19 15:36:45 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Show help about <application>clusterdb</application> command line
|
|
|
|
arguments, and exit.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2010-11-23 21:27:50 +01:00
|
|
|
<application>clusterdb</application> also accepts
|
2002-10-12 01:03:48 +02:00
|
|
|
the following command-line arguments for connection parameters:
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-h <replaceable class="parameter">host</replaceable></option></term>
|
|
|
|
<term><option>--host=<replaceable class="parameter">host</replaceable></option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
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.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-p <replaceable class="parameter">port</replaceable></option></term>
|
|
|
|
<term><option>--port=<replaceable class="parameter">port</replaceable></option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2010-11-23 21:27:50 +01:00
|
|
|
Specifies the TCP port or local Unix domain socket file
|
2007-02-22 00:21:12 +01:00
|
|
|
extension on which the server
|
|
|
|
is listening for connections.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-U <replaceable class="parameter">username</replaceable></option></term>
|
|
|
|
<term><option>--username=<replaceable class="parameter">username</replaceable></option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2003-02-13 06:37:44 +01:00
|
|
|
User name to connect as.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2009-02-26 17:02:39 +01:00
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-w</option></term>
|
|
|
|
<term><option>--no-password</option></term>
|
2009-02-26 17:02:39 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Never issue a password prompt. If the server requires
|
|
|
|
password authentication and a password is not available by
|
|
|
|
other means such as a <filename>.pgpass</filename> file, the
|
|
|
|
connection attempt will fail. This option can be useful in
|
|
|
|
batch jobs and scripts where no user is present to enter a
|
|
|
|
password.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-W</option></term>
|
|
|
|
<term><option>--password</option></term>
|
2002-08-27 05:38:28 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-12-11 20:57:32 +01:00
|
|
|
Force <application>clusterdb</application> to prompt for a
|
2010-11-23 21:27:50 +01:00
|
|
|
password before connecting to a database.
|
2007-12-11 20:57:32 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This option is never essential, since
|
|
|
|
<application>clusterdb</application> will automatically prompt
|
|
|
|
for a password if the server demands password authentication.
|
|
|
|
However, <application>clusterdb</application> will waste a
|
|
|
|
connection attempt finding out that the server wants a password.
|
2017-10-09 03:44:17 +02:00
|
|
|
In some cases it is worth typing <option>-W</option> to avoid the extra
|
2007-12-11 20:57:32 +01:00
|
|
|
connection attempt.
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2011-12-06 14:48:15 +01:00
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>--maintenance-db=<replaceable class="parameter">dbname</replaceable></option></term>
|
2011-12-06 14:48:15 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specifies the name of the database to connect to discover what other
|
|
|
|
databases should be clustered. If not specified, the
|
|
|
|
<literal>postgres</literal> database will be used,
|
|
|
|
and if that does not exist, <literal>template1</literal> will be used.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-08-27 05:38:28 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Environment</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><envar>PGDATABASE</envar></term>
|
|
|
|
<term><envar>PGHOST</envar></term>
|
|
|
|
<term><envar>PGPORT</envar></term>
|
|
|
|
<term><envar>PGUSER</envar></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2003-03-24 15:32:51 +01:00
|
|
|
Default connection parameters
|
2002-08-27 05:38:28 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-02-20 19:10:59 +01:00
|
|
|
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
This utility, like most other <productname>PostgreSQL</productname> utilities,
|
|
|
|
also uses the environment variables supported by <application>libpq</application>
|
2007-03-26 19:23:37 +02:00
|
|
|
(see <xref linkend="libpq-envars">).
|
2007-02-20 19:10:59 +01:00
|
|
|
</para>
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
2003-09-13 01:04:46 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Diagnostics</title>
|
|
|
|
|
|
|
|
<para>
|
2017-10-20 03:16:39 +02:00
|
|
|
In case of difficulty, see <xref linkend="sql-cluster">
|
|
|
|
and <xref linkend="app-psql"> for
|
2003-09-13 01:04:46 +02:00
|
|
|
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 <application>libpq</application> front-end
|
|
|
|
library will apply.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
2002-08-27 05:38:28 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To cluster the database <literal>test</literal>:
|
|
|
|
<screen>
|
|
|
|
<prompt>$ </prompt><userinput>clusterdb test</userinput>
|
|
|
|
</screen>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To cluster a single table
|
|
|
|
<literal>foo</literal> in a database named
|
|
|
|
<literal>xyzzy</literal>:
|
|
|
|
<screen>
|
2016-10-19 18:00:00 +02:00
|
|
|
<prompt>$ </prompt><userinput>clusterdb --table=foo xyzzy</userinput>
|
2011-08-07 09:49:45 +02:00
|
|
|
</screen></para>
|
2002-08-27 05:38:28 +02:00
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2010-04-03 09:23:02 +02:00
|
|
|
<member><xref linkend="sql-cluster"></member>
|
2002-08-27 05:38:28 +02:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|