【问题标题】:How do I select all rows from two clustering columns in cassandra database如何从 cassandra 数据库中的两个聚类列中选择所有行
【发布时间】:2022-01-12 04:24:30
【问题描述】:

我有一个分区键:A

聚类列:B、C

我明白我可以这样查询

    Select * from table where A = ?
    Select * from table where A = ? and B = ?
    Select * from table where A = ? and B = ? and C = ?

现在我有一个场景,我只需要从 B 和 C 获取结果。有没有办法不使用允许过滤。

【问题讨论】:

  • 你的意思是BC只有过滤条件,A没有条件?或者您的意思是要在结果中投影BC 列?您能否在您的问题中澄清这一点,并最好举一个带有一些数据的例子?

标签: cassandra cassandra-3.0 spring-data-cassandra


【解决方案1】:

如果不使用Allow Filtering,则无法在没有分区键的情况下基于“B”和“C”(the clustering columns) 获取。虽然您可以使用 spark 和 spark-cassandra-connector 根据“B”和“C”过滤掉结果。在后台它也使用了允许过滤,但它具有以正确方式扫描表的有效机制。

【讨论】:

    猜你喜欢
    • 2017-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多