If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > DB structure for comment / rating application

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-11, 18:53
Doctor Sup Doctor Sup is offline
Registered User
 
Join Date: Jul 2011
Location: Australia
Posts: 2
Question DB structure for comment / rating application

G'day All,

I am updating my website whereby I wish to add the ability to rate and comment on the products / items. I have never dealt with any SQL database structure of this complexity so any help would be appreciated. My overall focus on efficiency and ease of design and expand-ability obviously.

Firstly, each item has roughly 30 descriptive attributes, so:
- is it OK to store all of these in a single database with product ID or auto-incremented PK? (there may be more than 1000 products)
- this information will be displayed over several tabs grouping like data, should I use one query to pull all the information at once form the db (then simply hiding / unhiding relevant data using CSS) or an AJAX call for each tab.

Secondly,
- In terms of structure should it be something like:
1. users table
2. products table
3. comments table
4. ratings table
or should there be one db per product? or is there a more efficient way of storing this data.

Thank you in advance for any help.
Reply With Quote
  #2 (permalink)  
Old 07-17-11, 01:56
BrianSteffens BrianSteffens is offline
Registered User
 
Join Date: Jul 2011
Posts: 14
- A single database is fine for this. Even with 2000 products and 200 comments/ratings per product, you're looking at 400k records in your largest tables. That's more than reasonable, as long as you look into indexes as things slow down.

- That's really a judgement call. If you expect that most users will click enough tabs to see most of the data anyway, you might as well pull it all down at once to save on the number of queries. If not, the AJAX idea would probably be more efficient by reducing data returned by the database. However, it's unlikely that the difference would be significant in either case unless you're serving tons of users.

- The structure looks fine to me.
Reply With Quote
  #3 (permalink)  
Old 07-17-11, 19:06
Doctor Sup Doctor Sup is offline
Registered User
 
Join Date: Jul 2011
Location: Australia
Posts: 2
Excellent, thank you very much Brian.
Reply With Quote
Reply

Tags
comment, rating, structure

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On