incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S Ahmed <sahmed1...@gmail.com>
Subject Re: key types and grouping related rows together
Date Thu, 15 Jul 2010 15:48:20 GMT
Do you think a composite key using a key type of Bytes would work?

How many bytes can it be?


public static byte [] createRowKey(int websiteid, long stamp)
throws Exception {
  byte [] websiteidBytes = Bytes.toBytes(websiteid);
  byte [] stampBytes = Bytes.toBytes(stamp);
  return Bytes.add(websiteidBytes, stampBytes);
}

So say this key is used in a ColumnFamily that stores Articles for all
websites, using a key like this would allow me to get a range of
articles written, ordered by date, for a specific website correct?



On Thu, Jul 15, 2010 at 9:38 AM, S Ahmed <sahmed1020@gmail.com> wrote:

> Well I'm not talking about a specific column family here, as ALL my column
> families will have content that is specific to a certain website, so I need
> a strategy that I will use on almost all my column families.
>
>
> On Wed, Jul 14, 2010 at 9:20 PM, Schubert Zhang <zsongbo@gmail.com> wrote:
>
>> for your apps, how about this schema:
>>
>> key: website1123
>> columnName: UserID
>> ...
>>
>>
>> On Thu, Jul 15, 2010 at 6:13 AM, Aaron Morton <aaron@thelastpickle.com>wrote:
>>
>>> The key structure you have should group the keys based on the website
>>> There are some differences between range queries with RP and OPP this
>>> article may help
>>>
>>> http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/
>>>
>>> Aaron
>>>
>>>
>>> On 15 Jul, 2010,at 08:44 AM, S Ahmed <sahmed1020@gmail.com> wrote:
>>>
>>> Where is the link that describes the various key types and their impact
>>> on sorting? (I believe I read it before, can't seem to find it now).
>>>
>>> So my application supports multi-tenants, so I need the keys to represent
>>> things like:
>>>
>>> website1123 + contentID
>>>
>>> or
>>>
>>> website3454 + userID
>>>
>>> And for range queries, these keys have to be grouped together obviously.
>>>
>>> What key type would be best suited for this?
>>>
>>>
>>> I might have to create a CF that maps the website and its key prefix?
>>>
>>>
>>
>

Mime
View raw message