DROP KEYSPACE
Immediately and permanently removes a keyspace and all objects within the keyspace, including tables, indexes, functions, and data.
|
DataStax recommends that you don’t manually delete the DSEFS keyspace or any other system keyspaces. These keyspaces are critical for cluster operations. |
Before the keyspace is dropped, a snapshot is created automatically. As long as a valid snapshot exists, you can use it to restore a dropped keyspace. This feature serves as a lightweight guardrail for unintentional deletions, but it isn’t a replacement for robust backup and recovery processes. For more information, see Restoring from a snapshot.
Synopsis
DROP KEYSPACE [ IF EXISTS ] <keyspace_name> ;
| Syntax conventions | Description |
|---|---|
UPPERCASE |
Literal keyword. |
Lowercase |
Not literal. |
|
Variable value. Replace with a user-defined value. |
|
Optional.
Square brackets ( |
|
Group.
Parentheses ( |
|
Or.
A vertical bar ( |
|
Repeatable.
An ellipsis ( |
|
Single quotation ( |
|
Map collection.
Braces ( |
Set, list, map, or tuple.
Angle brackets ( |
|
|
End CQL statement.
A semicolon ( |
|
Separate the command line options from the command arguments with two hyphens ( |
|
Search CQL only: Single quotation marks ( |
|
Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files. |
Example
Drop the cycling keyspace:
DROP KEYSPACE cycling;
Drop the cycling keyspace only if it exists:
DROP KEYSPACE IF EXISTS cycling;