← all rules

drop-index-non-concurrent

error

DROP INDEX without CONCURRENTLY

Why it's unsafe

DROP INDEX without CONCURRENTLY takes an ACCESS EXCLUSIVE lock on the index's table, blocking reads and writes while it runs.

Safe rewrite

Use DROP INDEX CONCURRENTLY (outside a transaction block).

Example

Try it in the playground →

Unsafe

DROP INDEX idx_users_email;

Safe

DROP INDEX CONCURRENTLY idx_users_email;

Related