incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Williams <dri...@gmail.com>
Subject Re: Model to store biggest score
Date Wed, 17 Mar 2010 15:43:17 GMT
On Wed, Mar 17, 2010 at 10:38 AM, Richard Grossman <richiesgr@gmail.com>wrote:

> Hi,
>
> I trying to find a model where I can keep the list of biggest score for
> users.
> it's seems simple but I'm stuck here .
> For example user1 score = 10
>                     user2 score = 20
>                     user3 score = 30
>
> Query: Top score (2) = user3, user2
> If someone have made something similar thanks for sharing
>

You can use a LongType column where the column name is the score and the
value is the user.  However, two users with the same score will collide.
 One way to get around this is to use a BytesType and 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

Mime
View raw message