Deletes a database and all objects it contains. This operation cannot be undone.
Warning
Dropping a database permanently deletes all its objects, including tables, views, and schemas. You cannot connect to the database after it is deleted.
Permissions
Only the following roles can run this statement:
A superuser
A database owner assigned by a superuser
Syntax
DROP DATABASE [ IF EXISTS ] db_name;Note
After you run DROP DATABASE, Hologres asynchronously deletes data and releases storage space in the backend. This process may take about 2 hours.
Parameters
| Parameter | Description |
|---|---|
IF EXISTS | Optional. Suppresses the error if the database does not exist. Without this clause, dropping a non-existent database returns an error. |
db_name | The name of the database to delete. |
Example
Delete the database named mydb:
DROP DATABASE mydb;To confirm the deletion, verify that mydb no longer appears in the database list.