Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it good to have multiple database running in a same project?

I had read many database design books, but all of them use only one database to deal with a project. But I was wondering that is that a good idea to have multiple database dealing with the same project?

like image 329
LiJung Avatar asked Aug 02 '12 04:08

LiJung


2 Answers

Not really.

There are certainly circumstances where it's required or even desirable, but those are for specific use cases.

In general you don't want to for a combination of relational integrity (difficult to enforce across databases) and transactional integrity. There would have to be a really compelling reason to split the datasets to incur the added complexity and maintenance of a separate database instance.

like image 89
Will Hartung Avatar answered Oct 16 '22 21:10

Will Hartung


Generally, no. However...

Reasons you might want multiple databases:

  1. Different objectives. e.g. OLAP vs OLTP
  2. Different companies, domains or tenants, where you need guarantees that the data between domains will never be commingled.
  3. Data archival.

If none of these conditions apply, you probably don't need multiple databases. Instead, you partition your data by using field id's such as TenantID, CategoryID, etc.

like image 30
Robert Harvey Avatar answered Oct 16 '22 21:10

Robert Harvey