I am referencing following documentation: https://docs.datastax.com/en/dse/6.8/dse-dev/datastax_enterprise/tools/nodetool/toolsTablestats.html#Examples

I would like to get the total number of SSTables. For that I tried using the nodetool tablestats command and adding up all the values of the SSTable count field of the table objects.

I noticed, that this field is not present in the yaml format, only in the plain text format. Is there another way to get this number?

In Addition, I wanted to ask if the number of active SSTables is equal to the number of open files of the cassandra process?

  • 1
    Welcome to Stack Exchange! A friendly note that you should avoid multiple questions in a single post. Please only ask one question in each post and create multiple posts if you need to ask multiple questions. For reference, see meta.stackoverflow.com/a/371617/4269535. Cheers! May 11, 2023 at 10:49

2 Answers 2


You can write a script to loop through the output of nodetool tablestats to add up all the SSTable counts to get the total. There isn't a command that would give you a total because that statistic is not tracked by Cassandra.

Also, we only use YAMLs for configuration files, not command outputs. Cheers!

  • Ok thats what I was doing anyway. I was just wondering whether I could work with the "-F yaml" parameter to make handling in the script easier, but parsing it out of the plain-text-output works too.
    – gobsej
    May 11, 2023 at 13:18

thank you for the question!

nodetool tablestats does provide an option (-F / --format) to convert/display the output in yaml or json format.

With an utility like jq, one could easily get the desired value.

For example, consider the following keyspace/table combination test.udt_test and if the output of nodetool tablestats --format json -- test.udt_test is as follows,

  "test" : {
    "read_latency_ms" : "NaN",
    "write_count" : 0,
    "pending_flushes" : 0,
    "tables" : {
      "udt_test" : {
        "bloom_filter_space_used" : "56",
        "bytes_repaired" : 0,
        "compacted_partition_maximum_bytes" : 50,
        "index_summary_off_heap_memory_used" : "0",
        "off_heap_memory_used_total" : "56",
        "local_read_latency_ms" : "NaN",
        "local_write_latency_ms" : "NaN",
        "local_read_count" : 0,
        "space_used_live" : "15974",
        "bloom_filter_false_positives" : 0,
        "compression_metadata_off_heap_memory_used" : "24",
        "average_tombstones_per_slice_last_five_minutes" : "NaN",
        "average_live_cells_per_slice_last_five_minutes" : "NaN",
        "number_of_partitions_estimate" : 9,
        "dropped_mutations" : "0",
        "memtable_switch_count" : 2,
        "compacted_partition_minimum_bytes" : 30,
        "percent_repaired" : 0.0,
        "sstables_in_each_level" : [ ],
        "bloom_filter_false_ratio" : "0.00000",
        "bloom_filter_off_heap_memory_used" : "32",
        "sstable_compression_ratio" : 0.5630841121495327,
        "memtable_off_heap_memory_used" : "0",
        "local_write_count" : 0,
        "space_used_total" : "15974",
        "bytes_unrepaired" : 428,
        "memtable_cell_count" : 0,
        "space_used_by_snapshots_total" : "0",
        "memtable_data_size" : "0",
        "maximum_tombstones_per_slice_last_five_minutes" : 0,
        "maximum_live_cells_per_slice_last_five_minutes" : 0,
        "pending_flushes" : 0,
        "bytes_pending_repair" : 0,
        "compacted_partition_mean_bytes" : 38
    "write_latency_ms" : "NaN",
    "read_count" : 0,
    "read_latency" : "NaN"
  "total_number_of_tables" : 159

I could easily fetch just the value for total_number_of_tables using the following command,

nodetool tablestats --format json -- test.udt_test | jq '.total_number_of_tables'


which you could apply it in your scripting logic. I hope that helps!

p/s: One could also test the jq functionality without actually installing it via web tools such as https://www.devtoolsdaily.com/jq_playground/

  • Thanks but perhaps I was to unclear in my question. I know those functionalities already, my problem is, that the tablesstats output lacks a certain metric when switching the format. In the plain text output there is a field called "SSTables count" but in yaml or json format it is nowhere to be found.
    – gobsej
    May 12, 2023 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.