[ 
https://issues.apache.org/jira/browse/CASSANDRA-5470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13640188#comment-13640188
 ] 

Sergey Naumov commented on CASSANDRA-5470:
------------------------------------------

Also, in documentation it is still unclear that second secondary index won't be 
used effectively: "When there are multiple conditions in a WHERE clause, 
Cassandra selects the least-frequent occurrence of a condition for processing 
first for efficiency". This phrase implies that then second index will be used. 
Also it should be clarified what "least-frequent occurrence" means - occurrence 
in index (so big number of rows for small number of distinct indexed values) or 
occurrence in terms of rows (not so big number of rows for higher number of 
distinct indexed values). The latter seems to be more efficient in case of 
multiple indexes and subsequent filtering.
                
> Query with condition on two secondary indexes can't be run without ALLOW 
> FILTERING.
> -----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5470
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5470
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.2.3
>         Environment: Apache Cassandra 1.2.3 installed from DataStax debian 
> repository.
>            Reporter: Sergey Naumov
>
> While manual explicitly suggests to use multiple secondary indices 
> (http://www.datastax.com/docs/1.2/ddl/indexes - Using multiple secondary 
> indexes), it is impossible to call such a query without ALLOW FILTERING 
> clause.
> I have the following table:
> cqlsh <<SQL
>     DROP TABLE k1.tbl1;
>     CREATE TABLE k1.tbl1 (
>         id timeuuid,
>         name varchar,
>         regid int,
>         date timestamp,
>         time timestamp,
>         payload varchar,
>         PRIMARY KEY (id)
>     );
>     CREATE INDEX tbl1_name
>         ON k1.tbl1 (name);
>     CREATE INDEX tbl1_regid
>         ON k1.tbl1 (regid);
>     CREATE INDEX tbl1_date
>         ON k1.tbl1 (date);
> SQL
> But when I'm trying to perform a query, error occured:
> cqlsh> select * from k1.tbl1 where regid = 2 and name = 'DB49';
> Bad Request: Cannot execute this query as it might involve data filtering and 
> thus may have unpredictable performance. If you want to execute this query 
> despite the performance unpredictability, use ALLOW FILTERING
> Perhaps you meant to use CQL 2? Try using the -2 option when starting cqlsh.
> With ALLOW FILTERING clause everything is OK.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to