Cassandra Hector:如何做一个带索引列的MultigetSliceQuery? [英] Cassandra Hector: How to do a MultigetSliceQuery with indexed columns?

查看:216
本文介绍了Cassandra Hector:如何做一个带索引列的MultigetSliceQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在索引列上使用条件时执行MultigetSliceQuery,例如IndexedSlicesQuery。换句话说,一个IndexedSlicesQuery在一组特定的键上执行。

Is it possible to perform a MultigetSliceQuery while using conditions on indexed columns like with a IndexedSlicesQuery. In other words, an IndexedSlicesQuery performed on a specific set of keys.

我发现这样做的方式是首先对一组键执行MultigetSliceQuery,然后过滤在应用程序代码中的结果。

The way I found to do this is by first performing a MultigetSliceQuery on a set of keys and then filter the results in the application code. But can Cassandra do it for me?

推荐答案

不,IndexedSlicesQuery的唯一选项是设置 startKey rowCount ,所以2阶段过滤器是唯一的方法。

No, the only options for IndexedSlicesQuery are setting the startKey and rowCount, so 2 phased filter would be the only way.

有两种选择:添加另一个辅助索引,并将其包含在索引查询中,在现有列族中使用复合键和/或列,

A couple of options to look at: add another secondary index and include that in the indexed query, use of composite keys and/or columns in the existing column family, or a new column family with keys or columns which refer to the original keys.

可能的结果是多个查询(对一个或多个列族),但Cassandra将会是做得很重。

Might result is more than one query (to one or more column family), but Cassandra will be doing the heavy lifting.

这篇关于Cassandra Hector:如何做一个带索引列的MultigetSliceQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆