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 34A8B90E3 for ; Tue, 27 Mar 2012 08:57:37 +0000 (UTC) Received: (qmail 63774 invoked by uid 500); 27 Mar 2012 08:57:35 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 63659 invoked by uid 500); 27 Mar 2012 08:57:34 -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 63640 invoked by uid 99); 27 Mar 2012 08:57:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 08:57:34 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.212.44] (HELO mail-vb0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 08:57:28 +0000 Received: by vbbez10 with SMTP id ez10so3717777vbb.31 for ; Tue, 27 Mar 2012 01:57:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=jT3XLRQ1AT0w898AWqe/t8pj2/FKDDBIyZ8SznChSPU=; b=l8jszxHef66TXP9WU19FSBgpR5G4Aq5PhIcw/RBkzFV2jrPiqVjBxWAou5gWpsZoI/ Yko4sMkqhvpxDEG11L64s/NyRBGuCQZFKtV1gEwSsE//F1rF8hdcNrJJnwgJMSx5Hmno h921cuTGUr30Qs9y15Fs3VUAZ5jmXE9r9LGcrh4TBy2ebwHo0qPyaNFY4eRQHOJ9vK+b kb4Nh8KgFOlfQs60C+rjva5JxGzt4BLKUrk9hjCtT4iRDVeCeUCuzA0sMPqjGdrSy00d OW09+qVkoUM09kBuj66ynZbEY9spnfaZ2A1eU01FzTbXbWVCFsw0zT8SFUmzpeypTru2 N8zg== MIME-Version: 1.0 Received: by 10.52.64.234 with SMTP id r10mr9765169vds.39.1332838627308; Tue, 27 Mar 2012 01:57:07 -0700 (PDT) Received: by 10.220.39.8 with HTTP; Tue, 27 Mar 2012 01:57:07 -0700 (PDT) In-Reply-To: References: <4F7175DC.5040804@gmail.com> Date: Tue, 27 Mar 2012 10:57:07 +0200 Message-ID: Subject: Re: Schema advice/help From: "R. Verlangen" To: user@cassandra.apache.org, mac.miklas@gmail.com Content-Type: multipart/alternative; boundary=20cf307ac775ec749c04bc35ac5b X-Gm-Message-State: ALoCoQkegMUwMp5GKYndvAl4hI74MKG/ZHPPAuTQteJlT10aSVddZvjq0cDV6kEx8SC3k883WBEO --20cf307ac775ec749c04bc35ac5b Content-Type: text/plain; charset=ISO-8859-1 You can just get a slice range with as start "userId:" and no end. 2012/3/27 Maciej Miklas > multiget would require Order Preserving Partitioner, and this can lead to > unbalanced ring and hot spots. > > Maybe you can use secondary index on "itemtype" - is must have small > cardinality: > http://pkghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/ > > > > > On Tue, Mar 27, 2012 at 10:10 AM, Guy Incognito wrote: > >> without the ability to do disjoint column slices, i would probably use 5 >> different rows. >> >> userId:itemType -> activityId >> >> then it's a multiget slice of 10 items from each of your 5 rows. >> >> >> On 26/03/2012 22:16, Ertio Lew wrote: >> >>> I need to store activities by each user, on 5 items types. I always want >>> to read last 10 activities on each item type, by a user (ie, total >>> activities to read at a time =50). >>> >>> I am wanting to store these activities in a single row for each user so >>> that they can be retrieved in single row query, since I want to read all >>> the last 10 activities on each item.. I am thinking of creating composite >>> names appending "itemtype" : "activityId"(activityId is just timestamp >>> value) but then, I don't see about how to read the last 10 activities from >>> all itemtypes. >>> >>> Any ideas about schema to do this better way ? >>> >> >> > -- With kind regards, Robin Verlangen www.robinverlangen.nl --20cf307ac775ec749c04bc35ac5b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You can just get a slice range with as start "userId:" and no end= .

2012/3/27 Maciej Miklas <mac.miklas@googlemail.c= om>
multiget would require Order Preserving Part= itioner, and this can lead to unbalanced ring and hot spots.

Maybe y= ou can use secondary index on "itemtype" - is must have small car= dinality: http://pkghosh.wordpress.com/2011/= 03/02/cassandra-secondary-index-patterns/




On Tue, Mar 27, 2012 at 10:10 AM, Gu= y Incognito <dnd1066@gmail.com> wrote:
without the ability to do disjoint column slices, i would probably use 5 di= fferent rows.

userId:itemType -> activityId

then it's a multiget slice of 10 items from each of your 5 rows.


On 26/03/2012 22:16, Ertio Lew wrote:
I need to store activities by each user, on 5 items types. I always want to= read last 10 activities on each item type, by a user (ie, total activities= to read at a time =3D50).

I am wanting to store these activities in a single row for each user so tha= t they can be retrieved in single row query, since I want to read all the l= ast 10 activities on each item.. I am thinking of creating composite names = appending "itemtype" : "activityId"(activityId is just = timestamp value) but then, I don't see about how to read the last 10 ac= tivities from all itemtypes.

Any ideas about schema to do this better way ?





--
= With kind regards,

Robin Verlangen
www.robinverlangen.nl
--20cf307ac775ec749c04bc35ac5b--