Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Tree Structure and Db

by pg (Canon)
on Jul 06, 2005 at 01:38 UTC ( #472658=note: print w/ replies, xml ) Need Help??

in reply to Re: Tree Structure and Db
in thread Tree Structure and Db

As the author stated, this structure is good for trees that are mostly static.

In case the tree can be updated, performance becomes an issue. Even a simple operation as to insert a leaf node, could cause you to insert multiple rows (average number of rows inserted equals average depth of all pathes, and in the worst case, the number of rows get inserted is the length of the deepest path.)

Look at one more operation: to move a subtree to be under a new parent. if you only store the immediate parent-child relationship, you only need to modify 1 row, but if you store all ancestor, you will need to modify multiple rows for each node in the subtree (basically to modify all relationships towards a node that is above the root of the subtree.)

Data integraty could also be an issue, a simple coding mistake can spread dirty data all over the place, not just an isolated spot.

Comment on Re^2: Tree Structure and Db
Re^3: Tree Structure and Db
by ikegami (Pope) on Jul 06, 2005 at 03:00 UTC
    Thanks for expanding on this. I intended to do so, but didn't get get a chance 'til now. That is exactly what I meant by my comment.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://472658]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-07 01:54 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (86 votes), past polls