2 doc/src/sgml/ref/drop_index.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-dropindex">
7 <indexterm zone=
"sql-dropindex">
8 <primary>DROP INDEX
</primary>
12 <refentrytitle>DROP INDEX
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>DROP INDEX
</refname>
19 <refpurpose>remove an index
</refpurpose>
24 DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ]
<replaceable class=
"parameter">name
</replaceable> [, ...] [ CASCADE | RESTRICT ]
29 <title>Description
</title>
32 <command>DROP INDEX
</command> drops an existing index from the database
33 system. To execute this command you must be the owner of
39 <title>Parameters
</title>
43 <term><literal>CONCURRENTLY
</literal></term>
46 Drop the index without locking out concurrent selects, inserts, updates,
47 and deletes on the index's table. A normal
<command>DROP INDEX
</command>
48 acquires an
<literal>ACCESS EXCLUSIVE
</literal> lock on the table,
49 blocking other accesses until the index drop can be completed. With
50 this option, the command instead waits until conflicting transactions
54 There are several caveats to be aware of when using this option.
55 Only one index name can be specified, and the
<literal>CASCADE
</literal> option
56 is not supported. (Thus, an index that supports a
<literal>UNIQUE
</literal> or
57 <literal>PRIMARY KEY
</literal> constraint cannot be dropped this way.)
58 Also, regular
<command>DROP INDEX
</command> commands can be
59 performed within a transaction block, but
60 <command>DROP INDEX CONCURRENTLY
</command> cannot.
61 Lastly, indexes on partitioned tables cannot be dropped using this
65 For temporary tables,
<command>DROP INDEX
</command> is always
66 non-concurrent, as no other session can access them, and
67 non-concurrent index drop is cheaper.
73 <term><literal>IF EXISTS
</literal></term>
76 Do not throw an error if the index does not exist. A notice is issued
83 <term><replaceable class=
"parameter">name
</replaceable></term>
86 The name (optionally schema-qualified) of an index to remove.
92 <term><literal>CASCADE
</literal></term>
95 Automatically drop objects that depend on the index,
96 and in turn all objects that depend on those objects
97 (see
<xref linkend=
"ddl-depend"/>).
103 <term><literal>RESTRICT
</literal></term>
106 Refuse to drop the index if any objects depend on it. This is
115 <title>Examples
</title>
118 This command will remove the index
<literal>title_idx
</literal>:
121 DROP INDEX title_idx;
122 </programlisting></para>
126 <title>Compatibility
</title>
129 <command>DROP INDEX
</command> is a
130 <productname>PostgreSQL
</productname> language extension. There
131 are no provisions for indexes in the SQL standard.
136 <title>See Also
</title>
138 <simplelist type=
"inline">
139 <member><xref linkend=
"sql-createindex"/></member>