Hierarchical Data in a Database MySql / PHP

  • adi_daniel
  • Born
  • Born
  • adi_daniel
  • Posts: 2

Post 3+ Months Ago

Hi guys,

I need a bit of help creating a structure model to store hierarchical data in a database.
My project is website to store favorite links online.
My structure shoul look like:

----- USER 1
------------- Link Category 1
------------- Link Category 2
------------------ Sub Link Category 1
------------------------ Sub Sub Link Category 1
------------------------ Sub Sub Link Category 2
------------------ Sub Link Category 2
------------- Link Category 3
----- USER 2
------------- Link Category 1
------------- Link Category 2
------------------ Sub Link Category 1
------------------------ Sub Sub Link Category 1
------------------------ Sub Sub Link Category 2
------------------ Sub Link Category 2
------------- Link Category 3

Can you please advise which is the best approach solution as the database may be quite big and will have frecvent updates.

For tables I want to use Innodb engine. If you have other sugestion please say.

Thank you!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

The simplest method is to assign each category a parent category id with top level categories having a parent of 0.

Why do you want to use Innodb tables? Do you know what that means and what the other options are?
  • adi_daniel
  • Born
  • Born
  • adi_daniel
  • Posts: 2

Post 3+ Months Ago

hi and thank you for your replay
yes, i was thinking to use Innodb, as I understod is the best way for a big DB and heavy uodated DB.
I only used myisam Db until now so im not very familiar with it. If you have any sugestion please let me know and please help me with de structure.
Thank you
Best regards
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

innodb tables are better for mission critical data because they include a backup mechanism. However, this very same feature makes them much larger than myisam tables. If this is for a very large and complex system, I'm more likely to use myisam tables as I'll surely have some other backup system in place that won't interfere with running services.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 75 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.