Jump to content

Db structure, is this overkill?


skulk

Recommended Posts

Planning on starting a review website using tags. After a little research read that you should have 3 tables to optimaly use tabs (true?). So I took that a couple of steps forward and decided to put everything into new tables, since all the fields (editor review, user review and data) will be quite big. So I figured if everything was in one table, it would really have rubbish performance. Did I take it too far? Or is it the correct way? Total number of (main_name) fields will be a couple of hundered. Shouldn't cross 1000, does that change anything?

Proposed structure is as follows:

main

id

name

location

 

map

id

main_id

tag_id

editor_id

userrev_id

data_id

 

tag

tag_id

name

 

editor

editor_id

review

 

userrev

userrev_id

user

rating

review

 

menu

data_id

data

 

Link to comment
Share on other sites

I'm not entirely sure about the exact implementation you are looking to use in your database, as I'm not entirely sure why you've set them up that way, but here is how you properly use tags with three tables.

 

taggables

id

...

 

tags

id

name

 

taggables_tags

taggable_id

tag_id

 

What this does is let you reuse tags on multiple 'taggables', or in other words it is a many-to-many relationship.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.