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 679539394 for ; Wed, 16 Nov 2011 05:26:30 +0000 (UTC) Received: (qmail 61001 invoked by uid 500); 16 Nov 2011 05:26:28 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 60959 invoked by uid 500); 16 Nov 2011 05:26:28 -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 60950 invoked by uid 99); 16 Nov 2011 05:26:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2011 05:26:27 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rajkumar.w93@gmail.com designates 209.85.214.44 as permitted sender) Received: from [209.85.214.44] (HELO mail-bw0-f44.google.com) (209.85.214.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2011 05:26:21 +0000 Received: by bkbzv15 with SMTP id zv15so117724bkb.31 for ; Tue, 15 Nov 2011 21:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=qXZ8bD2spjytgHTdfPAauzZqk256cugFA0Jc+anSsZU=; b=tm6EWh7mR7po2MA5X2/SIUtyPI/Qt4rFuuSSGbfqaZULay+dQ9xlyo66JoXkQXJzSH X35hp/e8x754Cpb0folUxRkPn9HdmUKqVL3ia/yN84trP2rsAueFmx1ZsXWL4ZSskklV A+KMRsVrBPvRTuMMcGihA3uBq37ECWWcNDs0E= MIME-Version: 1.0 Received: by 10.205.118.13 with SMTP id fo13mr19454241bkc.123.1321421160300; Tue, 15 Nov 2011 21:26:00 -0800 (PST) Sender: rajkumar.w93@gmail.com Received: by 10.223.2.148 with HTTP; Tue, 15 Nov 2011 21:26:00 -0800 (PST) In-Reply-To: References: <1729105504170368002@unknownmsgid> Date: Wed, 16 Nov 2011 10:56:00 +0530 X-Google-Sender-Auth: dWVfZvsmDwohR0bBGgonAblaTFQ Message-ID: Subject: Re: Seeking advice on Schema and Caching From: Aditya Narayan To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=000e0cdfcbc6dbc17d04b1d356d2 --000e0cdfcbc6dbc17d04b1d356d2 Content-Type: text/plain; charset=ISO-8859-1 Got the first option that you suggested. However, In the second one, are you suggested to use, for e.g, key='Marcos' & store cols, for all users of that name, containing userId inside that row. That way it would have to read multiple rows while user is doing a single search. On Wed, Nov 16, 2011 at 10:47 AM, samal wrote: > > > I need to add 'search users' functionality to my application. (The >>> trigger for fetching searched items(like google instant search) is made >>> when 3 letters have been typed in). >>> > >>> > For this, I make a CF with String type keys. Each such key is made of >>> first 3 letters of a user's name. >>> > >>> > Thus all names starting with 'Mar-' are stored in single row (with >>> key="Mar"). >>> > The column names are framed as remaining letters of the names. Thus, a >>> name 'Marcos' will be stored within rowkey "Mar" & col name "cos". The id >>> will be stored as column value. Since there could be many users with same >>> name. Thus I would have multple userIds(of users named "Marcos") to be >>> stored inside columnname "cos" under key "Mar". Thus, >>> > >>> > 1. Supercolumn seems to be a better fit for my use case(so that ids of >>> users with same name may fit as sub-columns inside a super-column) but >>> since supercolumns are not encouraged thus I want to use an alternative >>> schema for this usecase if possible. Could you suggest some ideas on this ? >>> > >>> >> > Aditya, > > Have you any given thought on Composite columns [1]. I think it can help > you solve your problem of multiple user with same name. > > mar:{ > {cos,unique_user_id}:unique_user_id, > {cos,1}:1, > {cos,2}:2, > {cos,3}:3, > > // {utf8,timeUUID}:timeUUID, > } > OR > you can try wide rows indexing user name to ID's > > marcos{ > user1:' ', > user2:' ', > user3:' ' > } > > [1]http://www.slideshare.net/edanuff/indexing-in-cassandra > > --000e0cdfcbc6dbc17d04b1d356d2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Got the first option that you suggested.

However, In the= second one, are you suggested to use, for e.g, key=3D'Marcos' &= ; store cols, for all users of that name, containing userId inside that row= . That way it would have to read multiple rows while user is doing a single= search.

On Wed, Nov 16, 2011 at 10:47 AM, samal <samalgorai@gmail.= com> wrote:

> I need to add 'search users' functionality to my application. = (The trigger for fetching searched items(like google instant search) is mad= e when 3 letters have been typed in).
>
> For this, I make a CF with String type keys. Each such key is made of = first 3 letters of a user's name.
>
> Thus all names starting with 'Mar-' are stored in single row (= with key=3D"Mar").
> The column names are framed as remaining letters of the names. Thus, a= name 'Marcos' will be stored within rowkey "Mar" & c= ol name "cos". The id will be stored as column value. Since there= could be many users with same name. Thus I would have multple userIds(of u= sers named "Marcos") to be stored inside columnname "cos&quo= t; under key "Mar". Thus,
>
> 1. Supercolumn seems to be a better fit for my use case(so that ids of= users with same name may fit as sub-columns inside a super-column) but sin= ce supercolumns are not encouraged thus I want to use an alternative schema= for this usecase if possible. Could you suggest some ideas on this ?
>

Aditya,

Have you any given thought on Composite columns [1= ]. I think it can help you solve your problem of multiple user with same na= me.

mar:{
=A0 {cos,unique_user_id}:unique_user_id,
=A0 {cos,1}:1,
= =A0 {cos,2}:2,
=A0 {cos,3}:3,

//=A0 {utf8,timeUUID}:timeUUID,}
OR
you can try wide rows indexing user name to ID's

mar= cos{
=A0=A0 user1:' ',
=A0=A0 user2:' ',
=A0=A0 user3:'= ; '
}

[1]http://www.slideshare.net/edanuff/indexin= g-in-cassandra


--000e0cdfcbc6dbc17d04b1d356d2--