reindexdb <refpurpose>reindex a <productname>PostgreSQL</productname> database</refpurpose> — PostgreSQLデータベースのインデックスを再作成する
reindexdb [connection-option...] [option...]
[
-S | --schema
schema
]
...
[
-t | --table
table
]
...
[
-i | --index
index
]
...
[
-s | --system
]
[
dbname | -a | --all
]
<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のラッパーです。
このユーティリティを使用しても他の方法でサーバにアクセスしても、データベースインデックスの再作成には実質的な違いはありません。
<application>reindexdb</application> accepts the following command-line arguments: reindexdbは以下のコマンドライン引数を受け付けます。
-a--allReindex 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>--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--echoEcho 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>--system</option> option.
このオプションは--systemオプションと両立しません。
-q--quietDo not display progress messages. 進行メッセージを表示しません。
-s--systemReindex 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=tablespaceSpecifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.) インデックスを再作成するテーブル空間を指定します。 (この名前は二重引用符で囲まれた識別子として処理されます。)
-v--verbosePrint detailed information during processing. 処理中に詳細な情報を表示します。
-V--versionPrint the <application>reindexdb</application> version and exit. reindexdbのバージョンを表示し、終了します。
-?--helpShow 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=hostSpecifies 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=portSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. サーバが接続を監視するTCPポートもしくはUnixドメインソケットファイルの拡張子を指定します。
-U username--username=usernameUser 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--passwordForce <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
When the <option>-a</option>/<option>--all</option> is used, connect
to this database to gather the list of databases to reindex.
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が使用されます。
これは接続文字列でも構いません。
その場合、接続文字列パラメータは衝突するコマンドラインオプションに優先します。
また、データベース名自身以外の接続文字列パラメータは他のデータベースに接続する際に再利用されます。
PGDATABASEPGHOSTPGPORTPGUSERDefault 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>.
診断メッセージで色を使うかどうかを指定します。
指定可能な値はalways、auto、neverです。
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がサポートする環境変数(32.15参照)も使います。
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. 問題が発生した場合、考えられる原因とエラーメッセージについての説明はREINDEXとpsqlを参照してください。 データベースサーバは、指定したホストで稼働している必要があります。 また、libpqフロントエンドライブラリのデフォルトの設定や環境変数が適用されることに注意してください。
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