Need Database design help for Tree-organized Data

Posts   
 
    
OlafD
User
Posts: 51
Joined: 18-May-2004
# Posted on: 24-Sep-2009 14:56:21   

I would like store linked “Information”- Entities (like a tree) .

There a varying kinds of “Information”- Entities like Text, Web-site links, Pictures, etc, etc etc….(up to 20). Each “Information”- Entity has information for region->location->Street->house (or something similar), called “location properties”. For example, the “location properties” can have region and location information but no street and house information or can have only region information, etc, etc. Each combination of “location properties” can have a root “Information”- Entity.

Each “Information”- Entity have a Parent “Information”- Entity and several Child “Information”- Entities. If the Parent is NULL, the “Information”- Entity is a root “Information”- Entity

“abstract” Information Entity: InformationID integer RegionID integer LocationID integer StreetID integer HouseID integer …. ….

Text Information Entity: TextInformationID integer RegionID integer LocationID integer StreetID integer HouseID integer HeadingText as varchar(xxx) DescriptionText as text …. ….

Should I use inheritance and TargetPerEntityHierarchy? I have no idea how to manage the tree, maybe with a ParentInformationID in the “abstract” Information Entity? One design goal is, to fetch a tree very fast. I would like to store millions of Informations. What database design is here the “best”?

Thank you for helping

Olaf

PS:Sorry for my clipped English.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Sep-2009 21:52:08   

Hi OlafD,

First of all, talk about the tree-mode of your design, you can just create a self-realation on the InformationEntity. That way you can access the parent and childs:

... myInformation.TheParentInformation;
... myInformation.TheChildInformations;

How much levels will you have on this structure and how do you plan query such structure (f.i., in sql) ?

And yes, you can create TargetPerEntityHierarchy for this, as all the data is kept in one single Information table. At this point, just please be aware of the Inheritance limitations and pitfalls.

David Elizondo | LLBLGen Support Team