简体   繁体   中英

Delete whole partition from Cassandra without tombstones and ttl?

是否可以从Cassandra表中删除整个分区,而无需编写逻辑删除并等待gc_grace_period并运行压缩?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM