1 What is a sub-database table
The situation discussed here is a database on a single machine.
The object of a library is a table, and the object of a table is a row. The Sub-Library is about placing tables that are highly correlated to the same module in the same database. The table is to say that the rows of the same table are divided into multiple sub-tables, and each child table is placed in its own database.
2 examples of sub-library tables
2.1 Vertical Partitioning
Now the order database has the order form and order after-sales table, the former is factual, the latter does not need real-time, so put them in two databases, a database placed in the order form, and another database placed in the order after the sales table.
2.2 Horizontal Division
For example, the user order database, each user has a unique customer ID.
If we now divide the user order database horizontally into 10 databases, then we will put users id%10, so that the rows with modulo 0 are placed in the first database, the rows with modulo 1 are placed in the second database, and so on.
3 How to implement the transaction of the sub-database table
4 How to implement cross-shard sorting paging
Before the Shard, sorted by ID, after the Shard, also want to sort by ID to return, how to implement?
5 Cross-node join
6 MySQL split-pants shard Middleware
Mycat
On Mycat, users can use SQL as if they were a single database.
For example, Mycat supports cross-node joins, and so on, Mycat supports transactions and implements acid.
Mycat not applicable to the scene:
pagination sorting, etc.
53178657
MySQL Sub-database sub-table