optimizer hints [message #244530] |
Wed, 13 June 2007 04:04 |
hari.choprala
Messages: 65 Registered: November 2006 Location: Mumbai
|
Member |
|
|
Hi all
What are Optimizer Hints?
and also how to use /*+ ALL_ROWS */
rgds
Hari Krishna
|
|
|
|
|
|
|
Re: optimizer hints [message #244583 is a reply to message #244534] |
Wed, 13 June 2007 07:48 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
FOO SCOTT> set autotrace traceonly explain;
FOO SCOTT> select empno,ename,job from scott.emp
2 where empno=7566;
Execution Plan
----------------------------------------------------------
Plan hash value: 3154838177
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 18 | 1 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 18 | 1 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | EMP_PRIMARY_KEY | 1 | | 1 (0)| 00:00:01 |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("EMPNO"=7566)
FOO SCOTT>SELECT /*+ ALL_ROWS */ empno, ename, sal, job
2 from scott.emp
3 WHERE empno = 7566;
Execution Plan
----------------------------------------------------------
Plan hash value: 3154838177
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 22 | 1 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 22 | 1 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | EMP_PRIMARY_KEY | 1 | | 1 (0)| 00:00:01 |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("EMPNO"=7566)
|
|
|
Re: optimizer hints [message #244761 is a reply to message #244530] |
Thu, 14 June 2007 01:17 |
hari.choprala
Messages: 65 Registered: November 2006 Location: Mumbai
|
Member |
|
|
Joy,
Thanks for giving reply.
actually iam not aware of execution plans.
By seeing above two execution plans, the main difference is in Bytes column.
First one is taking 18 and second one is 22. Can you explain me more about this?
Rgds
Hari Krishna
[Updated on: Thu, 14 June 2007 01:18] Report message to a moderator
|
|
|