We have a table that doesn't have TTL set till now. We are planning to alter the table and set TTL with 28 days. Could you please let me know how we can update and set the TTL for the existing data?
We have a table that doesn't have TTL set till now. We are planning to alter the table and set TTL with 28 days. Could you please let me know how we can update and set the TTL for the existing data?
There is no out-of-the-box solution to update the TTL of all the partitions in the table.
You will need to write a custom application to iterate over all the partitions and update them one-by-one. We recommend using Spark for this type of operation since this job will require a full table scan. Spark via the Spark-Cassandra-connector will efficiently execute this job. Cheers!
Thanks Erick!
One more follow-up question - What would be the best approach in case if want to delete the old data after changing the Table TTL?
It's exactly the same -- you have to write an app for it. Cheers!
5 People are following this question.
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2023 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use