For example, query. If MYSQL is used for database/table sharding, the logic code is more difficult. For example, in a simple query, you need to find the table after dividing the table and then query it. In this way, the complexity of the Code will multiply .... How can we design and solve this problem ??????????... For example, query. If MYSQL is used for database/table sharding, the logic code is more difficult. For example, in a simple query, you need to find the table after dividing the table and then query it. In this way, the complexity of the Code will multiply .... How can we design and solve this problem ????????????
PS: I have insufficient experience. The current level is a mysql. I found that the logic code will become much more complicated after database/table sharding.
Reply content:
For example, query. If MYSQL is used for database/table sharding, the logic code is more difficult. For example, in a simple query, you need to find the table after dividing the table and then query it. In this way, the complexity of the Code will multiply .... How can we design and solve this problem ????????????
PS: I have insufficient experience. The current level is a mysql. I found that the logic code will become much more complicated after database/table sharding.
You have discovered this, but there is no better way...
1. query the results separately, and then merge and sort the results in the memory.
2. Store the above results to the intermediate table
Isn't that MapReduce?
For example
Suppose there is a fielduser_id
, You canuser_id
The last few digits are used for database/table sharding:
| User_id | name |
| 123456 | db_45.table_45_6 |
| 654321 | db_32.table_32_1 |
Simple
You can try partitioning...
How to split tables? Why not directly use the partition technology added after mysql5.1...
It is not as difficult as you think. It is just an extra operation to obtain and indicate before the operation table. It is good to encapsulate a function.
The real difficulty lies in the data statistics, which is what @ vus520 said.