【问题标题】:Cassandra "default_time_to_live" property is not deleting dataCassandra“default_time_to_live”属性不删除数据
【发布时间】:2015-03-23 03:17:41
【问题描述】:

我创建了一个类似的表:

CREATE TABLE IF NOT EXISTS metrics_second(
  timestamp timestamp,
  value counter,
  PRIMARY KEY ((timestamp))
) WITH default_time_to_live=1;

并插入一些数据,例如:

UPDATE metrics_second SET value = value + 1 WHERE timestamp = '2015-01-22 17:43:55-0800';

当执行SELECT * FROM metrics_second 时,我总是看到数据,即使在一分钟左右之后,尽管表的default_time_to_live 属性设置为一秒。这是为什么呢?

【问题讨论】:

标签: database cassandra cql ttl


【解决方案1】:

正如@RussS 所证实的,不幸的是,当有计数器时,Cassandra 不支持表或行上的 TTL。

即使在创建表时设置了default_time_to_live 并且没有返回错误,Cassandra 也不会强制执行 TTL。

【讨论】:

猜你喜欢
  • 2019-02-16
  • 1970-01-01
  • 2018-03-01
  • 2021-12-17
  • 2016-10-18
  • 1970-01-01
  • 2015-03-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多