in reply to Re: Re: Re: Re^3: Efficiently Walking Large Data Structures Stored in Multiple Tables
in thread Efficiently Walking Large Data Structures Stored Across Multiple Tables

Earlier you wrote, Now, you could build the queries using some module (???), but the queries are very very very slow and very very very difficult to get right. Again, good luck. I wouldn't want to try ... Now you are admitting that you don't have experience to back that dismissal up.

Fine. Based on reported experience I believe that the queries to do nested set trees are somewhat complex, but if you have a guide (eg Joe Celko's implementation) in front of you it is not that hard to get it right. Furthermore in practice they are quite fast to execute. Modifications being more expensive than selects, which is OK since in practical applications (eg a threaded view like discussion sites do) you tend to find that selects are more common.

They have further benefits over any kind of iterative requerying in that the usage pattern fits how relational databases are designed. In particular you eliminate a lot of round trips that stress latency and your query optimizer.

If your situation looks like this, then for all of the apparent complexity, knowing that nested set representations of trees are effective can be a lifesaver. (Quite possibly in a literal sense.)

  • Comment on Re: Re: Re: Re: Re^3: Efficiently Walking Large Data Structures Stored in Multiple Tables

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re^3: Efficiently Walking Large Data Structures Stored in Multiple Tables
by dragonchild (Archbishop) on Feb 29, 2004 at 21:13 UTC
    Fair enough. I spoke before fully evaluating the situation. Now, I think I'm going to try an implementation of nested set trees, just to be able to understand it better. Out of curiousity, is there an implementation of this on CPAN?

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.