LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-06-2004, 02:52 PM   #1
logicdisaster
Member
 
Registered: Jun 2004
Posts: 41

Rep: Reputation: 15
Database design issues


Hi, i'm designing a database and ive kinda run into a design problem and im not sure the best route to take to acheive what i want. I have a database with about 20 tables in it, about 15 of those tables need to have comments available for them, actually each row in the table must havemultiple comments. So say i have a table called hardware and each row stores information about a particular piece of hardware. I need the ability to add mulitple comments to a row(piece of hardware) but this needs to be done on 15 tables. So far my choices are

-create an extra table for every table that i need comments for(bad::to many tables)
-create a one table that stores all comments(bad::need to make a table name lookup table, bad design)

Anyone know of a better way to design a universal comment table which can reference a given row in a particular table?
 
Old 08-06-2004, 03:04 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
I think I would go with the second option but not bother with a lookup table to help performance.
 
Old 08-06-2004, 03:06 PM   #3
logicdisaster
Member
 
Registered: Jun 2004
Posts: 41

Original Poster
Rep: Reputation: 15
well then how do i know which row of which table it belongs to? if i have hardware, platform, software, and i need to store multiple comments for each row in those three tables how would i do that?
 
Old 08-06-2004, 03:13 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
You can just store a uid that you know relates to a specific table ie:
hardware=1
software=2

There is no need to actually put this information into a linked table as it is only for a very small amount of choices that can be easily hardcoded.
 
Old 08-06-2004, 04:06 PM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
Maybe I don't understand the issue for 100%, but what about simply adding a column "comments" to each table that need one?
 
Old 08-07-2004, 08:48 AM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
I think the idea is that each row in the "hardware" table could have any number of comments. Adding an extra field is fine when their is one comment per row, but if a row has 1000 comments you wouldn't want 1000 extra fields.
 
Old 08-07-2004, 10:52 AM   #7
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 459

Rep: Reputation: 58
Option 1. Create an extra table .. why is it bad? After all 15 tables become only 30. It would seem that it is the more logical thing unless all comments are equal (ie a comment in table 1 needs to be joined with a comment in table 2 ..etc).

If you never want to analyse comments across the 15 base tables, then the clear advantage of option 1 is that since there are 15 tables, there is a lesser chance of it becoming a hot spot with respect to accesses and hits.

The other advantage is that its neater.

End
 
  


Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux for Graphic Design, web design, and publishing maelstrom209 Linux - Software 8 07-17-2011 11:35 AM
a good book for relational database design? nocturna_gr General 3 11-20-2004 08:14 AM
More database design issues logicdisaster Programming 7 08-11-2004 04:52 PM
web database design issues spyghost Programming 3 08-29-2003 05:55 PM
Database Design Question oulevon Programming 4 09-12-2001 04:38 PM


All times are GMT -5. The time now is 04:40 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration