DROP_INDEX(7pg16)
π
DROP_INDEX β like, the page about yeeting an index (PostgreSQL 16.15 docs, manual DROP INDEX(7))
okay bestie, so this is the DROP INDEX page from the PostgreSQL 16.15 documentation, and it's honestly so straightforward it's giving comfort food π. Short page, big "delete that thing" energy.
β¨ NAME β¨
DROP_INDEX β remove an index. that's it. that's the whole vibe. you point at an index, it stops existing. iconic π
πΈ SYNOPSIS πΈ
DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at those optional brackets, they're all just little accessories π β every one of them is optional, and name is the only thing you actually need.
π¦ DESCRIPTION π¦
DROP INDEX drops an existing index from the database system. plain and simple. literally just removes it.
but β β to execute this command you must be the owner of the index. no ownership, no drop. sorry babe, house rules π
π₯ PARAMETERS π₯ (the part you actually came for)
CONCURRENTLYβ drop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. because a normalDROP INDEXgrabs anACCESS EXCLUSIVElock on the table, which blocks other accesses until the index drop can be completed π. with this option, the command instead waits until conflicting transactions have completed. much more polite. much more main character of it.
okay so there are several caveats to be aware of when using this option, and they are not optional reading, bestie β they're the whole plot: - 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
IF EXISTSβ do not throw an error if the index does not exist. a notice is issued in this case. she's chill like that β¨nameβ the name (optionally schema-qualified) of an index to remove. yes, you can schema-qualify it, slay π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, so be sure πRESTRICTβ refuse to drop the index if any objects depend on it. and guess what: this is the default π no accidental yeeting.
πΈ bonus fact that lives in theCONCURRENTLYparagraph but deserves its own little spotlight: for temporary tables,DROP INDEXis always non-concurrent, as no other session can access them, and non-concurrent index drop is cheaper. so don't bother asking, she's already made up her mind π
π EXAMPLES π
this command will remove the index title_idx:
DROP INDEX title_idx;
one line. zero drama. she ate π₯
β COMPATIBILITY β
DROP INDEX is a PostgreSQL language extension. there are no provisions for indexes in the SQL standard. so like, other databases? not invited to this party π
π SEE ALSO π
CREATE INDEX(CREATE_INDEX(7)) β the other half of the story, the "put it there" to this page's "take it away" π¦
and that's the page, bestie! happy dropping, go be the owner of an index about it π
β¨ PostgreSQL 16.15 Β· 2026 Β· DROP INDEX(7) β¨ β mwah, ty for reading, ily, go touch some indexes (gently) π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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