TTL vs default_time_to_live which one is better and why?

ぃ、小莉子 提交于 2019-12-04 15:08:09

If a table has default_time_to_live on it then rows that exceed this time limit are deleted immediately without tombstones being written. This will not affect rows / columns that have an explicit TTL set on them. These will be tombstoned.

If you go down the TTL route then you should consider setting the gc_grace_seconds property on the table to something less than the default (10 days). Particularly if you are looking at a 24 hour TTL.

References:

How data is deleted <-- Good background

CREATE TABLE properties <-- Table property reference

About Deletes and Tombstones in Cassandra <-- Everything you ever wanted to know about deletes and tombstones

If you use Cassandra 3.0 you can also define materialized view, see details: https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateMV.html

Using TTL is not that effective as you will generate lots of tombstones, which depending on the amount of data might effect your read performance.

Also I think your question regarding the TTL is answered here:

cassandra TTL for table behaviour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!