I have a simple column family like the following create table people( company_id text, employee_id text, gender text, primary key(company_id, employee_id) );
if I want to find out all the "male" employee given a company id, I can do 1/ select * from people where company_id=xxxx' and loop through the result efficiently to pick the employee who has gender column value equal to "male" 2/ add a seconday index create index gender_index on people(gender) select * from people where company_id='xxx' and gender='male' I though #2 seems more appropriate, but I also thought the secondary index is helping only locating the primary row key, with the select clause in #2, is it more efficient than #1 where application responsible loop through the result and filter the right content? ( It totally make sense if I only need to find out all the male employee(and not within a company) by using select * from people where gender='male" ) thanks