我在 Cassandra 2.0.8 中有一张如下表:
CREATE TABLE emp (empid int, deptid int, first_name text, last_name text, PRIMARY KEY (empid, deptid) )
当我尝试通过以下方式搜索时:“select * from emp where first_name='John';”
cql shell 说:
“错误请求:使用 Equal 运算符的 by-columns 子句中没有索引列”
我搜索了这个问题,它说的每个地方都为“first_name”列添加了一个二级索引。
但我需要知道为什么需要索引该列的确切原因?我唯一能弄清楚的是性能。还有其他原因吗?