Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool forcecompact

Cassandra 5.0+

This command is available in Cassandra 5.0 and later.

Forces compaction of SSTables containing specified partition keys, ignoring gc_grace_seconds.


Terminal window
nodetool [connection_options] forcecompact <keyspace> <table> <keys>...

See connection options for connection options.

nodetool forcecompact forces compaction of SSTables containing the specified partition keys. Unlike regular compaction, this command ignores gc_grace_seconds when purging tombstones, allowing immediate removal of deleted data for specific partitions.

Use With Caution

This command ignores gc_grace_seconds, which means tombstones may be removed before they have propagated to all replicas. Use only when you are certain all replicas have seen the deletions, or after running repair.


ArgumentDescription
keyspaceTarget keyspace
tableTarget table
keysPartition keys to force compact

Terminal window
nodetool forcecompact my_keyspace my_table user123 user456

Terminal window
# After ensuring all replicas have seen deletions
nodetool repair my_keyspace my_table
# Force compact specific partitions to remove tombstones
nodetool forcecompact my_keyspace my_table partition_key_value

CommandRelationship
compactGeneral compaction
compactionstatsView compaction status
getsstablesList SSTables for key