DROP_INDEX(7)
๐ DROP INDEX โ the "okay bye bestie" of indexes
postgresql 18.6 docs ยท DROP INDEX(7) ยท yes this is the manual page, no I will not be normal about it
โจ NAME โจ
DROP_INDEX โ remove an index. that's it. that's the whole vibe. it's giving "we're deleting the thing."
๐ SYNOPSIS ๐
DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. so simple. so powerful. slay.
๐ DESCRIPTION ๐
okay so DROP INDEX drops an existing index from the database system. gone. deleted. no more index. โจ
one lil' thing though: to actually run this command you must be the owner of the index. if you're not the owner, bestie, this is not your moment. ๐
๐ฆ PARAMETERS ๐ฆ
CONCURRENTLYโ drops the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. lowkey the polite option. a normalDROP INDEXgrabs anACCESS EXCLUSIVElock on the table, which blocks literally everyone else until the drop finishes. with this option, the command instead just waits until conflicting transactions have completed. patient queen behavior. ๐
โ ๏ธ but babes, there are SEVERAL caveats here and you need to know all of them: - only one index name can be specified, so no comma-list shenanigans - theCASCADEoption is not supported with this - (which means an index that supports aUNIQUEorPRIMARY KEYconstraint cannot be dropped this way โ it's giving "trapped by your own commitments" ๐ญ) - regularDROP INDEXcommands can be performed within a transaction block, butDROP INDEX CONCURRENTLYcannot - lastly, indexes on partitioned tables cannot be dropped using this option. no. not happening.
and for temporary tables? DROP INDEX is always non-concurrent, because no other session can access them anyway, and a non-concurrent index drop is cheaper. like why take the scenic route, fr fr. ๐
IF EXISTSโ do not throw an error if the index does not exist. instead, a notice is issued in this case. it's the "no worries if not!!" of flags ๐ซถnameโ the name (optionally schema-qualified) of an index to remove. yes you can schema-qualify her. she's flexible like that. ๐ธCASCADEโ automatically drops objects that depend on the index, and in turn all objects that depend on those objects (see Section 5.15). it's a whole domino situation. one falls, they all fall. ๐RESTRICTโ refuses to drop the index if any objects depend on it. this is the default. respectful. cautious. boundaries. ๐
โญ EXAMPLES โญ
this command will remove the index title_idx:
DROP INDEX title_idx;
and that's it. she's gone. bye girl ๐๐
๐ COMPATIBILITY ๐
DROP INDEX is a PostgreSQL language extension. there are no provisions for indexes in the SQL standard. so like, this is our thing. it's giving "iykyk" โจ
๐ SEE ALSO ๐
CREATE INDEX(CREATE_INDEX(7)) โ for when you inevitably need her back, bestie. the circle of life. ๐ฆ
mwah ๐ that was PostgreSQL 18.6 docs, dated 2026, and this page is DROP INDEX(7). go forth and drop responsibly. no cap. ๐
โจ
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms