【发布时间】:2017-11-23 23:07:30
【问题描述】:
我已将 locationtype 定义为静态列。
我想过滤静态列上的数据。
select count(*) from device_stats_by_location where locationtype = "garage";
但我面临异常 -
InvalidRequest: code=2200 [Invalid query] message="Predicates on non-primary-key columns (locationtype) are not yet supported for non secondary index queries"
如此尝试...
cqlsh:device_data> CREATE INDEX locationtype_indx on device_stats_by_location (locationtype);
产生了错误信息...
InvalidRequest: code=2200 [Invalid query] message="Secondary indexes are not allowed on static columns"
我的问题是 - 如何在 CQL 查询中使用静态列?
【问题讨论】:
-
你为什么使用静态列?你的用例是什么?
-
位置类型对于具有相同分区键的所有行都是固定的
-
数据模型 => locationid(Pk), endof10minwindow (Ck1) , devicecategory (Ck2) , devicecount , locationtype (S) , region (S) => locationid 会有 2000 行聚集在一起,它们将具有相同的 locationtype 和 region => 这就是为什么 将它们指定为静态 => 按 locationtype 查询数据的最佳方法是什么?
标签: cassandra cassandra-2.0 cassandra-3.0