DROP_INDEX(7pg14)
π DROP INDEX π
okay so this is the DROP_INDEX page from the PostgreSQL 14.24 Documentation, manual section 7 β and bestie, it's literally the "bye bye index" page. Buckle up π
β¨ NAME β¨
DROP_INDEX β remove an index. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. gorgeous. every bracket is optional, so you have choices π
π¦ DESCRIPTION π¦
DROP INDEX drops an existing index from the database system β like, gone gone. π«Ά
β οΈ but listen: to run this command you must be the owner of the index. no owner, no drop. that's the rule, no cap.
π PARAMETERS π
CONCURRENTLYβ drop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. π a normalDROP 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. very considerate, very demure β¨
π okay but there are several caveats to be aware of when using this option, and you need to read them: - only one index name can be specified - theCASCADEoption is not supported β (thus, an index that supports aUNIQUEorPRIMARY KEYconstraint cannot be dropped this way π) - regularDROP INDEXcommands can be performed within a transaction block, butDROP INDEX CONCURRENTLYcannot - lastly, indexes on partitioned tables cannot be dropped using this option π
π also: for temporary tables, DROP INDEX is always non-concurrent, as no other session can access them, and non-concurrent index drop is cheaper. so like, economy π
IF EXISTSβ do not throw an error if the index does not exist. a notice is issued in this case. she's gracious about it πnameβ the name (optionally schema-qualified) of an index to remove. name is a placeholder, so swap in your actual index, bestie πCASCADEβ automatically drop objects that depend on the index, and in turn all objects that depend on those objects (see Section 5.14). it's giving domino effect π₯RESTRICTβ refuse to drop the index if any objects depend on it. this is the default. cautious queen behavior π
β EXAMPLES β
this command will remove the index title_idx:
DROP INDEX title_idx;
one line. one icon. ate and left no crumbs π½οΈβ¨
π COMPATIBILITY π
DROP INDEX is a PostgreSQL language extension. there are no provisions for indexes in the SQL standard. so like, we invented this one, you're welcome π«Ά
π SEE ALSO π
CREATE INDEX(CREATE_INDEX(7)) β the other half of the story, iykyk π«
mwah π that's the whole page, signed off with love from PostgreSQL 14.24, dated 2026, living in DROP INDEX(7) forever and ever ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms