考虑具有以下表结构的表...
CREATE TABLE table1 ( id integer, name varchar(32), ts timestamp );
SELECT * FROM table1 WHERE id = xx 和 ts 在 '2010/04/01' 和 '2010/04/11' 之间
鉴于此查询,您将如何使用 Cassandra 表示给定的数据集?
考虑具有以下表结构的表...
CREATE TABLE table1 ( id integer, name varchar(32), ts timestamp );
SELECT * FROM table1 WHERE id = xx 和 ts 在 '2010/04/01' 和 '2010/04/11' 之间
鉴于此查询,您将如何使用 Cassandra 表示给定的数据集?
在 id 或 ts 上构建索引(以更具选择性的为准),对其进行查询,然后手动过滤另一部分。
(这基本上是 sql 数据库在后台所做的事情,顺便说一句。)
您需要建立一个二级索引。我的博客中描述的 Cassandra 索引模式之一将解决您的问题。
http://pkghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/
普拉纳布