On a DMS with Cassandra cluster, I want to keep my database lean & healthy.
When downgrading to a connector version without logger tables, how can I check if the keyspace for these logger tables (sldmadb_elementdata_<dmaid>_<eid>_<tableid>) in Cassandra still exist?
Next, how can I drop that data and these keyspaces?
Hi Jan-Klaas,
Depending on what you wish to remove you have a few options, dropping the keyspace, dropping the table or truncating the table. Everything but truncating the table can be done through DevCenter. If you want to use raw queries however please see below on how to gather information and which queries you can execute. If connecting with DevCenter the keyspaces and tables are shown in the user interface.
If you just want to check if the tables and keyspaces exist, you can query the system_schema keyspaces table with the following query:
select keyspace_name from system_schema.keyspaces;
If you want to know the tables in that keyspace, normally there is only 1 in the format of elementdata_<dmaid>_<eid>_<tableid> and verify if a table exists in that keyspace:
select table_name from system_schema.tables where keyspace_name = '<keyspace_name>';
If you want to drop the entire keyspace you can use the drop keyspace query as documented here, this will drop the entire keyspace with all it's tables and data:
https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlDropKeyspace.html
If you want to drop a table, you can use the drop table query as documented here, this will drop the table but keep the keyspace:
https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlDropTable.html
If you want to keep the table and keyspace but just want to all remove data, you can use the truncate table query as documented here:
https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlTruncate.html