user408075
user408075

Reputation:

Does Cassandra support conditional queries?

I'm thinking of switching to cassandra from my current SQL-esque solution (simpledb) mainly due to speed, cost and the built in caching feature of cassandra. However I'm stuck on the idea of indexing. Ive gathered that in cassandra you have to manually create indexes in order to execute complex queries. But what if you have data like the following, a row with a simple supercolumn:

row1 {value1="5", value2="7", value3="9"}

And you need to execute dynamic queries like "give me all the rows with value1 between x and y and value2 between z and q, etc. Is this possible? Or if you have queries like this is it a bad idea to use cassandra?

Upvotes: 6

Views: 1073

Answers (2)

Mohit
Mohit

Reputation: 239

Secondary indices were introduced in 0.7. However, to use an indexed_slice_query, you need to have at least one equals expression. For example, you can do value1 = x and value2 < y, but not both range queries.

See Cassandra API

Upvotes: 2

Schildmeijer
Schildmeijer

Reputation: 20946

Cassandra 0.7.x contains secondary index that let you make queries like the one above. The following blog post describes the concept: http://www.riptano.com/blog/whats-new-cassandra-07-secondary-indexes

Upvotes: 4

Related Questions