mysql in 子查询优化_mysql in 子查询 容易优化
mysql in 子查詢 簡(jiǎn)單優(yōu)化 大數(shù)量下,不要使用 in 嵌套子查詢,性能很差,很容易卡死。 ? 簡(jiǎn)單調(diào)整方式如下: 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 子查詢 簡(jiǎn)單優(yōu)化
大數(shù)量下,不要使用 in 嵌套子查詢,性能很差,很容易卡死。
?
簡(jiǎn)單調(diào)整方式如下:
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查出的結(jié)果,傳給2
2、select uid,nick_name from uc_users where uid in($fids$)
?
本文原創(chuàng)發(fā)布php中文網(wǎng),轉(zhuǎn)載請(qǐng)注明出處,感謝您的尊重!
總結(jié)
以上是生活随笔為你收集整理的mysql in 子查询优化_mysql in 子查询 容易优化的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 两点间最短路 java_AcWing 8
- 下一篇: oracle最大实例数,【ORA-161