バージョンごとのドキュメント一覧

clusterdb

clusterdb <refpurpose>cluster a <productname>PostgreSQL</productname> database</refpurpose> PostgreSQLデータベースをクラスタ化する

概要

clusterdb [connection-option...] [ --verbose | -v ] [ --table | -t table ] ... [dbname]

clusterdb [connection-option...] [ --verbose | -v ] --all | -a

説明

<title>Description</title>

<application>clusterdb</application> is a utility for reclustering tables in a <productname>PostgreSQL</productname> 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. clusterdbは、PostgreSQLデータベース内のテーブルを再クラスタ化するユーティリティです。 既にクラスタ化されているテーブルを検索し、前回と同じインデックスを使用して再度クラスタ化します。 一度もクラスタ化されていないテーブルは処理されません。

<application>clusterdb</application> is a wrapper around the SQL command <xref linkend="sql-cluster"/>. There is no effective difference between clustering databases via this utility and via other methods for accessing the server. clusterdbは、SQLコマンドCLUSTERのラッパーです。 クラスタ化を行うのに、このユーティリティを使用しても、これ以外のサーバへのアクセス方法を使用しても、特別な違いはありません。

オプション

<title>Options</title>

<application>clusterdb</application> accepts the following command-line arguments: clusterdbでは、下記のコマンドライン引数を指定できます。

-a
--all

Cluster all databases. 全てのデータベースをクラスタ化します。

[-d] dbname
[--dbname=]dbname

Specifies the name of the database to be clustered, when <option>-a</option>/<option>&#45;-all</option> is not used. If this is not specified, 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. The <replaceable>dbname</replaceable> can be a <link linkend="libpq-connstring">connection string</link>. If so, connection string parameters will override any conflicting command line options. -a/--allが使用されていない場合、クラスタ化するデータベースの名前を指定します。 これが指定されていない場合、データベース名は環境変数PGDATABASEから読み取られます。 この変数も設定されていない場合は、接続のために指定されたユーザ名が使用されます。 dbname接続文字列でも構いません。 その場合、接続文字列パラメータは衝突するコマンドラインオプションよりも優先します。

-e
--echo

Echo the commands that <application>clusterdb</application> generates and sends to the server. clusterdbが生成し、サーバに送るコマンドをエコー表示します。

-q
--quiet

Do not display progress messages. 進行メッセージを表示しません。

-t table
--table=table

Cluster <replaceable class="parameter">table</replaceable> only. Multiple tables can be clustered by writing multiple <option>-t</option> switches. tableのみをクラスタ化します。 複数の-tスイッチを記述することで複数のテーブルをクラスタ化することができます。

-v
--verbose

Print detailed information during processing. 処理の間、詳細な情報を出力します。

-V
--version

Print the <application>clusterdb</application> version and exit. clusterdbのバージョンを表示し、終了します。

-?
--help

Show help about <application>clusterdb</application> command line arguments, and exit. clusterdbのコマンドライン引数の使用方法を表示し、終了します。

<application>clusterdb</application> also accepts the following command-line arguments for connection parameters: clusterdbは、さらに、下記のコマンドライン引数を接続パラメータとして受け付けます。

-h host
--host=host

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. サーバが稼働しているマシンのホスト名を指定します。 この値がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。

-p port
--port=port

Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. サーバが接続を監視するTCPポートもしくはUnixドメインソケットファイルの拡張子を指定します。

-U username
--username=username

User name to connect as. 接続するためのユーザ名です。

-w
--no-password

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. パスワードの入力を促しません。 サーバがパスワード認証を必要とし、かつ、.pgpassファイルなどの他の方法が利用できない場合、接続試行は失敗します。 バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。

-W
--password

Force <application>clusterdb</application> to prompt for a password before connecting to a database. データベースに接続する前に、clusterdbは強制的にパスワード入力を促します。

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. In some cases it is worth typing <option>-W</option> to avoid the extra connection attempt. サーバがパスワード認証を要求する場合clusterdbは自動的にパスワード入力を促しますので、これが重要になることはありません。 しかし、clusterdbは、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。 こうした余計な接続試行を防ぐために-Wの入力が有意となる場合もあります。

--maintenance-db=dbname

Specifies the name of the database to connect to to discover which databases should be clustered, when <option>-a</option>/<option>&#45;-all</option> is used. If not specified, the <literal>postgres</literal> database will be used, or if that does not exist, <literal>template1</literal> will be used. This can be a <link linkend="libpq-connstring">connection string</link>. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases. -a/--allが使われている場合に、どのデータベースをクラスタ化しなければならないかを見つけ出すために接続するデータベースの名前を指定します。 指定されなければpostgresデータベースが使用され、もし存在しなければtemplate1が使用されます。 これは接続文字列でも構いません。 その場合、接続文字列パラメータは衝突するコマンドラインオプションよりも優先します。 また、データベース名自身以外の接続文字列パラメータは、他のデータベースに接続する時に再利用されます。

環境

<title>Environment</title>
PGDATABASE
PGHOST
PGPORT
PGUSER

Default connection parameters デフォルトの接続パラメータです。

PG_COLOR

Specifies whether to use color in diagnostic messages. Possible values are <literal>always</literal>, <literal>auto</literal> and <literal>never</literal>. 診断メッセージで色を使うかどうかを指定します。 可能な値はalwaysautoneverです。

This utility, like most other <productname>PostgreSQL</productname> utilities, also uses the environment variables supported by <application>libpq</application> (see <xref linkend="libpq-envars"/>). また、このユーティリティは、他のほとんどのPostgreSQLユーティリティと同様、libpqでサポートされる環境変数を使用します(34.15を参照してください)。

診断

<title>Diagnostics</title>

In case of difficulty, see <xref linkend="sql-cluster"/> and <xref linkend="app-psql"/> 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 <application>libpq</application> front-end library will apply. 問題が発生した場合、考えられる原因とエラーメッセージについてはCLUSTERpsqlを参照してください。 データベースサーバは対象ホスト上で稼働していなければなりません。 また、libpqフロントエンドライブラリの、あらゆるデフォルトの設定や環境変数が適用されます。

<title>Examples</title>

To cluster the database <literal>test</literal>: データベースtestをクラスタ化します。

$ clusterdb test

To cluster a single table <literal>foo</literal> in a database named <literal>xyzzy</literal>: xyzzyというデータベース内のテーブルの1つfooをクラスタ化します。

$ clusterdb --table=foo xyzzy

関連項目

<title>See Also</title> CLUSTER