我正在使用Cassandra 1.1.2我正在尝试将RDBMS应用程序转换为Cassandra.在我的RDBMS应用程序中,我有以下表名为table1:
| Col1 | Col2 | Col3 | Col4 |
Run Code Online (Sandbox Code Playgroud)
该表计有超过2亿条记录.最常用的查询类似于:
Select * from table where col3 < 100 and col3 > 50;
Run Code Online (Sandbox Code Playgroud)
在Cassandra中,我使用以下语句来创建表:
create table table1 (primary_key varchar, col1 varchar,
col2 varchar, col3 bigint, col4 bigint, primary key (primary_key));
create index on table1(col3);
Run Code Online (Sandbox Code Playgroud)
我将主键更改为一个额外的列(我计算了我的应用程序中的键).导入几条记录后,我尝试执行以下cql:
select * from table1 where col3 < 100 and col3 > 50;
Run Code Online (Sandbox Code Playgroud)
结果是:
Bad Request: No indexed columns present in by-columns clause with Equal operator
Run Code Online (Sandbox Code Playgroud)
查询从table1中选择col1,col2,col3,col4,其中col3 = 67有效 …