Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7644F10E83 for ; Wed, 28 Aug 2013 15:23:18 +0000 (UTC) Received: (qmail 52664 invoked by uid 500); 28 Aug 2013 15:23:15 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 52276 invoked by uid 500); 28 Aug 2013 15:23:11 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 52268 invoked by uid 99); 28 Aug 2013 15:23:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 15:23:10 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mishra.vivs@gmail.com designates 209.85.215.181 as permitted sender) Received: from [209.85.215.181] (HELO mail-ea0-f181.google.com) (209.85.215.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 15:23:06 +0000 Received: by mail-ea0-f181.google.com with SMTP id d10so3026009eaj.40 for ; Wed, 28 Aug 2013 08:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=n2yXI9hbLVPOKrx3TkV4rbIzXUgWqHcXdlUFzQmGwFQ=; b=FRDdNFkLmUNVuWCzjrdLtaqoscMze9zbD0LFtgPwJuvuXwHyFLWnhpE4h8JGHappMi mFW+9veHXKcwmRyqsFCaAaskfFZKSLEXfgIXyStStVHg0O8znXrHBHE9YD3F6JSpeH// H1tzflDpeUDW7J7mc0/yGtMFVyGNIEbD4V2Tv97grjpGmclErc7TMnTpczAPbp5TI4IS c7aS1OAMBVEBbMTEFPSpApUmnMmcoTIvFZs5gbZtkmcQ9WE7lBix2yDCOuSQmH0tzg6D Qi1nBxOjq6Pox/kcSUe3J98/2Gp+sWMCbY6la6sgOqTd/k4hXeEuFw4FYh4lrpO6ojaM rBww== MIME-Version: 1.0 X-Received: by 10.14.199.3 with SMTP id w3mr43915096een.33.1377703365440; Wed, 28 Aug 2013 08:22:45 -0700 (PDT) Received: by 10.223.200.4 with HTTP; Wed, 28 Aug 2013 08:22:45 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 Aug 2013 20:52:45 +0530 Message-ID: Subject: Re: How to perform range queries efficiently? From: Vivek Mishra To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7b3440c8b4212d04e5038fc8 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b3440c8b4212d04e5038fc8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Create a column family of compositeType (or PRIMARY KEY) as (user_id,age, salary). Then you will be able to query use eq operator over partition key and as well over clustering key: You may also exclude salary as a secondary index rather than part of cluster key(e.g. age,salary) I am sure based on your query usage, you can opt for either a composite key or may mix composite key with secondary index ! Have a look at: http://www.datastax.com/dev/blog/introduction-to-composite-columns-part-1 Hope it helps. -Vivek On Wed, Aug 28, 2013 at 5:49 PM, S=E1vio Teles wrote: > I can populate again. We are modelling the data yet! Tks. > > > 2013/8/28 Vivek Mishra > >> Just saw that you already have data populated, so i guess modifying for >> composite key may not work for you. >> >> -Vivek >> >> >> On Tue, Aug 27, 2013 at 11:55 PM, S=E1vio Teles < >> savio.teles@lupa.inf.ufg.br> wrote: >> >>> Vivek, using a composite key, how would be the query? >>> >>> >>> 2013/8/27 Vivek Mishra >>> >>>> For such queries, looks like you may create a composite key as >>>> (user_id,age, salary). >>>> >>>> Too much indexing always kills(irrespective of RDBMS or NoSQL). >>>> Remember every search request on secondary indexes will be passed on e= ach >>>> node in ring. >>>> >>>> -Vivek >>>> >>>> >>>> On Tue, Aug 27, 2013 at 11:11 PM, S=E1vio Teles < >>>> savio.teles@lupa.inf.ufg.br> wrote: >>>> >>>>> Use a database that is designed for efficient range queries? ;D >>>>>> >>>>> >>>>> Is there no way to do this with Cassandra? Like using Hive, Sorl... >>>>> >>>>> >>>>> 2013/8/27 Robert Coli >>>>> >>>>>> On Fri, Aug 23, 2013 at 5:53 AM, S=E1vio Teles < >>>>>> savio.teles@lupa.inf.ufg.br> wrote: >>>>>> >>>>>>> I need to perform range query efficiently. >>>>>>> >>>>>> ... >>>>>> >>>>>>> This query takes a long time to run. Any ideas to perform it >>>>>>> efficiently? >>>>>>> >>>>>> >>>>>> Use a database that is designed for efficient range queries? ;D >>>>>> >>>>>> =3DRob >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Atenciosamente, >>>>> S=E1vio S. Teles de Oliveira >>>>> voice: +55 62 9136 6996 >>>>> http://br.linkedin.com/in/savioteles >>>>> Mestrando em Ci=EAncias da Computa=E7=E3o - UFG >>>>> Arquiteto de Software >>>>> Laboratory for Ubiquitous and Pervasive Applications (LUPA) - UFG >>>>> >>>> >>>> >>> >>> >>> -- >>> Atenciosamente, >>> S=E1vio S. Teles de Oliveira >>> voice: +55 62 9136 6996 >>> http://br.linkedin.com/in/savioteles >>> Mestrando em Ci=EAncias da Computa=E7=E3o - UFG >>> Arquiteto de Software >>> Laboratory for Ubiquitous and Pervasive Applications (LUPA) - UFG >>> >> >> > > > -- > Atenciosamente, > S=E1vio S. Teles de Oliveira > voice: +55 62 9136 6996 > http://br.linkedin.com/in/savioteles > Mestrando em Ci=EAncias da Computa=E7=E3o - UFG > Arquiteto de Software > Laboratory for Ubiquitous and Pervasive Applications (LUPA) - UFG > --047d7b3440c8b4212d04e5038fc8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Create a column family of compositeType (or PRIMARY KEY) a= s (user_id,age, salary).

Then you will be able to query = use eq operator =A0over partition key and as well over clustering key:

You may also exclude s= alary as a secondary index rather than part of cluster key(e.g. age,salary)=

I am sure based on your query usage, you can= opt for either a composite key or may mix composite key with secondary ind= ex !


Hope it helps.


= -Vivek


On Wed, Aug 28, 2013 at 5:49 PM, S=E1vio Teles <<= a href=3D"mailto:savio.teles@lupa.inf.ufg.br" target=3D"_blank">savio.teles= @lupa.inf.ufg.br> wrote:
I can populate again. We ar= e modelling the data yet! Tks.


2013/8/28 Vivek Mishra <mishra.vivs= @gmail.com>
Just saw that you already h= ave data populated, so i guess modifying for composite key may not work for= you.

-Vivek


On Tue, Aug 27, 2013 at 11:55 PM, S=E1vio Teles <savio.teles@lup= a.inf.ufg.br> wrote:
Vivek, using a composite key, how<= /span> would be the query?


2013/8/27 Vivek Mishra <mishra.vivs= @gmail.com>
For such queries, looks like you may create a composite ke= y as (user_id,age, salary).

Too much indexing always kil= ls(irrespective of RDBMS or NoSQL). Remember every search request on second= ary indexes will be passed on each node in ring.

-Vivek


On Tue, Aug 27, 2013 at 11:11 PM, S=E1vio Teles <savio.teles@lupa.inf.ufg.br> wrote:
Use a database that is designed for efficient range queries? ;D
<= /blockquote>
Is there no way to do this with Cassandra? Like using Hive, Sorl.= ..


2013/8/27 Robert Coli <rcoli@eventbrite.com>
On Fri, Aug 23, 2013 a= t 5:53 AM, S=E1vio Teles <savio.teles@lupa.inf.ufg.br> wrote:
I need to pe= rform range query efficiently.=A0
...=A0
Thi= s query takes a long time to run. An= y ideas to perform it efficiently?

Use a database t= hat is designed for efficient range queries? ;D

= =3DRob
=A0



--
Atenciosamente,
S=E1vio S. Teles de Oliveira
v= oice: +55 62 9136 6996
http://b= r.linkedin.com/in/savioteles
Mestrando em Ci=EAncias da Computa=E7=E3o - UFG
Arquiteto de Software
Laboratory for Ubiquitous and Pervasive Applications (LUP= A) - UFG




--
Atenciosamente,
S=E1vio S. Teles de Oliveira
voice: +55= 62 9136 6996
http://b= r.linkedin.com/in/savioteles
Mestrando em Ci=EAncias da Computa=E7=E3o - UFG
Arquiteto de Software
Laboratory for Ubiquitous and Pervasive Applications (LUP= A) - UFG




--
Atenciosamente,
S=E1vio S. Teles de Oliveira
voice:= +55 62 9136 6996
http://br.linkedin.com/in/savioteles
Mestrando em Ci=EAncias da Computa=E7=E3o - UFG
Arquiteto de Software
Laboratory for Ubiquitous and Pervasive Applications (LUP= A) - UFG

--047d7b3440c8b4212d04e5038fc8--