Results 1 to 3 of 3
  1. #1
    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.

  2. #2
    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.

  3. #3
    Join Date
    Jul 2011
    Location
    Australia
    Posts
    2
    Excellent, thank you very much Brian.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •