Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use multiple databases vs multiple tables

So I've been working on a project where I have lots of data. In some collections of data, there are parts of data that link to other collections of data as in relational databases.

However, I am confused over whether I should use multiple databases or multiple tables. I've tried to find out, and answers from Quora helped - from what I understand, if I have collections of data that link together, I should use one database containing multiple tables (these tables would link together).

If my understanding is correct, then how far is this practice appropriate? For example, would it still be okay if you had over 20 tables in one database? Would you use one

Also, when would you use different databases if you can put everything in one database containing multiple tables?

I hope this question isn't too vague or anything, but I could not find clear answers that explain the purposes of each and therefore why you would use multiple databases over multiple tables or vice versa.

like image 224
Farbod Salamat-Zadeh Avatar asked Jun 20 '16 09:06

Farbod Salamat-Zadeh


1 Answers

20 tables in one database is nothing - hundreds of tables are not unusual. Try to keep logically related information together and unrelated information separate. Try to avoid multiple databases or tables with the same design or purpose.

Multiple database apps are usually apps which have their own data requirements but also have to integrate with another existing app or service's database.

like image 177
reaanb Avatar answered Oct 09 '22 14:10

reaanb