cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CASSANDRA-5470) Query with condition on two secondary indexes can't be run without ALLOW FILTERING.
Date Mon, 22 Apr 2013 09:55:16 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-5470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sylvain Lebresne resolved CASSANDRA-5470.
-----------------------------------------

    Resolution: Not A Problem

This is on purpose. As the message tries to explain it, Cassandra does not know how to make
use of multiple indexes at the same time. Thus, it really only use one of the index, and filter
the rows returned by that first index, which may yield unpredictable performances, and for
that reason, we don't accept the query unless ALLOW FILTERING is provided.

The short version being that unless you understand what is going on or don't care about performance,
you should probably avoid that type of query.

As for the DataStax documentation, it's not up to date and I will mention it so it is fixed.
                
> 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

Mime
View raw message