Important
New database features are no longer connected to engine versions; features are now enabled independently during scheduled update windows, and “major” and “minor” releases no longer exist in Helios. Please visit the release notes to view the latest features available in your database clusters.
DROP DATABASE
On this page
The DROP DATABASE command drops a database.
Syntax
DROP DATABASE [IF EXISTS] <database_name> [FORCE]DROP SCHEMA [IF EXISTS] <database_name> [FORCE]DROP DETACHED DATABASE <database_name> [STORAGEID <storage_id>] [COMPUTEID <compute_id>]
Arguments
-
<database_: The name of a SingleStore database.name> -
<storage_(Optional): Theid> STORAGE_extracted fromID information_for the respective database.schema. MV_ CLOUD_ BRANCHES -
<compute_(Optional): Theid> LATEST_extracted fromCOMPUTE_ ID information_for the respective database.schema. MV_ CLOUD_ BRANCHES
Remarks
-
By default, the
DROP DATABASEcommand waits for the running queries to finish before dropping the database.To override this behavior and kill any running queries, use the FORCEoption. -
This command causes implicit commits.
Refer to COMMIT for more information. -
The
DROP DATABASEcommand cannot be run on system databases. -
The
DROP DATABASEcommand drops the Point-In-Time Recovery (PITR) history.A database cannot be restored to the PITR milestone taken before the database was dropped. -
The
DROP DETACHED DATABASEcommand drops a database which was previously detached. -
In the
DROP DETACHED DATABASEcommand, theSTORAGEIDandCOMPUTEIDclauses apply when multiple entries exist ininformation_for the same database name.schema. MV_ CLOUD_ BRANCHES -
Refer to the Permissions Matrix for the required permissions.
Drop a Database in a Cluster
Within a cluster, you can run DROP DATABASE only from the primary R/W database.DROP DATABASE command is run on the primary R/W database, the database is dropped from all clusters, including any read-only copies.
Examples
DROP DATABASE IF EXISTS test;
DROP DATABASE IF EXISTS db FORCE;
Example - DROP DETACHED DATABASE
DROP DETACHED DATABASE testdb;
If there are multiple databases with the same name, extract STORAGE_ and LATEST_.
SELECT STORAGE_ID, LATEST_COMPUTE_ID FROM information_schema.MV_CLOUD_BRANCHESWHERE DATABASE_NAME=‘testdb’;
Use the STORAGE_ and LATEST_ of the detached database in DROP DETACHED DATABASE command.MV_ for more information.
DROP DETACHED DATABASE testdb STORAGEID 6362647530070456236:6577025878327007897 COMPUTEID 16245003384144080785:18098;
Query OK, 0 rows affected (2.05 sec)Last modified: