Forum Moderators: coopster

Message Too Old, No Replies

Database Stucture Help

         

ScottYardley

7:17 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



For lack of finding a DB forum, I'm posting here.

I'm building a directory and am settling on what database design to use. I noticed that yahoo includes their directory structure in their path instead of just referring to a directory ID. For SEO reasons I want to do this also.

Now this makes me wonder how yahoo structures its database. Does it include the whole directory path into one field?
This sees too bulky to me.
Or does Yahoo explode the the url path and and use some advance sql gymnastics to loop through parent to child directories.
I'm guessing the latter is the case. If so, does anyone have a clue how to structure and query such a database design?

dmorison

6:27 pm on Jan 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Scott,

Large and busy directories will almost without exception be served out from static pages (or more likely included static pages within a higher level dynamic "My Yahoo!" style script) that have been generated in a background process from the database that holds the source data for the directory.

As for your database structure, search on "Modified Preorder Tree Traversal" for ideas on how to structure your hierarchy for efficiently working out the path to a node etc.

As for storing directory entries at nodes; the "straight forward" way to do it would be to simply store the node ID in your directory entries table. If nodeID is indexed then selection will be extremely fast.

ScottYardley

3:56 pm on Feb 24, 2005 (gmt 0)

10+ Year Member



dmorison,

Wow, I think that that was the best piece of programming adivce I receive this year.

I will definately implement the "Modified Preorder Tree Traversal" approach in future code.
I'm tempted to rewrite some of my old stuff.

ironik

12:16 am on Feb 25, 2005 (gmt 0)

10+ Year Member



Yeah, I'll have to second that. I've always used the adjacent method. I've just spent the last hour or so re-writing a class that manages my CMS's category listings thanks to your great advice!

hiker_jjw

12:39 am on Feb 25, 2005 (gmt 0)



Look at using "On-The-Fly" content generation, using a combination of PHP and Apache Mod-Rewrites. The combination can be very sucessful for high trafic directories.

Cheers,
Jeff