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

DROP INDEX

DROP INDEX <refpurpose>remove an index</refpurpose> — インデックスを削除する

概要

DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

説明

<title>Description</title>

<command>DROP INDEX</command> drops an existing index from the database system. To execute this command you must be the owner of the index. DROP INDEXはデータベースシステムから既存のインデックスを削除します。 このコマンドを実行するには、そのインデックスを所有していなければなりません。

パラメータ

<title>Parameters</title>
CONCURRENTLY

Drop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. A normal <command>DROP INDEX</command> acquires an <literal>ACCESS EXCLUSIVE</literal> lock on the table, blocking other accesses until the index drop can be completed. With this option, the command instead waits until conflicting transactions have completed. インデックスのテーブルに対して同時に実行される選択、挿入、更新、削除をロックすることなくインデックスを削除します。 通常のDROP INDEXではテーブルに対するACCESS EXCLUSIVEロックを獲得し、インデックスの削除が完了するまで他のアクセスをブロックします。 このオプションを使うと、競合するトランザクションが完了するまでコマンドは待たされます。

There are several caveats to be aware of when using this option. Only one index name can be specified, and the <literal>CASCADE</literal> option is not supported. (Thus, an index that supports a <literal>UNIQUE</literal> or <literal>PRIMARY KEY</literal> constraint cannot be dropped this way.) Also, regular <command>DROP INDEX</command> commands can be performed within a transaction block, but <command>DROP INDEX CONCURRENTLY</command> cannot. Lastly, indexes on partitioned tables cannot be dropped using this option. このオプションを使用する時に注意すべき、複数の警告があります。 指定できるインデックス名は1つだけであり、また、CASCADEオプションはサポートされません。 (したがってUNIQUEまたはPRIMARY KEY制約をサポートするインデックスをこの方法で削除することはできません。) また、通常のDROP INDEXはトランザクションブロックの中で行うことができますが、DROP INDEX CONCURRENTLYはできません。 最後に、パーティションテーブルのインデックスをこのオプションで削除することはできません。

For temporary tables, <command>DROP INDEX</command> is always non-concurrent, as no other session can access them, and non-concurrent index drop is cheaper. 一時テーブルに対してはDROP INDEXは常に同時削除ではありません。他のセッションはアクセスできませんし、同時でないインデックス削除の方がより安価だからです。

IF EXISTS

Do not throw an error if the index does not exist. A notice is issued in this case. インデックスが存在しない場合でもエラーになりません。 この場合注意メッセージが発行されます。

name

The name (optionally schema-qualified) of an index to remove. 削除するインデックスの名前です(スキーマ修飾名も可)。

CASCADE

Automatically drop objects that depend on the index, and in turn all objects that depend on those objects (see <xref linkend="ddl-depend"/>). そのインデックスに依存しているオブジェクトを自動的に削除し、さらにそれらのオブジェクトに依存するすべてのオブジェクトも削除します(5.14参照)。

RESTRICT

Refuse to drop the index if any objects depend on it. This is the default. 依存しているオブジェクトがある場合、そのインデックスの削除を拒否します。 こちらがデフォルトです。

<title>Examples</title>

This command will remove the index <literal>title_idx</literal>: 次のコマンドはインデックスtitle_idxを削除します。

DROP INDEX title_idx;

互換性

<title>Compatibility</title>

<command>DROP INDEX</command> is a <productname>PostgreSQL</productname> language extension. There are no provisions for indexes in the SQL standard. DROP INDEXPostgreSQLの言語拡張です。 標準SQLにはインデックスに関する規定はありません。

関連項目

<title>See Also</title> CREATE INDEX