For example, we can use
select count(*) from student_database;
to calculate the number of rows in a table. But how do we calculate the number of tables in a keyspace?
DESCRIBE TABLES;
gives you the list of all tables in that keyspace.
SELECT count(*) FROM system_schema.tables WHERE keyspace_name='your keyspace'
The above query will work in cassandra 3.0 and above
And for a Cassandra 2.x (and lower) answer:
SELECT COUNT(*) FROM system.schema_columnfamilies
WHERE keyspace_name='your keyspace';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With