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 Re: Which database engine?
A number, for now both MS-SQL and Oracle 9i. The data is configuration data that we display and that the user can change. There are probably more reads then writes, but writes definately need to be fast.
New CONNECT BY is out then. :-)
CONNECT BY is out if you have to support Transact-SQL.

You could use nested set trees, which for small hierarchies are probably fast enough on inserts, or simple parentID columns and some code, which can be considerably slower for reading the entire tree. A third method, encoding the path to the node with the node itself, limits the depth you can represent (not an issue if you have shallow trees) and requires string compares for lookups.

With a nested set tree, simple updates will be just as fast as any keyed update would be. Only inserts, deletes, and rare operations like moves are slower, and then only when you are manipulating the left side of the tree. I use a hybrid here, as finding the immediate children/ancestor only of a node can be problematic with a pure nested set.

If you want some example code, I have both Transact-SQL and plpgsql (Postgres, similar to PL/SQL).
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
     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)

Enthusiasm substituting for real talent.
66 ms