← all rules

drop-database

warning

DROP DATABASE

Why it's unsafe

DROP DATABASE permanently and irreversibly removes the database and all its contents. It fails while any session is connected to the database — and WITH (FORCE) will terminate those sessions, losing their in-flight work.

Safe rewrite

Confirm the database is fully retired and has no active connections before dropping it; take a final backup first if the data may be needed.

Example

Try it in the playground →

Unsafe

DROP DATABASE analytics_old;

Related