3

How many databases are needed for a social website? I have my tech team working on developing a social site but all their tables are in 1 database. I wanted to create separate table sets for user data, temporary tables, etc and thinking maybe have one separate database only for critical data, etc but I am not a tech person and now sure how this works? The site is going to be a local reviews website.

3
  • I'm no db specialist, so I won't leave an answer but... It shouldn't really matter whether you put 100 tables in one database vs 1 table in 100 databases. The only good reason I can think of to have multiple databases is to separate data that needs to be more secure (password lists) from data that doesn't. Ex. if someone manages a successful sql injection from your media uploader and truncates all the tables, they won't touch the password entries list. Jun 17, 2010 at 23:25
  • 6
    If you by your own admission are "not a tech person and now [sic] sure how this works", what difference does it make how many databases are used?
    – Ken
    Jun 17, 2010 at 23:31
  • Multiple databases on the same instance is moot if a cracker gets account credentials with enough clout. Secure the privileges to the accounts used to access the database.
    – OMG Ponies
    Jun 17, 2010 at 23:58

8 Answers 8

2

This is what happens when management tries to make tech decisions...

1
  • Word of caution: Mark answers like these as being community wiki. Those without humour might downvote you, which your rep isn't affected for community wiki answers (up or down). Otherwise, use a comment.
    – OMG Ponies
    Jun 17, 2010 at 23:54
2

The simple answer, as always, is as few as possible.

The slightly more complicated answer is that once your begin to push the limits of your server and begin to think about multiple servers with master/slave replication then your may want your frequent write tables separated from your seldom write tables which will lower the master-slave update requirements.

1

If you start using seperate databases you can also run into an with you backup / restore strategy. If you have 5 databases and backup all five, what happens when you need to restore one of them, do you then need to restore all five?

I would opt for the fewest number of databases.

1

The reason you would want to have multiple databases is for scaling-out to multiple machines. In the context of a "social application" where large volume / high availability is a concern. If you anticipate the need to scale out to multiple machines to handle high volumes then the breakout of tables should be those that logically need to stay together.

So, for example, maybe you want to keep tables related to a specific subject area (maybe status updates) together in one database and other tables that are related to a different subject area (let's say user's picture libraries) together in a different database.

There are logical and performance reasons to keep tables in separate physical or logical databases.

0

What is the reason that you want it in different databases?

You could just put all tables in one database without a problem, even with for example multiple installations of an open source package. In that case you can use table prefixes.

0

Unless you are developing a really BIG website, one database is the way to proceed (by the way, did you consider the possible issues that may raise when working with various databases?).

If you are worried about performance, you can always configure different tablespaces on several storage devices in order to improve timings.

If you are worried about security, just increase it (better passwords, no direct root login, no port forwarding, avoid tunneling, etc.)

0

I am not a tech person only doing the functional analysis but I own the project so I need to oversee the tech team. My reason to have multiple database is security and performance.

Since this is going to be a new startup, there is no money to invest into strong security or getting the database designed flawless. Plus there are currently no backup policies in place so: 1) I want to separate critical data like user password/basic profile info, then separate out user media (photos they upload on their profile) and then the user content. Then separate out the system content. Current design is to have to layers of tables: Master tables for entire system and module tables for each individual module. 2) Performance: There are a lot of modules being designed and this is a data intensive social site with lots of reporting / analytic being builtin so lots of read/writes. Maybe better to distribute load across database based on purpose?

Since there isn't much funding hence I want to get it right the first time with my investment so the database can scale & work well until revenue comes in to actually invest in getting it right. Ofcourse that could be maybe 6 months away and say a million users away too.

Oh & there is plan to add staging/production mode also so seperate or same database?

2
  • Thomas, instead of giving an "answer", you should edit your own question, adding the extra information. Jun 18, 2010 at 1:07
  • 1
    If you can't afford "strong security" or backups, multiple databases aren't going to help you. When a social website loses all of a user's data except their login and password, they're not coming back. And get used to getting it wrong the first time, because the smartest minds in the world can't predict performance of complex systems. The good news is that, unless you're getting a new user every 15 seconds, you're not going to hit 1M users in 6 months -- you have way more time than that. :-)
    – Ken
    Jun 18, 2010 at 3:55
0

You'll be fine sticking with using one database for now. Your developers can isolate/seperate application data by making use of database schema. Working with multiple databases can quickly become a journey through a world of pain and is to be avoided unless its absolutely crucial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.