TTL
Sometimes we may want to expire or delete some data after a certain amount of time has elapsed. For example, in a column family of a user's status updates, we don't want to keep status updates of users for more than 100 days. One way of doing this is to create a monitoring job to keep track of such things and then delete such data. However, in Cassandra, these things can be taken care of by the database itself. This means a default TTL(time to live) operation could be specified for all the data of a column family as well as per INSERT
or DELETE
operation. TTL defines a time duration after which Cassandra will start removal process of the data. TTL precision is in seconds. Behind the hood, when a piece of data is removed, a tombstone is put onto it. Later on, tombstones are cleared during garbage collection of the normal compaction process after a period of time specified by the gc_grace_seconds
configuration option.
Note
Tombstone age is calculated at each node of a cluster locally, so...