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 0FC989EFD for ; Tue, 27 Mar 2012 08:51:54 +0000 (UTC) Received: (qmail 48278 invoked by uid 500); 27 Mar 2012 08:51:51 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 48262 invoked by uid 500); 27 Mar 2012 08:51:51 -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 48253 invoked by uid 99); 27 Mar 2012 08:51:51 -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:51:51 +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 (nike.apache.org: domain of mac.miklas@googlemail.com designates 209.85.214.172 as permitted sender) Received: from [209.85.214.172] (HELO mail-ob0-f172.google.com) (209.85.214.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 08:51:45 +0000 Received: by obbtb4 with SMTP id tb4so7386105obb.31 for ; Tue, 27 Mar 2012 01:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=sLstDB5x5vGWJiROLs96y4iLNOeA/MaYhAV23SBFF9g=; b=TinhnoWA3Sw/n/TspoYV4hlaMSvb0YtGruguOY4NAfRlDCc94VsB4w3Y+dIR9Alitz oHliY1B17uORAi+vgcLgP+7xxEAzIOlARAqSyAuvPG3Ptrm4+iiiXSZvc+HXglj5UuEM EEF8Ye5VL6NtAPmPHp0n23PWl4YNc8dzb++UhycdxvlTeHDQfN8oIP0Dp4zzKgYZYQD6 Q8I5sH1GwtjM3qBcI3lqGPbFzWLujJRYvCCLuCSFIWkgkiM2Gq1O+PVc+gRWfcBJR7Rd VxbpU3J2pRy2ZiZJR/+ffrK2PhAJVqeJBvfrz/Auwzl/dMqm6ZyGfg72b8OMPVryBejC 4wjQ== MIME-Version: 1.0 Received: by 10.60.13.37 with SMTP id e5mr22321900oec.70.1332838284293; Tue, 27 Mar 2012 01:51:24 -0700 (PDT) Received: by 10.182.121.10 with HTTP; Tue, 27 Mar 2012 01:51:24 -0700 (PDT) Reply-To: mac.miklas@gmail.com In-Reply-To: <4F7175DC.5040804@gmail.com> References: <4F7175DC.5040804@gmail.com> Date: Tue, 27 Mar 2012 10:51:24 +0200 Message-ID: Subject: Re: Schema advice/help From: Maciej Miklas To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=e89a8fb1f3507a776c04bc359863 --e89a8fb1f3507a776c04bc359863 Content-Type: text/plain; charset=UTF-8 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 ? >> > > --e89a8fb1f3507a776c04bc359863 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable multiget would require Order Preserving Partitioner, and this can lead to u= nbalanced ring and hot spots.

Maybe you can use secondary index on &= quot;itemtype" - is must have small cardinality: http://p= kghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/



On Tue, Mar 27, 2012 at 10:10 AM, Gu= y Incognito <dnd1= 066@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 ?


--e89a8fb1f3507a776c04bc359863--