我正在使用 Cassandra 1.1.2 我正在尝试将 RDBMS 应用程序转换为 Cassandra。在我的 RDBMS 应用程序中,我有一个名为 table1 的表:
| Col1 | Col2 | Col3 | Col4 |
- Col1:字符串(主键)
- Col2:字符串(主键)
- Col3:Bigint(索引)
- Col4:比格特
该表包含超过 2 亿条记录。最常用的查询是这样的:
Select * from table where col3 < 100 and col3 > 50;
在 Cassandra 中,我使用以下语句创建表:
create table table1 (primary_key varchar, col1 varchar,
col2 varchar, col3 bigint, col4 bigint, primary key (primary_key));
create index on table1(col3);
我将主键更改为额外的列(我在应用程序中计算键)。导入一些记录后,我尝试执行以下 cql:
select * from table1 where col3 < 100 and col3 > 50;
这个结果是:
Bad Request: No indexed columns present in by-columns clause with Equal operator
查询select col1,col2,col3,col4 from table1 where col3 = 67 works
谷歌表示没有办法执行这种查询。是对的吗?任何建议如何创建这样的查询?