2

I would like to create a db schema to represent folder structures created by each user.

For example:

My Documents
 -- My Pictures
 -- My Videos
    -- Summer Holidays

So the most easiest way I could think about is just create a table named:

folder_structure containing:

id,user_id,folder_name,parent_id,child_id

Thinking about that each user could create many folders this table would explode and I am not sure about the performance.

Is there any better way of storing this kind of data? I was thinking about storing it document-based (nosql) maybe for each user...

Thank you for your help!

zer02
  • 3,963
  • 4
  • 31
  • 66
  • 1
    Unless you expect several million entries, using this should be ok(and you can still limit the amount of folders someone is allowed to create). I just wonder what child_id is good for. – René Aug 31 '12 at 07:41
  • How many folders will each user have in average? I'm sure this structure is ok. Also i think that child_id field will not work because there are a lot of children in each folder. – Mikhail Payson Aug 31 '12 at 07:44
  • @Rene Geuze I didn't read your question before I wrote mine :) – Mikhail Payson Aug 31 '12 at 07:45
  • Hey thanks for your replies. There will be millions of entries :) Running on mysql galera cluster. – zer02 Aug 31 '12 at 07:49
  • [This might be of help](http://stackoverflow.com/questions/192220/what-is-the-most-efficient-elegant-way-to-parse-a-flat-table-into-a-tree) – N.B. Aug 31 '12 at 08:02
  • I can't see either a reason or a purpose for the `Child_ID` entry. – podiluska Aug 31 '12 at 09:46

0 Answers0