mysql - Problem with database splitting into tables and databases?
为情所困
为情所困 2017-05-18 10:49:13
0
1
506

As a simple example, take the order form as an example.

For example:
1 merchant.
The uids of the 10 users are [1,2...,10].
10 orders from 10 users are in one data table A.
Now we need to divide the tables horizontally according to uid, and divide the 10 orders into 10 tables, that is, there are 10 tables A0, A1...A9.

Question 1: Are there any useful table and database sub-database tools currently available (or related guidance materials)? Please recommend it.

Question 2: After the table partitioning is completed, there is no problem for users to query the order table, so how do merchants query these orders (that is, the join between the partitioned tables, or how to partition the tables to avoid this kind of partitioning join) ?

PS: I don’t know if my statement is clear. If there is anything unclear, please point it out and let me correct it in time. Thank you all.

Finally, give a simple table structure:

Order form:

order_id uid shop_id
Order id User id Merchant ID

user table:

uid nickname shop_id
User uid Nick name Merchant ID
为情所困
为情所困

reply all (1)
为情所困

Question 1:
1. Kingshard of Jinshan
https://github.com/flike/king...

2. Baidu’s heisenberg
https://github.com/brucexx/he...

3. Oceanus from 58 city
https://github.com/58code/Oce...

4. Taobao toddle (not maintained)
https://github.com/alibaba/tb...

5. Dangdang’s sharding-jdbc
https://github.com/dangdangdo...

Question 2:
There is no table structure, but this is generally the case. The order table contains the order information and the orderer's number. The personnel table contains the personnel number and the personnel name. Then do a connection query:

1select order information from order table join personnel table on order table personnel number=personnel table personnel number
2where personnel table personnel name='xxx'

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!