This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Miscellaneous » Recursive Table Structure
Recursive Table Structure [message #67597] Fri, 12 December 2008 19:13 Go to next message
Mindphreaker  is currently offline Mindphreaker
Messages: 151
Registered: December 2008
Location: Austria
Senior Member
Good evening.

I just brood about a recursive table structure in MySQL. I want to create a database model that represents a folder structure like the folder structure of an OS:
Root
-Folder1
 -Subfolder1
 -Subfolder2
-Folder2
 -Subfolder1


I had the idea to realize the hirarchy with something like this:

Folder
folder_id
topfolder_id

What do you think. Is that a good approach or does anyone have a better idea / solution?

Regards, Alex


See my favourite websites!

Complexity is relative. Relativity is complex. - Anonymous
Anyone who can give you orders can stop you from solving whatever problem you're being fascinated by. - Eric. S. Raymond
Re: Recursive Table Structure [message #67600 is a reply to message #67597 ] Fri, 12 December 2008 19:47 Go to previous messageGo to next message
wissl  is currently offline wissl
Messages: 447
Registered: March 2008
Location: Germany
Faithful Member
It depends a little bit on the depth of the tree and the specifications, but do you know the concept of nested sets?

This might help also:
http://dev.mysql.com/tech-resources/articles/hierarchical-da ta.html

Re: Recursive Table Structure [message #67602 is a reply to message #67597 ] Fri, 12 December 2008 20:13 Go to previous message
Mindphreaker  is currently offline Mindphreaker
Messages: 151
Registered: December 2008
Location: Austria
Senior Member
Oh, thanks for the hint. That was new for me.

But it seems that the update / add / delete process is a load intensive thing which isn't very good.

I think I will try my first idea combined with a limit of recursive depth. That should solve it and bring the needed performance.


See my favourite websites!

Complexity is relative. Relativity is complex. - Anonymous
Anyone who can give you orders can stop you from solving whatever problem you're being fascinated by. - Eric. S. Raymond
Previous Topic:Apache Tapestry Creator to Speak on Clojure, Tapestry 5
Next Topic:Problems with SVN and database configuration
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software