What happens behind the scenes on altering Cassandra table property "default_time_to_live"?

Viewed 53

I read many docs and blogs on "default_time_to_live" property, but I am not sure If I "ALTER" this property on an existing table having TB of data in a Cassandra cluster, what impact will it make? will this impact the existing data that have TTL set on It via "UPDATE" query, or what exactly happens behind the scenes.

Does this property only impact the meta data for that table, and will work only on the rows that will be indexed after setting the property?

ALTER TABLE test WITH default_time_to_live = 86400;
1 Answers

If you recall, SSTables are immutable -- once written to disk, they never change again.

When you change a table's default TTL, the new expiry will only apply to new mutations. Cassandra doesn't retroactively apply the new TTL to the data which has already been written to disk so the existing SSTables won't change.

If you want to update the TTL on existing data, you will need to write an ETL app (preferably a Spark job). Cheers!

Related