DROP DATABASE

Drops a database.

Syntax

DROP DATABASE [IF EXISTS] <database_name> [FORCE]

DROP SCHEMA [IF EXISTS] <database_name> [FORCE]

Remarks

  • By default, the DROP DATABASE command waits for the running queries to finish before dropping the database. To override this behavior and kill any running queries, use the FORCE option.

  • This command causes implicit commits. Refer to COMMIT for more information.

  • This command cannot be run on system databases.

  • This command drops the Point-In-Time Recovery (PITR) history. A database cannot be restored to the PITR milestone taken before the database was dropped.

  • Refer to the Permission Matrix for the required permission.

Dropping a Database in a Workspace

Executing  DROP DATABASE in a workspace can be only done from the primary R/W database. If the database is detached it can be dropped from the UI or Management API. If this command is run on the primary R/W database it will drop the database from all the workspaces including the read-only copies.

Examples

DROP DATABASE IF EXISTS test;
DROP DATABASE IF EXISTS db FORCE;

Last modified: January 11, 2023

Was this article helpful?