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

reindexdb

reindexdb <refpurpose>reindex a <productname>PostgreSQL</productname> database</refpurpose> PostgreSQLデータベースのインデックスを再作成する

概要

reindexdb [connection-option...] [option...] [ -S | --schema schema ] ... [ -t | --table table ] ... [ -i | --index index ] ... [dbname]

reindexdb [connection-option...] [option...] -a | --all

reindexdb [connection-option...] [option...] -s | --system [dbname]

説明

<title>Description</title>

<application>reindexdb</application> is a utility for rebuilding indexes in a <productname>PostgreSQL</productname> database. reindexdbは、PostgreSQLデータベース内のインデックスを再作成するユーティリティです。

<application>reindexdb</application> is a wrapper around the SQL command <link linkend="sql-reindex"><command>REINDEX</command></link>. There is no effective difference between reindexing databases via this utility and via other methods for accessing the server. reindexdbは、SQLコマンドREINDEXのラッパーです。 このユーティリティを使用しても他の方法でサーバにアクセスしても、データベースインデックスの再作成には実質的な違いはありません。

オプション

<title>Options</title>

<application>reindexdb</application> accepts the following command-line arguments: reindexdbは以下のコマンドライン引数を受け付けます。

-a
--all

Reindex all databases. すべてのデータベースのインデックスを再作成します。

--concurrently

Use the <literal>CONCURRENTLY</literal> option. See <xref linkend="sql-reindex"/>, where all the caveats of this option are explained in detail. CONCURRENTLYオプションを使います。 REINDEXを参照してください。このオプションの注意がすべて詳しく説明されています。

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

Specifies the name of the database to be reindexed, 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>reindexdb</application> generates and sends to the server. reindexdbが生成しサーバに送信するコマンドを表示します。

-i index
--index=index

Recreate <replaceable class="parameter">index</replaceable> only. Multiple indexes can be recreated by writing multiple <option>-i</option> switches. indexのみを再作成します。 複数の-iスイッチを記述することで、複数のインデックスを再作成することができます。

-j njobs
--jobs=njobs

Execute the reindex commands in parallel by running <replaceable class="parameter">njobs</replaceable> commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. njobs個のコマンドを同時に実行することで、reindexコマンドを並列で実行します。 このオプションは処理時間を短縮することもありますが、データベースサーバの負荷も増加します。

<application>reindexdb</application> will open <replaceable class="parameter">njobs</replaceable> connections to the database, so make sure your <xref linkend="guc-max-connections"/> setting is high enough to accommodate all connections. reindexdbはデータベースに対するnjobs個の接続を開くので、max_connectionsの設定は、これらの接続を許容するだけ十分に大きくしてください。

Note that this option is incompatible with the <option>&#45;-index</option> and <option>&#45;-system</option> options. このオプションは--index--systemオプションと非互換であることに注意してください。

-q
--quiet

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

-s
--system

Reindex database's system catalogs only. データベースのシステムカタログのみ、インデックスを再作成します。

-S schema
--schema=schema

Reindex <replaceable class="parameter">schema</replaceable> only. Multiple schemas can be reindexed by writing multiple <option>-S</option> switches. schemaのみのインデックスを再作成します。 複数の-Sスイッチを指定することで、複数のスキーマのインデックスを再作成できます。

-t table
--table=table

Reindex <replaceable class="parameter">table</replaceable> only. Multiple tables can be reindexed by writing multiple <option>-t</option> switches. tableのインデックスのみを再作成します。 複数の-tを記述することで、複数のテーブルのインデックスを再作成することができます。

--tablespace=tablespace

Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.) インデックスを再作成するテーブル空間を指定します。 (この名前は二重引用符で囲まれた識別子として処理されます。)

-v
--verbose

Print detailed information during processing. 処理中に詳細な情報を表示します。

-V
--version

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

-?
--help

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

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

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

This option is never essential, since <application>reindexdb</application> will automatically prompt for a password if the server demands password authentication. However, <application>reindexdb</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. サーバがパスワード認証を要求する場合reindexdbは自動的にパスワード入力を促しますので、これが重要になることはありません。 しかし、reindexdbは、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。 こうした余計な接続試行を防ぐために-Wの入力が有意となる場合もあります。

--maintenance-db=dbname

Specifies the name of the database to connect to to discover which databases should be reindexed, 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-reindex"/> 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. 問題が発生した場合、考えられる原因とエラーメッセージについての説明はREINDEXpsqlを参照してください。 データベースサーバは、指定したホストで稼働している必要があります。 また、libpqフロントエンドライブラリのデフォルトの設定や環境変数が適用されることに注意してください。

注釈

<title>Notes</title>

<application>reindexdb</application> might need to connect several times to the <productname>PostgreSQL</productname> server, asking for a password each time. It is convenient to have a <filename>~/.pgpass</filename> file in such cases. See <xref linkend="libpq-pgpass"/> for more information. reindexdbの実行中にはPostgreSQLサーバに何度も接続しなければならないことがありますが、この場合その度にパスワードが必要です。 そのような場合は~/.pgpassファイルを用意しておくと便利です。 詳細は34.16を参照してください。

<title>Examples</title>

To reindex the database <literal>test</literal>: データベースtestのインデックスを再作成します。

$ reindexdb test

To reindex the table <literal>foo</literal> and the index <literal>bar</literal> in a database named <literal>abcd</literal>: abcdというデータベース内のテーブルfooのインデックスとインデックスbarを再作成します。

$ reindexdb --table=foo --index=bar abcd

関連項目

<title>See Also</title> REINDEX