Disclaimer: I'm the author of django-treebeard

> I am glad to hear that the naive way could possibly fit my 3-levels
> tree, or at least that it deserves a try. I'll have some benchmarks as
> you suggest.

You can look at the treebeard benchmarks in
http://django-treebeard.googlecode.com/svn/docs/index.html#module-tbbench

I'll take as an example the results of reading branches in postgresql
8.3 in unordered trees:

 - Nested sets:        5840ms
 - Materialized Path:  7132ms
 - Adjacency List:    50682ms

So as you can see, your approach (adjacency list) is by far the
slowest.

The only advantage of the adjacency list model is for trees that are
mostly write-only, look at the benchmark results for insertions in an
ordered tree with transactions (the optimal use for AL trees):

 - Nested sets:       10941ms
 - Materialized path:  3942ms
 - Adjacency List:      896ms

So the usual recommendation is:

 - if you're going to insert a lot more than you read, use adjacency
list
 - if, as is the most common case, you're going to read your tree more
than you insert nodes, use nested sets or materialized path

-tabo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to