Reputation: 123
My requirement is to clear out the record after 5 days. I have already created a table, but didn't set this time to live configuration at table level. Now I want to set it up for the table and also to the existing records on the table.
Upvotes: 0
Views: 403
Reputation: 2196
You can set a default TTL for the table, but there is no way to go back and change a record without a TTL to have a TTL (i.e. the default TTL will apply a TTL value to a record that does not have one during insert time). In your case, after the default TTL is set at the table level, you will have to find and delete any rows in the table with code/cql/etc, manually, after they're considered "stale". This will create tombstones, and if there is an "overwhelming" number of rows that have tombstones, you might see performance issues and failures. Compaction will clean them up eventually, or you can clean them up yourself with a manual compaction (and possibly re-split again if the single generated sstable is large).
If this table is an INSERT ONLY type of table that will always have TTLs, you may want to consider TWCS. It will reduce the compaction workload significantly, and it also offers you other options to clean up data that does not have TTLs.
Hopefully this helps.
-Jim
Upvotes: 2