1.写sql语句时候尽量用表关联,减少子查询嵌套比如select * from ta name in (select id from ta name in (select name from ta id='001' )) 可以写成类似select * from ta join ta tb on
ta.id=tb.id and tb.id='001'
2.排序查询很影响性能,最好排序的字段加上索引。
1.写sql语句时候尽量用表关联,减少子查询嵌套比如select * from ta name in (select id from ta name in (select name from ta id='001' )) 可以写成类似select * from ta join ta tb on
ta.id=tb.id and tb.id='001'
2.排序查询很影响性能,最好排序的字段加上索引。