views:

40

answers:

2

I am creating a social network and want to have a similar photo gallery to that of facebook. Im guessing I need to use AJAX but I would like to have a comments section for each photo. I was just wondering what the best way would be to design a database around this. Do I just make a table of comments? Would I run into performance issues because Im sure each user would have more than one photo, so the contents tables will get pretty large. Supposing I had 10 million users and each had a 100 photos that with two comments each that would be 2 billion entries and that is only 10 million users, what would happen if that number grew. This would greatly slow down the website. I know for now I can just develop something simple like one table but I would like to create something fast and be knowledgeable for the future. If someone could help me out with this I would be greatly appreciated.

+2  A: 

If you have 10 million users, you'll have the money to buy more resources to handle the requests :)

I would design a table with the comments, and another for the photos. The two tables are of course joined with a one-to-many relationship.

A good, properly configured, RDMBS won't care to store and select photos along with the comments. That's the db job, don't worry.

vulkanino
A: 

If your going to be handling 10 million users with photos, you need to be looking at designing your system properly, bandwidth, hosting, diskspace etc. Get a professional in.

Have a look for some open source asp.net application that do something similar to what your after and learn from them.

Cheers Tigger.

Tigger