Oracle SQL优化技巧

xiaoxiao2022-06-11  31

我觉得主要应该从5个方面进行调整: 1.去掉不必要的大型表的全表扫描 2.缓存小型表的全表扫描 3.检验优化索引的使用 4.检验优化的连接技术 5.尽可能减少执行计划的Cost 现在简单的举几个例子 Where子句中有“!=”将不使用索引 select account_name from test where amount != 0 (不使用) select account_name from test where amount > 0 (使用) Where条件中对字段增加处理函数将不使用该列的索引 select * from emp where to_char(hire_date,'yyyymmdd')='20080411' (不使用) select * from emp where hire_date = to_char('20080411','yyyymmdd') (使用) 避免在索引列上使用IS NULL和 IS NOT NULL select * from emp where dept_code is not null (不使用) select * from emp where dept_code > 0 (使用) 通配符% 的使用 select * from emp where name like '%A' (不使用索引) select * from emp where name like 'A%' (使用索引)

相关资源:oracle 数据库的sql优化技巧
转载请注明原文地址: https://www.6miu.com/read-4931895.html

最新回复(0)