Delete whole partition from Cassandra without tombstones and ttl?
Asked Answered
S

1

8

Is it possible to delete a whole partition from Cassandra table, without writing tombstones and waiting from gc_grace_period and running compaction?

Shaw answered 7/5, 2018 at 7:32 Comment(0)
S
3

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.

Smitty answered 7/5, 2018 at 12:17 Comment(3)
I would also add that you can delete the partition and have a single tombstone instead of deleting the rows and getting many. TLP has a great article on this from a little while back. This is much safer than messing with gc_grace to 0.Poussin
How do you delete a partition and have a single partition? @Poussin This seems perfect for my use caseShaw
@Shaw TLP had a great article that might help with your understanding of it. thelastpickle.com/blog/2016/07/27/…Poussin

© 2022 - 2024 — McMap. All rights reserved.