IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New See what Scott said
There are multiple strategies for storing a tree in a relational database. Each results in some operations being much easier on the database than others. Which one you'll want to do depends strongly on what you'll be doing with the data.

In particular the "nested set-trees" implementation makes insertions expensive, but reads cheap. The naive "each child points at its parent" implementation makes insertions cheap, but reads expensive. Unless you have a database with extensions specifically for this job (I think that Oracle introduced that in 9i), you'll probably have to do some mix of procedural and relational logic to access the data.

Cheers,
Ben
To deny the indirect purchaser, who in this case is the ultimate purchaser, the right to seek relief from unlawful conduct, would essentially remove the word consumer from the Consumer Protection Act
- [link|http://www.techworld.com/opsys/news/index.cfm?NewsID=1246&Page=1&pagePos=20|Nebraska Supreme Court]
New Before 9i
At least 8.1.6, IIRC, possibly before then.

The Oracle extension (CONNECT BY seems to ring a bell) does not work with joins, so everything has to be in the same table.

For small hierarchies, or for insertions into the rightish side of the tree (like most forum posts),the nested set tree is not that expensive at all.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I don't use it, so I wouldn't know. Correction appreciated.
To deny the indirect purchaser, who in this case is the ultimate purchaser, the right to seek relief from unlawful conduct, would essentially remove the word consumer from the Consumer Protection Act
- [link|http://www.techworld.com/opsys/news/index.cfm?NewsID=1246&Page=1&pagePos=20|Nebraska Supreme Court]
     How to store a tree structure in a relational db? - (bluke) - (20)
         Ask Bryce! - (folkert) - (1)
             wiki links - (tablizer)
         Which database engine? - (admin) - (2)
             Re: Which database engine? - (bluke) - (1)
                 CONNECT BY is out then. :-) - (admin)
         why not store it in a document - (boxley) - (1)
             We want to move away from LDAP ... - (bluke)
         Just use Windows Server 2003 and Active Directory! - (pwhysall) - (1)
             **thwak!** -NT - (jb4)
         See what Scott said - (ben_tilly) - (2)
             Before 9i - (admin) - (1)
                 I don't use it, so I wouldn't know. Correction appreciated. -NT - (ben_tilly)
         Re: How to store a tree structure in a relational db? - (johnu) - (7)
             AKA Nested Set Trees. :-) -NT - (admin) - (6)
                 After reading about nested sets ... - (bluke) - (5)
                     Updates aren't an issue. - (admin) - (3)
                         If I had to do it over.... - (ChrisR) - (2)
                             That's exactly how I do it. - (admin) - (1)
                                 Guess I'll have to try it for myself - (ChrisR)
                     We have a lot of inserts - (bluke)

My days of not taking you seriously are certainly coming to a middle.
46 ms