cassandra - 如何在 cql3 查询选择中执行 "not in"过滤器?

标签 cassandra cql3

我需要获取没有特定键的行。
sample :

 select * from users where user_id not in ("mikko");

我试过“不在”,这是回应:
Bad Request: line 1:35 no viable alternative at input 'not'

最佳答案

“不在”不是 CQL 中支持的操作。 Cassandra 的核心仍然基于键索引行。因此,该查询与“从用户中选择 *”基本相同,因为您必须遍历每一行并确定它是否与 in 不匹配。如果您想做那种类型的查询,您将需要设置一个 map 减少工作来执行它。

使用 Cassandra 时,您真正想要做的是将数据模型反规范化,以便应用程序执行的查询最终会查询单个分区(或仅几个分区)的结果。

还可以找到一些关于 Cassandra 数据建模的精彩网络研讨会和讲座

  • http://www.youtube.com/watch?v=T_WRC_GjRd0&feature=youtu.be
  • http://youtu.be/x4Q9JeLIyNo
  • http://www.youtube.com/watch?v=HdJlsOZVGwM&list=PLqcm6qE9lgKJzVvwHprow9h7KMpb5hcUU&index=10
  • 关于cassandra - 如何在 cql3 查询选择中执行 "not in"过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18498445/

    相关文章:

    cassandra - 如何使用 QueryBuilder 搜索 cassandra 集合图

    cassandra - 如何将 blob 插入 Cassandra 列族?

    Cassandra:如何在轻量级事务中执行更新插入

    java - 插入性能和插入稳定性差的 Cassandra 集群

    cassandra - 如何在 Cassandra 的查询中同时使用 ORDER BY 和 IN?

    cassandra - "create table with option With compact storage"或 "create table with option With clustering order storage"哪个写入效率高?

    cassandra - Docker + Cassandra ulimit 错误

    Cassandra CQL3 条件插入/更新

    cassandra - Cassandra错误-无法限制“聚类”列(之前的列受非EQ关系限制)

    cassandra - cqlsh 跟踪条目是什么意思?