You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by A J <s5...@gmail.com> on 2012/08/16 21:13:33 UTC

'WHERE' with several indexed columns

Hi
If I have a WHERE clause in CQL with several 'AND' and each column is
indexed, which index(es) is(are) used ?
Just the first field in the where clause or all the indexes involved
in the clause ?

Also is index used only with an equality operator or also with greater
than /less than comparator as well ?

Thanks.

Re: 'WHERE' with several indexed columns

Posted by aaron morton <aa...@thelastpickle.com>.
> If I have a WHERE clause in CQL with several 'AND' and each column is
> indexed, which index(es) is(are) used ?
The most selective based on the average number of columns per row 
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java

> Also is index used only with an equality operator or also with greater
equality


Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 17/08/2012, at 7:13 AM, A J <s5...@gmail.com> wrote:

> Hi
> If I have a WHERE clause in CQL with several 'AND' and each column is
> indexed, which index(es) is(are) used ?
> Just the first field in the where clause or all the indexes involved
> in the clause ?
> 
> Also is index used only with an equality operator or also with greater
> than /less than comparator as well ?
> 
> Thanks.