xzh2000的博客 本人提供杭州地区Oracle现场技术支持服务,包括性能调整、DataGuard、RAC等。
30 11, 2006
OPT_PARAM Hint in 10g R2
作者 xzh2000 17:19 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | 技术交流

"OPT_PARAM" is a new optimizer hint introduced in 10g Release 2. This hint behaves the same way as setting a parameter (e.g, using alter session) except that the effect is for the statement only.where parameter_name is the name of a parameter and parameter_value is its value. If the parameter contains a numeric value, the parameter value has to be specified without quotes.

The syntax is:opt_param(<parameter_name> [,] <parameter_value>).
For example:/*+ opt_param('hash_join_enabled','false') */


SQL> select empno from emp e, dept d where e.ename=d.dname
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 8 | 160 | 7 (15)| 00:00:01 |
|* 1 | HASH JOIN | | 8 | 160 | 7 (15)| 00:00:01 |
| 2 | TABLE ACCESS FULL| DEPT | 4 | 40 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 28 | 280 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------

SQL> select /*+ opt_param('hash_join_enabled','false') */ empno from emp e, dept d where e.ename=d.dname;
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 8 | 160 | 8 (25)| 00:00:01 |
| 1 | MERGE JOIN | | 8 | 160 | 8 (25)| 00:00:01 |
| 2 | SORT JOIN | | 4 | 40 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| DEPT | 4 | 40 | 3 (0)| 00:00:01 |
|* 4 | SORT JOIN | | 28 | 280 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL| EMP | 28 | 280 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------

Comments
博客日历
« 三月 2010 »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
搜索
最新发表
文章分类
文章归档
网站链接
新闻聚合