Why separate database and table? , meaning when it has high concurrency or large amount of data.

* Separate tables and separate libraries
Split table is a single table data volume is too large, generally to control each table is in 2 million records, if larger than it will affect the performance of SQL.
Branch database is generally speaking, the database concurrency is the most 2000, if more than to expand, of course, a healthy database had better maintain concurrency in 1000 or so, not too big.
* Separate table and library technology
The most common techniques for dividing libraries and tables are Sharing-JDBC and MyCAT. Sharding- JDBC is at the client level, of course, there are proxy level scheme. And then Mycat is at the Proxy level.
* Horizontal split and vertical split
Horizontal split is to split the data of one table into multiple tables, but the table structure of each library is the same, but the data of each library is different, it adds up to the total data.
Vertical split is to split a table with many fields into multiple tables and then into multiple databases, each of which has a different structure. So this way, you can put the less frequently accessed fields in one table, and then ask the more frequently accessed fields in another table, using the database cache.
* The role of middleware in sub-library sub-table


Based on the value of one of your fields, say a user ID, it will automatically route to your library based on that value, and then automatically route to the corresponding table.
* Two ways to divide the database into tables
One is by range, which is a continuous data range, such as a period of time, but this is prone to hot issues, because traffic is up to the latest database.
Another word is hash. Pass or distribute, then the concurrency of requests per database is roughly equal, but expansion is troublesome, because if the database is migrated, the hash will be recalculated and the data will be redistributed to different databases and tables.