DROP INDEX
remove an index
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-DROPINDEX
- file
- sql-dropindex.html
- lang
- en
- name
- DROP INDEX
- purpose
- remove an index
- purpose zh
- 移除一个索引
- sections same as
- Unknown
- slug
- 18
- synopsis html
- DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [, ...] [ CASCADE | RESTRICT ]
- synopsis text
- DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Syntax
DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Definition PG 18
DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Description
DROP INDEX drops an existing index from the database system. To execute this command you must be the owner of the index.
Parameters
CONCURRENTLYDrop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. A normal
DROP INDEXacquires anACCESS EXCLUSIVElock 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.There are several caveats to be aware of when using this option. Only one index name can be specified, and the
CASCADEoption is not supported. (Thus, an index that supports aUNIQUEorPRIMARY KEYconstraint cannot be dropped this way.) Also, regularDROP INDEXcommands can be performed within a transaction block, butDROP INDEX CONCURRENTLYcannot. Lastly, indexes on partitioned tables cannot be dropped using this option.For temporary tables,
DROP INDEXis always non-concurrent, as no other session can access them, and non-concurrent index drop is cheaper.IF EXISTSDo not throw an error if the index does not exist. A notice is issued in this case.
nameThe name (optionally schema-qualified) of an index to remove.
CASCADEAutomatically drop objects that depend on the index, and in turn all objects that depend on those objects (see Section 5.15).
RESTRICTRefuse to drop the index if any objects depend on it. This is the default.
Examples
This command will remove the index title_idx:
DROP INDEX title_idx;
Compatibility
DROP INDEX is a PostgreSQL language extension. There are no provisions for indexes in the SQL standard.
See Also
CREATE INDEXCompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:984c6f7656c3fdb1c0321439161601cf0e5838fb886bc904e49dfd49dc818ef1
Text language: en · wiki-repair-20261023:984c6f7656c3fdb1c0321439161601cf0e5838fb886bc904e49dfd49dc818ef1