Is it possible to delete a whole partition from Cassandra table, without writing tombstones and waiting from gc_grace_period and running compaction?
To remove all rows from a CQL Table, you can use the TRUNCATE command: TRUNCATE keyspace_name.
Cassandra deletes data in each selected partition atomically and in isolation. Deleted data is not removed from disk immediately. Cassandra marks the deleted data with a tombstone and then removes it after the grace period. CAUTION: Using delete may impact performance.
Never before gc_grace_period. But it's a good thing that you can control it. If you know the purpose of tombstones, then you can understand that in distributed deletes, if a node is dead for a while, you may get deleted data or there will create some consistency issues. For a single node, you can set gc_grace_period to 0. But for multi nodes, this value should be greater than 0. For frequent delete in some tables, if you are concerned about many tombstones generation, you can set small gc_grace for those tables but consider node failure scenarios and handle it as required.
Some Links:
Deletes Without Tombstones or TTLs
About deletes in Cassandra
EDITED ANSWER
Range Tombstones are an efficient way of deletion based on the partition key. This creates a single tombstone for an entire row, decreasing the number of tombstones read by range reads and the number of tombstones that need to be merged or cleaned up by compaction.
From the link @mando222 & I shared. Please read the given link. You'll get your answer.
There are different types of deletes. Whole partition delete (or single row delete), single column delete, range deletes. If you delete a single row or partition without mentioning a column, there will be created only one tombstone for that row or whole partition. They do not have an individual tombstone for each cell, instead they have a single range tombstone.
If you do range delete, some rows that reside in a range also creates a single tombstone for the range.
Fewer tombstones yield faster reads and quicker, less expensive compactions.
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