TTL vs default_time_to_live哪个更好,为什么? [英] TTL vs default_time_to_live which one is better and why?

查看:124
本文介绍了TTL vs default_time_to_live哪个更好,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求很简单:我们必须创建一个仅包含24小时数据的表。
我们有两个选择

Requirement is simple: we have to create a table which will have only 24 hours of data. We have two options


  1. 每次插入都会删除TTL

  2. 将表属性设为default_time_to_live 24小时。

我对这两件事都有大致了解,但在内部,哪一个对处理墓碑会有帮助?还是两者都会产生相同数量的墓碑?哪个会更好,以及为什么要使用任何参考链接。

I have general idea about both the things but internally which one will be helpful to deal with tombstones? or both will generate same amount of tombstones? Which one will be better and why any reference link will be appreciated.

推荐答案

如果表上具有 default_time_to_live ,则超出该行的行时间限制将立即删除,而无需写入逻辑删除。这不会影响在其上设置了显式TTL的行/列。这些将被墓碑化。

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.

如果沿着TTL路线走,则应考虑将表上的 gc_grace_seconds 属性设置为小于默认值(10天)。尤其是如果您正在查看24小时TTL。

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.

参考文献:

如何删除数据<-良好的背景

How data is deleted <-- Good background

创建表属性<-表属性引用

CREATE TABLE properties <-- Table property reference

关于Cassandra中的删除和墓碑<-您想知道的有关删除和墓碑的一切

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

这篇关于TTL vs default_time_to_live哪个更好,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆