Alen Alen -3 years ago 112
MySQL Question

mySQL performance one huge database vs small many

I am developing a site that has many subdomains in it.

It has blogging module, management system, and many more. I have shared this question in various sites but couldn't get a proper reply.

Question is should I use one database for all the modules, this means my database would have nearly 100 tables. Is this approach be appropriate or should I create separate database for every module?

Answer Source

Well, it does not really matter.

If you use innodb with single data file (innodb_file_per_table setting is not enabled), then all data will be stored in a single file anyway.

With innodb separate file per table mode or with myisam table engine, the only difference between one or multiple databases is really the directory where the database files are stored. Unless the directories (databases) are located in different storage devices with different speeds, their performance will be the same.

There can be 2 reasons to keep some tables in a different database:

  1. Security: mysql does not support role based access control. Therefore if there is a group of tables that should be accessible by a certain group of users only, then the access control is more manageable if those tables are in a different database.

  2. If some of the modules you mentioned happen to use the same table name, then you will have to move them to a separate database or you need to modify the code and table names to avoid errors.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download