On Nov 19, 12:23 pm, Marnen Laibow-Koser <[email protected]> wrote:

>
> Hell no!  acts_as_tree should be avoided at all costs.  The adjacency
> list model that it uses is simple, naïve, and inefficient: each level of
> the tree requires a separate query (unless you're using Oracle, which
> has a proprietary extension to its SQL that fixes this).
>
> What you want instead is a *nested set* or *nested interval* structure
> (do a Web search for articles on how these work).  These allow retrieval
> of an entire tree, to arbitrary depth, with a single query.  Rails
> plugins exist for both.  acts_as_nested_interval was buggy last time I
> used it, but has probably been fixed by now.  awesome_nested_set lives
> up to its name.
>

Although nested sets make inserts very expensive. Like most data
modelling questions, the sort of access patterns that will be used -
while acts as tree makes getting a whole subtree expensive, if you
never need to do that in your app, who cares?

Fred
>
>
> > --
> > Cheers,
> > Bala
> > RoR Developer Now Available for Hire
>
> The fact that you're recommending acts_as_tree means that people ought
> to think twice about hiring you...
>
> Best,
> -- 
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
>
> Sent from my iPhone
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to