To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 2363
2362  |  2364
Subject: 
Re: A heirarchical database question
Newsgroups: 
lugnet.off-topic.geek
Date: 
Thu, 16 Nov 2000 20:11:24 GMT
Viewed: 
350 times
  
In lugnet.off-topic.geek, Jim Hughes writes:
would be the best way to describe it in a DB table? Would this work OK:

-----------------------------------
Big table of Themes

theme_parent (varchar)
theme_name (varchar)
theme_child(varchar)  <-- this is actually a GRANDCHILD of the theme_parent!!
-----------------------------------

You don't want to use both parent and (grand) child in the same table. It
won't work, or it will introduce unneeded redundancy.

You can either model hierarchy in the same table that you keep the rest of
the theme data in, in which case, use a parent link from the theme upwards
(and no child, else you are saying that all themes have only one child)....
or you can model this in a separate relation table.

In that case, keep both the parent and child (in this case it's a child, not
a grandchild) in that separate table.

That makes relation traversal relatively quick. My experience with this in
the past has been that even with deeply nested relations, the performance
hit of having a separate relation table is way offset by the flexibility (it
becomes much easier to reorder the tree)

Keeping full paths in the main table is doable, but introduces overhead and
data redundancy. a query to derive the full path in either organization is
easy to write and runs quite quickly.

(I don't like redundancy in database designs, it causes data staleness and
introduces errors)

++Lar



Message has 1 Reply:
  Re: A heirarchical database question
 
(...) Agreed. But sometimes, the price paid for normalization is too high. It depends on the level of adhoc querying against the data. And the skill level of the developer. Steve (24 years ago, 17-Nov-00, to lugnet.off-topic.geek)

Message is in Reply To:
  A heirarchical database question
 
Hi: Here is a question for the DB experts: Say you had some data that was heirarchical, e.g. a list of Lego Themes: -- System ----- Aquazone ---...--- Aquasharks What would be the best way to describe it in a DB table? Would this work OK: ---...--- (...) (24 years ago, 15-Nov-00, to lugnet.off-topic.geek)

6 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR