When mysqlin subqueries are simply optimized to a large number, do not use in nested subqueries. The performance is poor and it is easy to get stuck .? The simple adjustment method is as follows: selectuid, nick_namefromuc_userswhereuidin (selectfidfromuc_followwhereuid # uid #)? It can be split into: 1. selectfidfromuc_followwher
When a large number of mysql in subqueries are simply optimized, do not use in nested subqueries. The performance is poor and it is easy to get stuck. ? The simple adjustment method is as follows: select uid, nick_name from uc_users where uid in (select fid from uc_follow where uid = # uid #)? It can be split into: 1. select fid from uc_follow wher
Simple Optimization of mysql in subqueries
In a large number of cases, do not use in nested subqueries. The performance is poor and it is easy to get stuck.
?
The following is a simple adjustment method:
Select uid, nick_name from uc_users where uid in (select fid from uc_follow where uid = # uid #)
?
It can be divided:
1. select fid from uc_follow where uid = # uid #
Pass the result 1 to 2.
2. select uid, nick_name from uc_users where uid in ($ fids $)
?