Lets start with something quick and simple, all standard Column Families…

Visitant CF
key: id 
column name: property name
column value: property value 

Visitant Sessions CF
key: visitant id 
column name: session id
column value: none

Session CF

key: session_id
column_name: property value 
column_value: property value 

key: session_id/requests
column_name: request_id
column_value: none

key: session_id/events
column_name: event_id
column_value: none

Requests CF

key: request_id
column_name: property name
column_value: property value

Event CF

key: event_id
column_name: property name
column_value: property value


Notes:

* assuming the Visitant CF is slowing changing i kept it in it's own cf.  
* using compound keys to keep information related to sessions in the same CF. 
These could be diff CF's,or in the Request or Event CF. 
* the best model is the one that allows you to do your reads by getting one or 
a few rows from a single cf. 
* you could collapse the Request and Event CF's into one. 

If the event and request data is immutable (or there is no issues with 
concurrent modifications) I would recommend this…

Request / Event CF:

key: session_id/events or session_id/requests
column_name: event_id or session_id
column_value: data
 

Start with the simple model and then make changes to better handle your read 
queries.
 
Have fun :)

 

-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 22/08/2011, at 11:13 PM, Helder Oliveira wrote:

> Hello all,
> 
> i have a SQL structure like this:
> 
> Visitant ( has several properties )
> Visitant has many Sessions
> Sessions ( has several properties )
> Sessions has many Requests ( has several properties )
> Sessions has many Events ( has several properties )
> 
> 
> i have read a lot and still confused how to put this on cassandra, can 
> someone give me a idea ?

Reply via email to