Recommendations with hierarchical data on non-relational databases?

Posted by Luki on Stack Overflow See other posts from Stack Overflow or by Luki
Published on 2011-01-08T14:08:02Z Indexed on 2011/01/08 14:53 UTC
Read the original article Hit count: 223

I'm developing an web application that uses a non-relational database as a backend (django-nonrel + AppEngine). I need to store some hierarchical data (projects/subproject_1/subproject_N/tasks), and I'm wondering which pattern should I use. For now I thought of:

  • Adjacency List (store the item's parent id)
  • Nested sets (store left and right values for the item)

In my case, the depth of nesting for a normal user will not exceed 4-5 levels. Also, on the UI, I would like to have a pagination for the items on the first level, to avoid to load too many items at the first page load.

From what I understand so far, nested sets are great when the hierarchy is used more for displaying. Adjacency lists are great when editing on the tree is done often. In my case I guess I need the displaying more than the editing (when using nested sets, even if the display would work great, the above pagination could complicate things on editing).

Do you have any thoughts and advice, based on your experience with the non-relational databases?

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about patterns-and-practices