7 SQL优化技术

7.1 改变访问结构
7.2 修改SQL语句

SELECT deptno
  FROM dept
WHERE deptno NOT IN (SELECT deptno FROM emp);

image

SELECT deptno
  FROM dept
WHERE NOT EXISTS
          (SELECT 1
             FROM emp
            WHERE emp.deptno = dept.deptno);

 image
SELECT deptno FROM dept
MINUS
SELECT deptno FROM emp;

image
SELECT dept.deptno
  FROM dept, emp
WHERE dept.deptno = emp.deptno(+) AND emp.deptno IS NULL;

image

7.3 提示hint
      提示的分类
     
初始化参数提示 all_rows,cursor_sharing_extract,dynamic_sampling,first_rows,gather_plan_statistics…
查询转化提示 (no_)eliminate_join,no_expand,(no_)merge…
访问路径提示 full,index,index_ffs…
连接提示 leading,ordered…
并行处理提示 parallel…
其他提示 (no_)append,(no_)cache…
7.4 改变执行环境
7.5 SQL概要
7.6 存储提纲
7.7 SQL计划基线
7.8 小结
posted @ 2017-02-06 17:29  guilingyang  阅读(191)  评论(0编辑  收藏  举报