请问如何优化SQL:select * from t where id in (1,2,3) order by s desc;
复制代码 目前大家提出的优化方法:
1. 将 in(1,2,3) 换成 id=1 or id=2 or id=3
2. 将 * 细化
3. id<=3 用个运算...小于或者等于...
4. 将 in(1,2,3) 换成 exists(1,2,3)
希望大家继续讨论.
补充: 像四楼这样没营养的文字,请勿占用资源.
[ 本帖最后由 gxgzres 于 2008-7-17 17:32 编辑 ] |