Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple databases vs a single database

I'm looking at an existing site and they are using separate databases. The databases seem to be setup in the following manner:

  • general types (user_type, language, age, etc)
  • member data (registration information & login)
  • site configuration

Personally, I would put everything into 1 database. To me this would make it easier than almost always having to put the database name in front of every table.

I can see from a security perspective ensuring that people cannot access the wrong data by accident, but on this site there are going to be admins (about 10% of the users on the site) that will need to access all the databases, doing cross database searches.

What could be the reasons for doing separate databases? (The site is in PHP & MySQL.)

Edit: The names of the db are:

  • sitename (the actual site name) (general types)
  • member (member data)
  • siteconfig (site configuration)
like image 345
Darryl Hein Avatar asked Nov 12 '08 02:11

Darryl Hein


3 Answers

Purely speculation on what was in the minds of the creators:

Maybe a difference in the volitilaty of the data, so that there could be a different backup/replication strategy for the different physical dbs?

Maybe an idea that say, "general types" could be shared across multiple applications but the "site configuration", for example, would be specific to just one application?

Maybe an idea that the different databases could be put on different pieces of hardware that have different performance characteristics, like their RAID configuration. Data that is read a lot but not updated versus data that is updated a lot.

Again, pure speculation...

@Darryl - my answer is more archeology than technology. I'm not saying I buy any of it. I'm just trying to step into the mindset of the ancestors...

like image 182
Corey Trager Avatar answered Nov 17 '22 20:11

Corey Trager


Also pure speculation: Perhaps it was an architectural decision to support separation of concerns.

like image 1
Daniel M Avatar answered Nov 17 '22 20:11

Daniel M


I can't think of a reason to create multiple databases for the information you listed, especially if that data needs to be cross-linked. It sounds more like someone didn't know how to use permissions so instead of granting access to tables they just created new databases. Just an opinion, but cutting things down to just one database would probably be an improvement.

like image 1
Lando Avatar answered Nov 17 '22 19:11

Lando