开发者

How to search secondary index in Cassandra without equality?

I need to be able to perform search on secondary indexes using only <, >, <=, or >=. I understand that Cassandra requires at least one equality index clause because it iterates over all the results from that equality index.

Are there any tricks to perform operations using only <, >, <=, or >= (at least conceptual开发者_开发技巧ly)? Is it a bad idea?

Also, does anybody know if there are any plans to change this in Cassandra?

Thanks!


If there were a good way to do this with 0.7 indexes, we/I would have mentioned it in http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes instead of saying "you need an equality expression." There is no Double Secret Cheat Code.

One alternative is to use ByteOrderedPartitioner (which lets you do >= queries on the row key). Another may be to create a materialized view on some subset of your data at write time. That's assuming you have enough rows that simply doing an unordered sequential scan is too slow.

Bitmap indexes in 0.8 ( https://issues.apache.org/jira/browse/CASSANDRA-1472) will support inequality operations on indexes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜