Search code examples
filtercassandraproductionpartition

Get sample data from a Cassandra table


I have read access to a production Cassandra cluster. I'd like to look at a sample row to understand the data a little better. I don't know any of the partition keys to filter on and I'd rather not run any query that would impact the performance of the cluster (ie. allow filtering etc)

I don't have access to nodetool.

Are there any cqlsh queries that would allow me to just get some sample data from a table without knowing a partition key ahead of time to filter on? Or a query that would give me a list of the partition keys that I can then use to filter on?

Thanks!


Solution

  • If you connect via cqlsh, you can use the LIMIT operator to limit the number of results returned with something like:

    SELECT * FROM table_name LIMIT 10;
    

    This would limit the number of records so you're not doing a full table scan.

    Ideally however is that you either get (a) some sample data from the app team, or (b) connect to a non-production environment. Cheers!