incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toby DiPasquale <t...@cbcg.net>
Subject Re: Model to store biggest score
Date Wed, 17 Mar 2010 16:13:49 GMT
On Wed, Mar 17, 2010 at 12:10 PM, Brandon Williams <driftx@gmail.com> wrote:
> On Wed, Mar 17, 2010 at 11:05 AM, Richard Grossman <richiesgr@gmail.com>
> wrote:
>>
>> Thanks, But what do you mean by ?
>>
>>> pack a random integer after the score (so the sort order is maintained)
>>> in big endian format and only examine the first 8 bytes of the column upon
>>> retrieval.
>>> -Brandon
>>
>> Do I need to take the score and add like -number like 100-1, 100-2, 100-3
>> etc... to prevent collision ?
>> Thanks
>
> You have the score, which you pack in  big endian format, resulting in 8
> bytes.  Then you generate a complete random number and pack it in big endian
> format as well, resulting in another 8 bytes.  Now you concatenate the two
> together (with the score first, to maintain sort order) and insert the
> column.  When you retrieve it, you only look at the first 8 bytes to get the
> score since the random number isn't important.
> -Brandon

Couldn't you just use a supercolumn whose keys were the score and the
subcolumns were username:true? Basically using the subcolumns as a
list?

-- 
Toby DiPasquale

Mime
View raw message