当前位置:Gxlcms > 数据库问题 > sql优化(oracle)- 第三部分  sql优化总结

sql优化(oracle)- 第三部分  sql优化总结

时间:2021-07-01 10:21:17 帮助过:26人阅读


  4)or比较多时分为多个查询,使用union all(尽量用union all代替union)联结(适应于索引列)
  5) 尽量多用commit提交事务,可以及时释放资源、解锁、释放日志
  6)访问频繁的表可以放置在内存中
  7)避免复杂的多表关联
  8)避免distinct,union(并集),minus(差集),intersect(交集),order by等耗费资源的操作,因为会执行耗费资源的排序功能
  9)使用exists替代distinct
   select c.distinct c.classname, c.classid, classno from student s, class c where s.classno= c.classno;
  --替换为
   select  classname, classid, classno from class c where exists (select * from student s where s.classno = c.classno);

    delete删除时,没有commit前可以回滚;truncate后不能回滚,执行时间较短
   11)使用表的别名,可以减少解析时间
   12)exists和in的选择问题,不同时候区分对待
   13)合理使用索引

sql优化(oracle)- 第三部分  sql优化总结

标签:解析   失效   tin   sts   资源   oracle优化   删除   区分   访问   

人气教程排行