开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜