question

vikram.singh.chouhan_187371 avatar image
vikram.singh.chouhan_187371 asked Erick Ramirez commented

What is the best practice for deleting a large number of partitions?

I have live datacenter with standalone Cassandra db holding huge data sets. As a part of requirement I want to clean us a specific user data in my system which is nothing but partition key of my tables. How efficiently can I achieve this deletion process in live systems.

tombstones
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

There's really not much to it -- deleting whole partitions do not suffer from the same problem as deleting rows inside partitions.

Just make sure you don't overload your cluster since deletes in Cassandra are "inserts" under-the-hood (inserts a tombstone) so they are regular writes and it is possible to flood the nodes with lots of deletes/writes. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks @Erick Ramirez for sharing your thoughts.

Separately, On the similar lines I do have requirements to delete some rows within specific partitions, what should I, ideally be taking care in this scenario?

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ vikram.singh.chouhan_187371 commented ·
Provided you're not using Cassandra for queue management then it should be fine. Cheers!
0 Likes 0 ·
anjay.prasad avatar image
anjay.prasad answered Erick Ramirez commented

Each of the delete operation will result in a single tombstone. If you are able to delete more data in a single command the fewer tombstones you will have. If your application is generating large number of tombstones Cassandra’s read performance will be impacted.

Deleting the data at the largest granularity ideally entire partitions at once. This will minimize the number of tombstones.
In your case you can delete the entire row I believe.

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image Erick Ramirez ♦♦ commented ·
Thanks for contributing to the community! Much appreciated!
0 Likes 0 ·