Reply
Problems with this design?
Old 11-07-2009, 04:43 PM Problems with this design?
Junior Talker

Posts: 1
Trades: 0
Hi,
I'm currently working on the db design for web app. I briefly explained my ideas to someone else who said that they were unsuitable for the purpose but didn't have time to go into detail. Can anyone help me work out the problems with my approach and a better way to go about attacking the problem?

I was planning on having a 'base' table called nodes, which contained common data for every record created in the application: eg id, time created, updated. I would then like to use the id number from this table as both a foreign and primary key in other tables. I would also like to use any attribute which is shared by other models in the application as separate tables which simply contain the base id and the value of that attribute.

For example:

Base table:
Code:
id | created_at | updated_at
Page table:
Code:
base_id | content
Title Attribute table:
Code:
base_id | title
The 'Title Attribute' table could then be used to contain the titles of anything that required a title (if a title is an optional attribute, a record is simply not created in the table). For example, a diary event may require a title, and that could simply be put into the same table and linked to a different model via the foreign base id.

A simple outer join could then be used to retrieve all of the necessary information whenever needed.

It seems logical to me to share attributes between different models rather than repeating them in each table.

I realise this would require more overhead when inserting and performing select queries, but would it not also reduce redundant data, if certain properties are not required? Also, using InnoDB would enable me to remove the entire record by simply deleting the base record and using cascade.

Any advice and tips, opinions and constructive criticism will be greatly appreciated.

Thanks.
MagicMoose is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-10-2009, 05:38 AM Re: Problems with this design?
mtishetsky's Avatar
King Spam Talker

Posts: 1,166
Name: Mike
Location: Mataro, Spain
Trades: 0
Are you going to have several millions of records in your DB? Even if you are, rows of fixed length with title in content in single table will perform much more better than join of two separate tables.
__________________
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Problems with this design?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.10373 seconds with 13 queries