bharadhwajt avatar image
bharadhwajt asked smadhavan commented

How can we change the 3-year TTL to 6 months on a few tables?


we have a TTL of 3 years for few tables. We would like to alter the table to use TTL of 6 months. If we alter the table and delete data older than 6 months. It will create lot of tombstones. In this case the reads will be much slower . May I know how to safely delete data and evict tombstones without impacting performance?

Please suggest

1 comment
10 |1000

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

And also if table migration is one option to look at?

If so how can I do without any downtime?

0 Likes 0 ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered smadhavan commented

There isn't an out-of-the-box solution for this. You will need to write an app preferably with Spark that would:

  1. Iterate over the existing partitions
  2. Update the relevant partition/row/column with a new TTL
  3. Delete any data older than 6 months

If you are deleting whole partitions then tombstones will not be a problem. But if you are deleting rows within a partition then tombstones will be a problem if you are scanning through the deleted rows. There isn't any way to avoid that unless you redesign your data model and/or rewrite your app code. Cheers!

5 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.

@Erick Ramirez Thanks. May I know the way to do any keyspace/table migrations without any downtime? Is it possible

0 Likes 0 ·
What do you mean by "migration"? Please elaborate. Cheers!
0 Likes 0 ·

Lets say If I want to restore the live prod table to other cluster ? where the application can use it as prod?

[Post converted to a comment since it's not an "answer"]

0 Likes 0 ·
To elaborate, lets say I have a cluster with couple of tables . If I would like to migrate a table from existing cluster to one of the other cluster's keyspace where it already exists.

0 Likes 0 ·

@bharadhwajt, a similar question was answered by Erick earlier and you could refer the procedure (it is for load, but you could refer to the blogs and examples for "unload" operation) to unload data from source keyspace/table and load it to destination keyspace/table provided the schema is same/compatible there using DSBulk

0 Likes 0 ·