(on) Hints for Optimization Approaches and Goals

ALL_ROWSFIRST_ROWS\(N)
{code:sqltitleBGColor=#FFFFFFtitle=!http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/img/all_rows_hint.gif!borderStyle=solid}
SELECT /*+ ALL_ROWS */ * FROM T1 A, T2 B WHERE A.N4 = B.N4 AND A.N4 = 0;






















-

IdOperationNameRowsBytesCost (%CPU)Time






















-

0SELECT STATEMENT1000K26M13 (77)00:00:01
  • 1
HASH JOIN1000K26M13 (77)00:00:01
2TABLE ACCESS BY INDEX ROWIDT11000140001 (0)00:00:01
  • 3
INDEX RANGE SCANT1N410001 (0)00:00:01
4TABLE ACCESS BY INDEX ROWIDT21000140001 (0)00:00:01
  • 5
INDEX RANGE SCANT2N410001 (0)00:00:01






















-

Statistics















--
0 recursive calls
0 db block gets
2008 consistent gets
0 physical reads
0 redo size
0 sorts (memory)
0 sorts (disk)
1000000 rows processed

– HASH 조인, 읽은 블록수 작다
http://ukja.tistory.com/172
http://scidb.tistory.com/entry/NO-Costing-in-CBO

|{code:sql|titleBGColor=#FFFFFF|title=!http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/img/first_rows_hint.gif!|borderStyle=solid}
SELECT /*+ FIRST_ROWS(20) */ * FROM T1 A, T2 B WHERE A.N4 = B.N4 AND A.N4 = 0;

--------------------------------------------------------------------------------------
| Id  | Operation                     | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |      |    29 |   812 |     2   (0)| 00:00:01 |
|   1 |  NESTED LOOPS                 |      |       |       |            |          |
|   2 |   NESTED LOOPS                |      |    29 |   812 |     2   (0)| 00:00:01 |
|   3 |    TABLE ACCESS BY INDEX ROWID| T1   |    20 |   280 |     1   (0)| 00:00:01 |
|*  4 |     INDEX RANGE SCAN          | T1N4 |  1000 |       |     1   (0)| 00:00:01 |
|*  5 |    INDEX RANGE SCAN           | T2N4 |    20 |       |     1   (0)| 00:00:01 |
|   6 |   TABLE ACCESS BY INDEX ROWID | T2   |    20 |   280 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------------------

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
     140341  consistent gets
          0  physical reads
          0  redo size
          0  sorts (memory)
          0  sorts (disk)
    1000000  rows processed

-- NL 조인, 읽은 블록수 크다

|