incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Chang <pete...@gmail.com>
Subject Strategies for storing lexically ordered data in supercolumns
Date Thu, 11 Mar 2010 06:54:17 GMT
I'm wondering about good strategies for picking keys that I want to be
lexically sorted in a super column family. For example, my data looks like
this:

[user1_uuid][connections][some_key_for_user2] = ""
[user1_uuid][connections][some_key_for_user3] = ""

I was thinking that I wanted some_key_for_user2 to be sorted by a user's
name. So I was thinking I set the subcolumn compareWith to UTF8Type or
BytesType and construct a key

[user's lastname + user's firstname + user's uuid]

This would result in sorted subcolumn and user list. That's fine. But I
wonder what would happen if, say, a user changes their last name. Happens
rarely but I imagine people getting married and modifying their name. Now
the sort is no longer correct. There seems to be some bad consequences to
creating keys based on data that can change.

So what is the general (elegant, easy to maintain) strategy here? Always
sort in your server-side code and don't bother trying to have the data
sorted?

I'm a cassandra noob with all my experience in relational DBMS.

TIA
Pete

Mime
View raw message