incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: Data model
Date Tue, 08 Mar 2011 00:21:16 GMT
No to nesting CF's. 

When creating the data model, it's best to think about how you need to read the data. Denormalise
and group data to work towards getting all the data you need by reading one or more rows from
the same CF. This is not a hard rule, just a guideline I use. 

Without knowing how you need to query the data, here are 3 different approaches to storing
your data.  

1) A standard CF called Calls, use the employ ID/Name as the key and store all data for a
call as a packed data structure in a single column. Use the timestamp for the column name,
or time stamp and account number. You can read back the calls in time order by employee by
slicing the calls CF. (denormalise to support reads)

2) A standard CF called Calls, use a timestamp and account number as the key. Store the data
for the call as a separate columns. Add another CF called EmployeeCalls use the employee name
as the key, and store a column for each call made. To get the calls for an employee first
read the EmployeeCalls CF then the Calls CF.  (use custom secondary indexes)

3) A standard CF called Calls, use a timestamp and account number as the key. Store the data
as separate columns, including ones for employee and account number. Use the built in secondary
indexes http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes 

Sounds like you are just starting out, so I would start playing with option 1. It's the simplest.
Try a few ideas and let us know how you get on.

Hope that helps. 
Aaron

On 8/03/2011, at 1:02 PM, aaron morton wrote:

> Will answer on the user list. 
> 
> Aaron
> 
> On 8/03/2011, at 1:11 AM, Baskar wrote:
> 
>> Does Cassandra allow nesting of column families?
>> 
>> Here is the use case
>> - we need to store calls made by employees
>> - employees are associated with an account
>> - accounts have phone numbers
>> - many calls are made by employees for a given account and phone 
>> 
>> If possible, would like to store call related data against employee. 
>> 
>> Thanks
>> Baskar
> 


Mime
View raw message