Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0D5FF3B5 for ; Mon, 22 Apr 2013 09:55:17 +0000 (UTC) Received: (qmail 45004 invoked by uid 500); 22 Apr 2013 09:55:17 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 44968 invoked by uid 500); 22 Apr 2013 09:55:17 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 44950 invoked by uid 99); 22 Apr 2013 09:55:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Apr 2013 09:55:16 +0000 Date: Mon, 22 Apr 2013 09:55:16 +0000 (UTC) From: "Sylvain Lebresne (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CASSANDRA-5470) Query with condition on two secondary indexes can't be run without ALLOW FILTERING. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 < 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