我有一个Cassandra列系列,我每月存储大量(数十万)个事件,时间戳(“Ymdhisu”)作为行键.它有多列为每个事件捕获一些数据.我尝试检索特定时间范围的事件数据.例如,对于Jan,我使用了以下CQL查询:
a)2013年1月1日至1月15日之间的查询
select count(*) from Test where Key > 20130101070100000000 and Key <
20130115070100000000 limit 100000; Bad Request: Start key’s md5 sorts
after end key’s md5. This is not allowed; you probably should not
specify end key at all,under RandomPartitioner
b)2013年1月1日至1月1日范围内的查询
select count(*) from Test where Key > 20130101070100000000 and Key <
20130110070100000000 limit 100000; count – 73264
c)2013年1月1日至1月1日范围内的查询
select count(*) from Test where Key > 20130101070100000000 and Key <
20130102070100000000 limit 100000; count – 78328
似乎范围搜索根本不起作用!我的Columnfamily的架构是:
Create column family Test with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type AND compression_options={sstable_compression:SnappyCompressor,chunk_length_kb:64};
要提取数据,有什么建议?我是否需要使用密钥验证类重新定义我的模式作为TimeUUID类型?有没有其他方法可以有效地查询而不更改架构?
我在这个专栏系列中每月处理至少100-200K行的数据.如果此模式不能用于此目的,那么存储和检索此处描述的数据类型的Cassandra模式是什么?