EDIT1: added a case to describe the problem after the original question.
I wish to query on a column which is not part of my key. If I understand correctly, I need to define a secondary index on that column. However, I wish to use a greater than condition (not just equality condition) and that still seems unsupported.
Am I missing something? How would you address this issue?
My desired Setup:
Cassandra 1.1.6
CQL3
CREATE TABLE Table1(
KeyA int,
KeyB int,
ValueA int,
PRIMARY KEY (KeyA, KeyB)
);
CREATE INDEX ON Table1 (ValueA);
SELECT * FROM Table1 WHERE ValueA > 3000;
Since defining a secondary index on ColumnFamilies with Composite Keys is still not supported in Cassandra 1.1.6 I have to settle on a temporary solution of dropping one of the keys but I still have the same problem with non equality conditions.
Is there another way to address this?
Thank you for your time.
Relevant sources: http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt http://www.datastax.com/docs/1.1/ddl/indexes
EDIT1
Here's a case that will explain the problem. As rs-atl noted, it might be a data model problem. Let's say I keep a column family of all the users on stackoverflow. for each user I keep a batch of stats (Reputation, NumOfAnswers, NumOfVotes... all of them are int). I want to query on those stats to get the relevant users.
CREATE TABLE UserStats(
UserID int,
Reputation int,
NumOfAnswers int,
.
.
.
A lot of stats...
.
.
.
NumOfVotes int,
PRIMARY KEY (UserID)
);
Now I'm interested in slicing UserID's based on those stats. I want all the users with over 10K reputation, I want all the users with less than 5 answers, etc. etc.
I hope that helps. Thanks again.