【发布时间】:2016-07-13 11:37:10
【问题描述】:
对 Cassandra 非常陌生,如果问题很简单,敬请见谅。
我创建了一个表:
create table ApiLog (
LogId uuid,
DateCreated timestamp,
ClientIpAddress varchar,
primary key (LogId, DateCreated));
这项工作很好:
select * from apilog
如果我尝试像这样添加带有 DateCreated 的 where 子句:
select * from apilog where datecreated <= '2016-07-14'
我明白了:
Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
从关于 SO 的其他问题和关于 datastax 的教程中,我了解到,由于 datecreated 列是一个聚类键,它可以用来过滤数据。
我也尝试创建索引,但我得到了相同的消息。我试图从主键中删除 DateCreated 并将其仅作为索引,但我仍然得到相同的结果:
create index ApiLog_DateCreated on dotnetdemo.apilog (datecreated);
【问题讨论】:
标签: cassandra