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 conceptually)? 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With