How to translate complex sql into the equivalent Cassandra representation
Consider a table with the following table structure ...
CREATE TABLE table1 ( id integer, name varchar(32), 开发者_StackOverflow中文版 ts timestamp );
SELECT * FROM table1 WHERE id = xx and ts between '2010/04/01' and '2010/04/11'
Given this query, how would you represent the given data-set using Cassandra?
build an index either on id or ts (whichever is more selective), query on that, and filter the other part manually.
(this is basically what a sql database does under the hood, btw.)
You need to build a secondary index. One of the Cassandra index patterns described in my blog will solve your problem.
http://pkghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/
Pranab
精彩评论