DbSchema | Cassandra - How to Drop a Table?
Table of Contents
- Introduction
- Prerequisites
- Before you drop a table
- How to drop a table in cqlsh
- How to drop a table in DbSchema
- What happens after the drop
- Common mistakes
- Conclusion
- References
Introduction
DROP TABLE is one of the simplest Cassandra commands to type and one of the easiest to regret. The statement removes the table definition and its data, so it belongs in the category of deliberate, reviewed schema changes.
If you are dropping a table in production, think beyond the command itself: backups, dependent objects, application code, and schema agreement all matter.
Prerequisites
Before dropping a table, make sure you have:
- a running Cassandra cluster
- permission to change schema
cqlshaccess or DbSchema connected to the cluster- confirmation that the table is no longer needed by the application
Before you drop a table
Run through this checklist first:
- Confirm the keyspace and table name. Dropping the wrong object is easy when names are similar.
- Review dependencies. Materialized views, secondary indexes, and application queries that depend on the table should be inventoried first.
- Take a backup when in doubt. A manual snapshot is cheap compared to rebuilding lost data:
nodetool snapshot --tag before_drop --table orders_by_customer_day ecommerce
- Know your snapshot settings. Cassandra can create automatic snapshots before table drops when
auto_snapshot = trueincassandra.yaml, but teams often take an explicit snapshot before destructive changes anyway. - Make sure the cluster is healthy. Avoid schema changes during instability, and wait for schema agreement before starting follow-up operations.
How to drop a table in cqlsh
Use the target keyspace first:
USE ecommerce;
Then drop the table:
DROP TABLE IF EXISTS orders_by_customer_day;
IF EXISTS is useful in migration scripts because it makes the statement idempotent. Afterward, verify that the table is gone:
DESCRIBE TABLES;
How to drop a table in DbSchema
DbSchema is useful when the drop is part of a larger schema cleanup and you want the visual model to stay in sync.
- Open DbSchema and connect to the Cassandra cluster.
- Locate the table in the schema tree or diagram model.
- Review whether the table is still referenced by views, diagrams, or deployment scripts.
- Drop the table and inspect the generated CQL before executing it.
- Refresh the schema so the visual model matches the live database.
What happens after the drop
Once Cassandra executes DROP TABLE:
- the table definition is removed
- the data becomes unavailable
- dependent materialized views and secondary indexes on that base table should be considered part of the same destructive change
- the schema change still has to propagate across the cluster, so wait for schema agreement before stacking more schema edits
That is why table drops are usually handled through migrations or carefully reviewed operational procedures instead of ad hoc shell commands.
Common mistakes
The mistakes to avoid are:
- dropping a table without confirming the current keyspace
- assuming the operation is easy to undo
- relying on auto snapshots without checking cluster settings
- forgetting about dependent views, indexes, or downstream jobs
- making more schema changes before schema agreement is reached
Conclusion
Dropping a Cassandra table is operationally simple but conceptually high-risk. Use IF EXISTS when appropriate, take snapshots before destructive work, review dependent objects, and wait for the cluster to agree on the schema before continuing.
If you are not sure whether a table should be removed, it is usually better to deprecate it in the application first and drop it in a later, explicit migration.