sql语句的优化技巧

1 查询时尽量避免使用*号,按需查询所需的cols。

2 避免使用in、not in,使用exists 和 not exists替代。

3 尽量避免使用like

4 查询数据条数时不要使用select count(*),将* 替换成索引行或者id。

5 涉及到删除分类下所有数据时可以使用触发器

 

posted @ 2016-04-14 09:49  TravleMan  阅读(359)  评论(1)    收藏  举报