mysql in 子查詢 簡單優化 大數量下,不要使用 in 嵌套子查詢,性能很差,很容易卡死。 ? 簡單調整方式如下: select uid,nick_name from uc_users where uid in(select fid from uc_follow where uid=#uid#) ? 可拆解成: 1、select fid from uc_follow wher
mysql in 子查詢 簡單優化
大數量下,不要使用 in 嵌套子查詢,性能很差,很容易卡死。
?
簡單調整方式如下:
select uid,nick_name from uc_users where uid in(select fid from uc_follow where uid=#uid#)
?
可拆解成:
1、select fid from uc_follow where uid=#uid#
將1查出的結果,傳給2
2、select uid,nick_name from uc_users where uid in($fids$)
?
本文原創發布php中文網,轉載請注明出處,感謝您的尊重!