From user-return-10879-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Wed Dec 01 20:44:04 2010 Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 7559 invoked from network); 1 Dec 2010 20:44:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Dec 2010 20:44:04 -0000 Received: (qmail 84023 invoked by uid 500); 1 Dec 2010 20:44:02 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 83988 invoked by uid 500); 1 Dec 2010 20:44:02 -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 83979 invoked by uid 99); 1 Dec 2010 20:44:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Dec 2010 20:44:02 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a52.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Dec 2010 20:43:57 +0000 Received: from homiemail-a52.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a52.g.dreamhost.com (Postfix) with ESMTP id 278916B80E6 for ; Wed, 1 Dec 2010 12:43:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=to:from :subject:date:message-id:content-type:mime-version:in-reply-to; q=dns; s=thelastpickle.com; b=usubHy9t/G4H2Ba0q8lYpeWicE377by72 Jpw6dUf0ypeZvwCFYE5vDcw90uTQE8bfzoAgyym1xajioQdwkP+l05JHB/Mb+NDe 7xjsHv5XxZBrNMVHavyJlTu67W7txffWfdw1r9z29HCcHYp5B2hQU0Gmqwe6oTcB 2yqlJI9taU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=to :from:subject:date:message-id:content-type:mime-version: in-reply-to; s=thelastpickle.com; bh=ULRhvJG3Yrpdaw2E8Hb/Bp0lXg4 =; b=QC2ilJxVQHnLFQmikABHUV7hbCNXjNw98BQVtjvYXOh5rnvd6gHP3pkhyUX 7p3uZI4+ljulhO/qEEKZf3o0NPOj3HvjxgeHDlMFHIIBOSO4i0+sKmrf9ppt7Ynt 0PNFRmK+Qhy9PXUm3Ez++I4WXbaYfzoc7lJ98maklzyas6C0= Received: from localhost (webms.mac.com [17.148.16.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a52.g.dreamhost.com (Postfix) with ESMTPSA id 11F7F6B80C2 for ; Wed, 1 Dec 2010 12:43:34 -0800 (PST) To: user@cassandra.apache.org From: Aaron Morton Subject: Re: Sorted Integer -> UUID Date: Wed, 01 Dec 2010 20:43:33 GMT X-Mailer: MobileMe Mail (1C3207) Message-id: <2f5a841a-e104-4a6f-b129-f8e63b47fee9@me.com> Content-Type: multipart/alternative; boundary=Apple-Webmail-42--3180664e-e150-657b-e92f-862cdb8cc7c9 MIME-Version: 1.0 In-Reply-To: --Apple-Webmail-42--3180664e-e150-657b-e92f-862cdb8cc7c9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Could you use a Super CF?=0A=0ASuper Col name is the Integer, and the Col = Names are the UUID. Not sure what your col values are or your key.=A0=0ATh= ere are some limitations to Super CF but I do not think they would apply i= n this case=A0http://wiki.apache.org/cassandra/CassandraLimitations=0A=0AY= ou can the slice the super col names (your=A0integers) and get back the su= per col and all it's columns.=A0=0A=0AOr you could also use a two CF solut= ion...=0A=0AIndex CF where you integer is the column name, not sure what y= our key is. The column value is not important.=A0=A0=0AItem CF where the r= ow key is the Integer, col names are the UUID not sure what the col value = is.=A0=0A=0ASome things to consider...=0A- is there a natural grouping to = your integers ? e.g. every day=0A- what is the column value ? Will this ma= ke for big rows?=0A=0AHope that helps.=A0=0AAaron=0A=0A=0AOn 02 Dec, 2010,= at 04:56 AM, Daniel Lundin wrote:=0A=0AUnless I misunderst= and the Q, composing the column names with the row=0Akeys and merging the = resulting would yield something useful.=0A=0AkeyA =3D> (1, uuid), (2, uuid= ), (3, uid)=0AkeyB =3D> (1, uuid), (2, uuid), (3, uid)=0A=0AShould be tran= sformed into:=0A=0A(1, keyA, uuid),=0A(1, keyB, uuid),=0A(2, keyA, uuid),=0A= (2, keyB, uuid),=0A(3, keyA, uuid),=0A(3, keyB, uuid)=0A=0Amap + merge to = the rescue.=0A=0AOn Wed, Dec 1, 2010 at 3:33 PM, Benjamin Waldher wrote:=0A> I have a fairly simple problem that might require= a complicated solution.=0A>=0A> I need to store Integer -> UUID in a colu= mn family, and be able to query=0A> (and then paginate) the rows ordered b= y the integer in descending order.=0A> This is simple enough if no two row= s have the same integer, as the integer=0A> could be a column name which c= an easily be sorted. However, in my scenario,=0A> two rows may have the sa= me Integer value. As such, I would need to use the=0A> integer as the key = in the column family. However, this means I must use=0A> OrderPreservingPa= rtitioner, which is going to cause a huge load imbalance on=0A> one of my = nodes.=0A>=0A> How can I have a sorted set of rows of Integer -> UUID wher= e the integer may=0A> exist many times?=0A>=0A --Apple-Webmail-42--3180664e-e150-657b-e92f-862cdb8cc7c9 Content-Type: multipart/related; type="text/html"; boundary=Apple-Webmail-86--3180664e-e150-657b-e92f-862cdb8cc7c9 --Apple-Webmail-86--3180664e-e150-657b-e92f-862cdb8cc7c9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1;
Could you use a Super CF?

Super Col name is = the Integer, and the Col Names are the UUID. Not sure what your col values= are or your key. 
There are some limitations to Super CF b= ut I do not think they would apply in this case http://wiki.apache.org/cassan= dra/CassandraLimitations

You can the slice th= e super col names (your integers) and get back the super col and all = it's columns. 

Or you could also u= se a two CF solution...

Index CF where you intege= r is the column name, not sure what your key is. The column value is not i= mportant.  
Item CF where the row key is the Integer, = col names are the UUID not sure what the col value is. 

=
Some things to consider...
- is there a natural grouping to= your integers ? e.g. every day
- what is the column value ? Wil= l this make for big rows?

Hope that helps. <= /div>
Aaron


On 02 Dec, 2010,at 04:56 AM, = Daniel Lundin <dln@eintr.org> wrote:

Unless I misunderstand the Q, co= mposing the column names with the row
=0Akeys and merging the resulting= would yield something useful.
=0A
=0AkeyA =3D> (1, uuid), (2, uu= id), (3, uid)
=0AkeyB =3D> (1, uuid), (2, uuid), (3, uid)
=0A
= =0AShould be transformed into:
=0A
=0A (1, keyA, uuid),
=0A (1, k= eyB, uuid),
=0A (2, keyA, uuid),
=0A (2, keyB, uuid),
=0A (3, key= A, uuid),
=0A (3, keyB, uuid)
=0A
=0Amap + merge to the rescue.=0A
=0AOn Wed, Dec 1, 2010 at 3:33 PM, Benjamin Waldher <lgbr@lase= rbunny.net> wrote:
=0A> I have a fairly simple problem that might= require a complicated solution.
=0A>
=0A> I need to store Int= eger -> UUID in a column family, and be able to query
=0A> (and t= hen paginate) the rows ordered by the integer in descending order.
=0A&= gt; This is simple enough if no two rows have the same integer, as the int= eger
=0A> could be a column name which can easily be sorted. However= , in my scenario,
=0A> two rows may have the same Integer value. As = such, I would need to use the
=0A> integer as the key in the column = family. However, this means I must use
=0A> OrderPreservingPartition= er, which is going to cause a huge load imbalance on
=0A> one of my = nodes.
=0A>
=0A> How can I have a sorted set of rows of Intege= r -> UUID where the integer may
=0A> exist many times?
=0A>=
=0A
--Apple-Webmail-86--3180664e-e150-657b-e92f-862cdb8cc7c9-- --Apple-Webmail-42--3180664e-e150-657b-e92f-862cdb8cc7c9--