Re: How to model hierarchical structure?

2010-03-06 Thread Jeff Zhang
use the parent as column family and the child as the column under the column
family if this is two-level.
And you can use the super-column if there are more than two-levels




On Sat, Mar 6, 2010 at 1:31 AM, HubertChang hui...@gmail.com wrote:


 For examples, like tags, many parents to many children.
 --
 View this message in context:
 http://n2.nabble.com/How-to-model-hierarchical-structure-tp4685633p4685649.html
 Sent from the cassandra-user@incubator.apache.org mailing list archive at
 Nabble.com.




-- 
Best Regards

Jeff Zhang


Re: How to model hierarchical structure?

2010-03-06 Thread Jean-Denis Greze
This really depends on the operations you want to optimize for.  What's
important to you?  Aggregate queries?  Finding children/siblings/ancestors?
 Reorganizing the tree/hierarchy?

For Cassandra, you really need to spend time thinking about how you'll be
accessing things and design for that.

If it's a 2-3 level hierarchy, then straight forward approaches like what
Jeff suggested seem logical.

Otherwise, I'd say if you've got an arbitrary-level hierarchy, then you'll
have to think about how to efficiently adapt one of the usual suspects for
this stuff (adjacency lists, nested sets, materialized paths, etc.).  I, for
one, would be interested in knowing if anyone else's experienced with this
kind of stuff in Cassandra.

http://stackoverflow.com/questions/192220/what-is-the-most-efficient-elegant-way-to-parse-a-flat-table-into-a-tree/192462#192462


and the like might be good places to start.

On Sat, Mar 6, 2010 at 2:13 AM, Jeff Zhang zjf...@gmail.com wrote:

 use the parent as column family and the child as the column under the
 column family if this is two-level.
 And you can use the super-column if there are more than two-levels





 On Sat, Mar 6, 2010 at 1:31 AM, HubertChang hui...@gmail.com wrote:


 For examples, like tags, many parents to many children.
 --
 View this message in context:
 http://n2.nabble.com/How-to-model-hierarchical-structure-tp4685633p4685649.html
 Sent from the cassandra-user@incubator.apache.org mailing list archive at
 Nabble.com.




 --
 Best Regards

 Jeff Zhang




-- 
jeande...@6coders.com
(917) 951-0636

This email and any files transmitted with it are confidential and intended
solely for the use of the individual to whom they are addressed. If you have
received this email in error please notify the system manager. This message
contains confidential information and is intended only for the individual
named. If you are not the named addressee you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately by
e-mail if you have received this e-mail by mistake and delete this e-mail
from your system. If you are not the intended recipient you are notified
that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.