leading hint 可以指示Oracle使用leading 中指定的表作为驱动表,
比如 正常的访问计划如下
SCOTT@www.linuxidc.com> select e.ename, hiredate, b.comm
2 from emp e, bonus b
3 where e.ename = b.ename;
Execution Plan
----------------------------------------------------------
Plan hash value: 1125985041
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 6 (17)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 34 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS FULL| BONUS | 1 | 20 | 2 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 196 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("E"."ENAME"="B"."ENAME")
我们在leading 提示中指定 emp 表为驱动表
SCOTT@www.linuxidc.com> select /*+ leading(e b) */ e.ename,hiredate,b.comm
2 from emp e, bonus b
3 where e.ename = b.ename;
Execution Plan
----------------------------------------------------------
Plan hash value: 1842254584
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 6 (17)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 34 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 196 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| BONUS | 1 | 20 | 2 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("E"."ENAME"="B"."ENAME")
如结果执行计划中将emp 作为驱动表!
1 在leading 提示同时使用ordered hint,则leading hint无效
SCOTT@www.linuxidc.com> select /*+ leading(b e) ordered */ e.ename,hiredate, b.comm
2 from emp e, bonus b
3 where e.ename = b.ename;
Execution Plan
----------------------------------------------------------
Plan hash value: 1842254584
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 6 (17)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 34 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 196 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| BONUS | 1 | 20 | 2 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("E"."ENAME"="B"."ENAME")
2 使用两个冲突的leading hint ,则oracle cbo会忽略所有的leading 提示!
SCOTT@www.linuxidc.com> select /*+ leading(b e) leading(e b) */e.ename,hiredate, b.comm
2 from emp e, bonus b
3 where e.ename = b.ename;
Execution Plan
----------------------------------------------------------
Plan hash value: 1125985041
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 6 (17)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 34 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS FULL| BONUS | 1 | 20 | 2 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 196 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("E"."ENAME"="B"."ENAME")
- 大小: 51.6 KB
分享到:
相关推荐
Subject: ORDERED Hint in Complex Searches Doc ID: 408049.1 Type: PROBLEM Modified Date : 08-JUL-2009 Status: PUBLISHED
介绍了oracle中的hint,常用的 ordered、use_nl、use_hash、index、full 五种, 给出使用实例和适用场景
在SQL优化过程中常见HINT的用法(前10个比较常用, 前3个最常用): 1. /*+ INDEX */ 和 /*+ INDEX(TABLE INDEX1, index2) */ 和 /*+ INDEX(tab1.col1 tab2.col2) */ 和 /*+ NO_INDEX */ 和 /*+ NO_INDEX(TABLE INDEX1...
6.3.2 ordered hint 126 6.4 表关联操作的hint 127 6.4.1 use_hash,use_nl和use_merge hint 127 6.4.2 no_use_hash hint 132 6.4.3 no_use_merge hint 133 6.4.4 no_use_nl hint 133 6.5 并行执行相关的hint 134 ...
其中一个可以选择的优化方式是dba通过分析表的结构,数据量,索引结构等信息,通过hint/*ordered*/和索引hint/*index(table_name index_name)*/强制oracle的执行路径.极端情况下,这种优化可以提高的查询速度是非常可观...
计算序列有序离散哈达玛变换
6.3.2 ordered hint 126 6.4 表关联操作的hint 127 6.4.1 use_hash,use_nl和use_merge hint 127 6.4.2 no_use_hash hint 132 6.4.3 no_use_merge hint 133 6.4.4 no_use_nl hint 133 6.5 并行执行相关的hint 134 ...
北大POJ2533-Longest Ordered Subsequence【O(nlogn)】
python库。 资源全名:django-ordered-model-3.1.0.tar.gz
6.1.2 AsOrdered和orderby子句 6.2 指定执行模式 6.3 理解PLINQ中的数据分区 6.4 通过PLINQ执行归约操作 6.5 创建自定义的PLINQ聚合函数 6.6 并发PLINQ任务 6.7 取消PLINQ 6.8 指定所需的并行度 6.8.1 ...
订购清单 OrderedList(与JDK1.7一起编译)
资源来自pypi官网。 资源全名:orderedset-1.2.tar.gz
根据表出现在FROM中的顺序,ORDERED使ORACLE依此顺序对其连接. 例如: SELECT /*+ORDERED*/ A.COL1,B.COL2,C.COL3 FROM TABLE1 A,TABLE2 B,TABLE3 C WHERE A.COL1=B.COL1 AND B.COL1=C.COL1; 22. /*+USE_NL(TABLE)*...
6.1.2 AsOrdered和orderby子句 6.2 指定执行模式 6.3 理解PLINQ中的数据分区 6.4 通过PLINQ执行归约操作 6.5 创建自定义的PLINQ聚合函数 6.6 并发PLINQ任务 6.7 取消PLINQ 6.8 指定所需的并行度 6.8.1 ...
6.1.2 AsOrdered和orderby子句 6.2 指定执行模式 6.3 理解PLINQ中的数据分区 6.4 通过PLINQ执行归约操作 6.5 创建自定义的PLINQ聚合函数 6.6 并发PLINQ任务 6.7 取消PLINQ 6.8 指定所需的并行度 6.8.1 ...
在oracle中可以指定的表连接的hint有很多:ordered hint 指示oracle按照from关键字后的表顺序来进行连接;leading hint 指示查询优化器使用指定的表作为连接的首表,即驱动表;use_nl hint指示查询优化器使用nested ...
ordered-map:保留插入顺序的C ++哈希映射和哈希集
但是聪明的Oracle DBA和开发人员能够改变表的搜索限制参数或者使用ordered提示来手工指定表的连接顺序,从而显著地减少优化和执行新查询所需的时间。消耗在准备新的SQL语句的时间是Oracle SQL语句执行时间的最重要的...
gem 'ordered_find' 然后执行: $ bundle 或者自己安装: $ gem install ordered_find 用法 SomeModel.ordered_find([1, 3, 2, 1]) => [#, #, #, #] 或者 SomeModel.ordered_find(1, 3, 2) SomeModel....
java ordered接口应用,和gradle配置下部署了一个spring boot项目,并且写了一个例子,解压直接部署就可以用