Hi,

According to the documentation on Indexes (
http://www.datastax.com/docs/1.1/ddl/indexes ),
in order to use WHERE on a column which is not part of my key, I must
define a secondary index on it. However, I can only use equality comparison
on it but I wish to use other comparisons methods like greater than.

Let's say I have a room with people and every timestamp, I measure
the temperature of the room and number of people. I use the timestamp as my
key and I want to select all timestamps where temperature was over 50
degrees but I can't seem to be able to do it with a regular query even if I
define that column as a secondary index.
SELECT * FROM MyTable WHERE temp > 50.4571;

My lame workaround is to define a secondary index on NumOfPeopleInRoom and
than for a specific value
SELECT * FROM MyTable WHERE NumOfPeopleInRoom = 7 AND temp > 50.4571;

I'm pretty sure this is not the proper way for me to do this.

How should I attack this? It feels like I'm missing a very basic concept.
I'd appreciate it if your answers include also the option of not changing
my schema.

Thanks!!!

Reply via email to