DROP_INDEX(7pg17)

πŸ“¦ version 17.11, in opensuse-leap 16.0

πŸ’… DROP_INDEX πŸ’…

okay bestie, welcome to the DROP INDEX page straight out of the PostgreSQL 17.11 docs β€” this is the one where we yeet an index into the void πŸ—‘οΈβœ¨


✨ NAME ✨

DROP_INDEX β€” remove an index 🫢


🌸 SYNOPSIS 🌸

DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

like, that's the whole vibe check right there πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP INDEX drops an existing index from the database system. literally just removes it, gone, no more πŸŽ€

πŸ’€ one tiny catch though: to run this command you must be the owner of the index. not your cousin, not your group chat, you. periodt.

πŸ”₯ PARAMETERS πŸ”₯

  • CONCURRENTLY β€” drop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. because a normal DROP INDEX acquires an ACCESS EXCLUSIVE lock on the table, blocking other accesses until the index drop can be completed 😭 but with this option, the command instead just waits until conflicting transactions have completed. patient queen energy 🧚

bestie there are several caveats to be aware of when using this option, and you need to hear them:

  • only one index name can be specified, and the CASCADE option is not supported. (thus, an index that supports a UNIQUE or PRIMARY KEY constraint cannot be dropped this way πŸ™ˆ)
  • also, regular DROP INDEX commands can be performed within a transaction block, but DROP INDEX CONCURRENTLY cannot 🚫
  • lastly, indexes on partitioned tables cannot be dropped using this option πŸ’€

for temporary tables, DROP INDEX is always non-concurrent, as no other session can access them, and non-concurrent index drop is cheaper πŸ“ (cheaper?! we love a budget-friendly icon)

  • IF EXISTS β€” do not throw an error if the index does not exist. a notice is issued in this case πŸ“’ no drama, just a lil heads up
  • name β€” the name (optionally schema-qualified) of an index to remove. tell me which index babes, be specific πŸ’…
  • CASCADE β€” automatically drop objects that depend on the index, and in turn all objects that depend on those objects (see Section 5.15). it's giving domino effect, it's giving chain reaction 🌈
  • RESTRICT β€” refuse to drop the index if any objects depend on it. and plot twist: this is the default πŸ‘‘ safe, sensible, main character energy

πŸŽ€ EXAMPLES πŸŽ€

this command will remove the index title_idx:

DROP INDEX title_idx;

slay, bye title_idx, you served your purpose 🫑✨


⭐ COMPATIBILITY ⭐

DROP INDEX is a PostgreSQL language extension. there are no provisions for indexes in the SQL standard β€” like, the standard simply did not think about it, no cap 😭 so this is a postgres-only flex, iykyk πŸ’œ


🌈 SEE ALSO 🌈

CREATE INDEX (CREATE_INDEX(7)) β€” the origin story, the prequel, go read it next bestie πŸ¦‹


mwah πŸ’‹ that's the page! brought to you by PostgreSQL 17.11, dated 2026 β€” DROP INDEX(7), and yes she ate πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from