DROP_INDEX(7pg14)

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

πŸ’… 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 normal DROP INDEX acquires an ACCESS EXCLUSIVE lock 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 - the CASCADE option is not supported β€” (thus, an index that supports a UNIQUE or PRIMARY KEY constraint cannot be dropped this way πŸ™ˆ) - 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 😭
πŸ“ 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