Here is a simple example to introduce, index in the multi-table query how key!
One, the data is synchronized when there is no index:
1, the query code is as follows (Associated nine times):
2, run time (2 minutes, data about 10,000):
1 Start sync mysqldata:---------------------------Time:£ º 2 : Success sync mysqldata:-------------------------sync data successfully! :-£º
Second: Synchronizing Data when indexed
1. Index Database Scripts
1 KEY ' v_ur_sys_dict_val_dict_id ' (' dict_id ') USING BTREE
Note:key is the index keyword, ' v_ur_sys_dict_val_dict_id ' is the name of the index, ' dict_id ' is the primary key, and the last use of the tree-structured index using BTREE
2, run time-consuming (or run the same script, associated with 9 tables, 1w data, only used for 14 seconds)
1 Start sync mysqldata:---------------------------Time:£ º £ º2 Success sync mysqldata:-------------------------sync data successfully! :-£º
Third, Summary: the use of indexes in the database is critical, otherwise if the data on the millions, then the multi-table query may consume too much resources cause the server to hang up.
MySQL Multi-table association query with indexed and not indexed gaps