您的位置:首页 > 数据库

sql语句性能优化

2017-09-15 15:49 471 查看
1、尽量不要使用模糊查询(会导致相关列的索引不可用);

2、有索引的列避免在sql语句中进行计算操作,尽量不使用not、<>、!=、is null、is not null,不进行数据类型转换、不使用函数、空值;

3、复杂的update和select语句适当拆分,多子句sql语句影响性能;

4、where子句中使用exist和not exist代替in和not in,having;

5、不要用字符格式来声明数字:where id = '100001';

6、不使用select * from ... select count(*) from... ;

7、尽可能少的使用耗费数据库引擎的distinct、union、minus、intersect、order by...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: