Another beginner needs advice..

Reply

Join Date: May 2007
Posts: 2
Reputation: ivanfx is an unknown quantity at this point 
Solved Threads: 0
ivanfx ivanfx is offline Offline
Newbie Poster

Another beginner needs advice..

 
0
  #1
May 1st, 2007
Hello,
I'm new to the forum so please give a hand
I've been working with php/MySQL for about 6 months, just trying out new stuff and so, but now I feel ready to build a REAL site!

I'd like to make one of those community sites where everyone has their profile, personal messages, gallery (with tags and gallery folders), a blog and a list of people that viewed the users profile / list of profiles that the user viewed.

What's bugging me is the DB design. Should I:

A) Make a few GLOBAL tables (e.g. gallery, image_list, user_list, viewed_profiles, blog, tags..) in which I would store the info of EVERY user (indentified by their ID), or

B) Make all of the tables mentioned above (e.g. gallery, image_list, user_list, viewed_profiles, blog, tags and so on) for every user INDIVIDUALY (e.g. user John would have tables: john_gallery, john_blog, john_tags).

I'm asking this because I'm worried about speed. What if the site has 10 000 or more users?
In case A that would mean having millions of messages in a single table and being very slow.
In case B I will probbably end up with hundreds of thousands of tables in my DB.

Or is there a solution C?

Help
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 1
Reputation: amitdatt is an unknown quantity at this point 
Solved Threads: 0
amitdatt amitdatt is offline Offline
Newbie Poster

Re: Another beginner needs advice..

 
0
  #2
May 2nd, 2007
Originally Posted by ivanfx View Post
Hello,
I'm new to the forum so please give a hand
I've been working with php/MySQL for about 6 months, just trying out new stuff and so, but now I feel ready to build a REAL site!

I'd like to make one of those community sites where everyone has their profile, personal messages, gallery (with tags and gallery folders), a blog and a list of people that viewed the users profile / list of profiles that the user viewed.

What's bugging me is the DB design. Should I:

A) Make a few GLOBAL tables (e.g. gallery, image_list, user_list, viewed_profiles, blog, tags..) in which I would store the info of EVERY user (indentified by their ID), or

B) Make all of the tables mentioned above (e.g. gallery, image_list, user_list, viewed_profiles, blog, tags and so on) for every user INDIVIDUALY (e.g. user John would have tables: john_gallery, john_blog, john_tags).

I'm asking this because I'm worried about speed. What if the site has 10 000 or more users?
In case A that would mean having millions of messages in a single table and being very slow.
In case B I will probbably end up with hundreds of thousands of tables in my DB.

Or is there a solution C?

Help
Just wondering if you could squeeze this in lesser number of tables. eg: put the user info in table-1 - (id / name / address / profile details / main picture ref etc), put optional images in table-2, thread details in table-3 and so on..

Dont forget to normalise the tables though.

Hope this helps!
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 146
Reputation: Stylish is an unknown quantity at this point 
Solved Threads: 14
Stylish's Avatar
Stylish Stylish is offline Offline
Junior Poster

Re: Another beginner needs advice..

 
0
  #3
May 6th, 2007
There is no need to give each user their own table. 10,000 users would mean 10,000 tables. That sounds ugly to manage.

Also, big tables are nothing to fear. Proper indexing and crafted queries can reduce a lot of performance issues.
Last edited by Stylish; May 6th, 2007 at 5:56 pm. Reason: indexes
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,144
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Another beginner needs advice..

 
0
  #4
May 6th, 2007
yes, having too many tables causes issues with MySQL (i think there is some sort of performance barrier)
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 38
Reputation: matale is an unknown quantity at this point 
Solved Threads: 1
matale matale is offline Offline
Light Poster

Re: Another beginner needs advice..

 
0
  #5
May 7th, 2007
option A for sure
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: ivanfx is an unknown quantity at this point 
Solved Threads: 0
ivanfx ivanfx is offline Offline
Newbie Poster

Re: Another beginner needs advice..

 
0
  #6
May 8th, 2007
Thanks! I'll post a link once I finish the site!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: Another beginner needs advice..

 
0
  #7
May 12th, 2007
Yes, too many tables would be a problem.

I think, there are also few free open source scripts available, get them and study them. In fact a part of scripts for forums such as phpBB will also help you to understand how to solve this problem.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 30
Reputation: sibir1us is an unknown quantity at this point 
Solved Threads: 2
sibir1us's Avatar
sibir1us sibir1us is offline Offline
Light Poster

Re: Another beginner needs advice..

 
0
  #8
Jun 27th, 2007
Dear ivanfx, dont get me wrong, but any given book you pick up, related to databases on the first page it will state that there are 2 types of databases - relational and flat-file. Relational databases are famous for their ability to bring flexible and higly cohesive and loosely coupled solutions to dataflow. Now, think of it this way: in relational database you enter a record once, and you identify it. For example, you have a record for user John, and this record is associated with UserId = 1 (the field name and the value could be anything). From this point on, this user John will be represented as UserId 1 throughout your database. This saves space and time. Hope this helps.
******************
15 minutes of research can save you 50% or more. forum.feodorgeorgiev.com

***Need Web Hosting?
******************
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Database Design Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC