oracle hint之hint_index_ffs,index_join
oracle hint_index_ffs,index_join
index_ffs hint
1,對錶用快速索引全掃描進行訪問
2,經測,僅count可以使用index_ffs,而非count聚合函式好像不能使用index_ffs
SQL> explain plan for select /*+ index_ffs(t_test idx_t_test */ a from t_test;
1,對錶用快速索引全掃描進行訪問
2,經測,僅count可以使用index_ffs,而非count聚合函式好像不能使用index_ffs
SQL> explain plan for select /*+ index_ffs(t_test idx_t_test */ a from t_test;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 2796558804
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 999K| 4882K| 305 (2)| 00:00:04 |
| 1 | TABLE ACCESS FULL| T_TEST | 999K| 4882K| 305 (2)| 00:00:04 |
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 999K| 4882K| 305 (2)| 00:00:04 |
| 1 | TABLE ACCESS FULL| T_TEST | 999K| 4882K| 305 (2)| 00:00:04 |
----------------------------------------------------------------------------
已選擇8行。
SQL> explain plan for select /*+ index_ffs(t_test idx_t_test) */ count(a) from
t_test;
t_test;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 1936070979
--------------------------------------------------------------------------------
----
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|
|
--------------------------------------------------------------------------------
----
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 5 | 384 (2)| 00:00:
05 |
| 1 | SORT AGGREGATE | | 1 | 5 | |
|
|
| 2 | INDEX FAST FULL SCAN| IDX_T_TEST | 999K| 4882K| 384 (2)| 00:00:
05 |
--------------------------------------------------------------------------------
----
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
已選擇9行。
SQL>
index_join
1,index_join會自動連線where條件多個索引列
2,index_join不像index_combile轉化為點陣圖方式訪問表,它是直接以rowid訪問
SQL> explain plan for select /*+index_join(t_test idx_t_test idx_t_b) */ a,b fro
m t_test where a=3 and b=1;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 4085113357
--------------------------------------------------------------------------------
-------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Tim
e |
--------------------------------------------------------------------------------
-------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 951 (1)| 00:
00:12 |
|* 1 | VIEW | index$_join$_001 | 1 | 8 | 951 (1)| 00:
00:12 |
|* 2 | HASH JOIN | | | | |
|
|
|* 3 | INDEX RANGE SCAN| IDX_T_TEST | 1 | 8 | 3 (0)| 00:
00:01 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|* 4 | INDEX RANGE SCAN| IDX_T_B | 1 | 8 | 948 (1)| 00:
00:12 |
--------------------------------------------------------------------------------
-------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("A"=3 AND "B"=1)
2 - access(ROWID=ROWID)
3 - access("A"=3)
4 - access("B"=1)
2 - access(ROWID=ROWID)
3 - access("A"=3)
4 - access("B"=1)
已選擇19行。
SQL>
SQL> explain plan for select /*+index_join(t_test idx_t_test idx_t_b) */ a,b fro
m t_test where a=3 and b=1 and c=19;
m t_test where a=3 and b=1 and c=19;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 2799059507
--------------------------------------------------------------------------------
--------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Ti
me |
--------------------------------------------------------------------------------
--------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 958 (1)| 00
:00:12 |
|* 1 | VIEW | index$_join$_001 | 1 | 8 | 958 (1)| 00
:00:12 |
|* 2 | HASH JOIN | | | | |
|
|
|* 3 | HASH JOIN | | | | |
|
|
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|* 4 | INDEX RANGE SCAN| IDX_T_TEST | 1 | 8 | 3 (0)| 00
:00:01 |
|* 5 | INDEX RANGE SCAN| IDX_C | 1 | 8 | 3 (0)| 00
:00:01 |
|* 6 | INDEX RANGE SCAN | IDX_T_B | 1 | 8 | 948 (1)| 00
:00:12 |
--------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("A"=3 AND "C"=19 AND "B"=1)
2 - access(ROWID=ROWID)
3 - access(ROWID=ROWID)
4 - access("A"=3)
5 - access("C"=19)
2 - access(ROWID=ROWID)
3 - access(ROWID=ROWID)
4 - access("A"=3)
5 - access("C"=19)
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
6 - access("B"=1)
已選擇23行。
SQL>
SQL> explain plan for select /*+index_join(t_test idx_t_test idx_t_b idx_c) */ a
,b from t_test where a=3 and b=1 and c=20;
SQL> explain plan for select /*+index_join(t_test idx_t_test idx_t_b idx_c) */ a
,b from t_test where a=3 and b=1 and c=20;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 2799059507
--------------------------------------------------------------------------------
--------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Ti
me |
--------------------------------------------------------------------------------
--------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 958 (1)| 00
:00:12 |
|* 1 | VIEW | index$_join$_001 | 1 | 8 | 958 (1)| 00
:00:12 |
|* 2 | HASH JOIN | | | | |
|
|
|* 3 | HASH JOIN | | | | |
|
|
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|* 4 | INDEX RANGE SCAN| IDX_T_TEST | 1 | 8 | 3 (0)| 00
:00:01 |
|* 5 | INDEX RANGE SCAN| IDX_C | 1 | 8 | 3 (0)| 00
:00:01 |
|* 6 | INDEX RANGE SCAN | IDX_T_B | 1 | 8 | 948 (1)| 00
:00:12 |
--------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("A"=3 AND "C"=20 AND "B"=1)
2 - access(ROWID=ROWID)
3 - access(ROWID=ROWID)
4 - access("A"=3)
5 - access("C"=20)
2 - access(ROWID=ROWID)
3 - access(ROWID=ROWID)
4 - access("A"=3)
5 - access("C"=20)
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
6 - access("B"=1)
已選擇23行。
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-751318/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle之hint概述Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(五)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(四)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(三)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(二)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(一)Oracle
- Oracle之Hint使用總結Oracle
- Oracle hint之DRIVING_SITEOracle
- 【TUNE_ORACLE】Oracle Hint之概念與用法Oracle
- oracle hintOracle
- ORACLE 部分HINTOracle
- oracle hint (續)Oracle
- Oracle Hint 精華Oracle
- oracle常見hintOracle
- oracle hint簡述Oracle
- oracle hint (續-0)Oracle
- oracle hint_no_indexOracleIndex
- Oracle Hint 精華文章Oracle
- 常用的Oracle HintOracle
- Oracle Hint 詳解Oracle
- Oracle Hint的用法Oracle
- ORACLE的HINT詳解Oracle
- Oracle中Hint隨記Oracle
- oracle hint no_mergeOracle
- oracle hint_no_expand_no_factOracle
- oracle hint_cache_nocacheOracle
- Oracle 常用HINT介紹Oracle
- (轉)Oracle Hint的用法Oracle
- oracle hint有效範圍Oracle
- ORACLE使用HINT的方法Oracle
- Oracle索引HINT的使用Oracle索引
- Oracle中的sql hintOracleSQL
- zt_Oracle hint driving_site Hint的用法Oracle
- oracle筆記整理12——效能調優之hint標籤Oracle筆記
- Oracle中常見的Hint(一)Oracle
- oracle hint_leadingOracle
- oracle hint_noappend_parallelOracleAPPParallel
- oracle hint_no_parallel_no_parallel_indexOracleParallelIndex