【问题标题】:Cassandra - Ignore a Primary Key UUID on Where clausureCassandra - 在 Where 子句中忽略主键 UUID
【发布时间】:2019-01-22 18:35:25
【问题描述】:

在 Cassandra 数据库中如何忽略确定的 UUID 值?

像这样:

select * from fenix where id != 8e6e41df-7701-4cfa-b037-63293e69215f

例外:

不支持的“!=”关系:id != 8e6e41df-7701-4cfa-b037-63293e69215f

来自DataStax documentation

“限制:引用分区键的关系只能使用相等运算符 - = 或 IN。有关 IN 运算符的更多详细信息,请参见下面的示例。”

如何做到这一点?

【问题讨论】:

    标签: database cassandra datastax


    【解决方案1】:

    这在 cassandra 中根本不可能,因为它需要扫描所有记录

    【讨论】:

    • 是的!但是我们怎么能忽略查询中的任何记录呢?
    • 在应用端过滤掉
    • 好的!谢谢!
    【解决方案2】:

    Solr 可以做到:

    select * from fenix where solr_query = '-id:8e6e41df-7701-4cfa-b037-63293e69215f'; :)

    有关this link 的“否定查询”部分的更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-02
      • 1970-01-01
      • 2015-01-31
      • 2014-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多