oracle hint_skip scan_index_ss
oracle hint 系列3
oracle skip scan
1,適用於組合索引
2,僅應用於組合索引的非前導列
3,會根據組合索引的前導列的不重複值把組合索引分為多個邏輯上的子索引
4,如果前導列選擇性差,非前導列選擇列高,最能發揮效能
5,可以看到如果不走skip scan,成本陡增N倍
oracle skip scan
1,適用於組合索引
2,僅應用於組合索引的非前導列
3,會根據組合索引的前導列的不重複值把組合索引分為多個邏輯上的子索引
4,如果前導列選擇性差,非前導列選擇列高,最能發揮效能
5,可以看到如果不走skip scan,成本陡增N倍
oracle11g自動選擇oracle skip scan
SQL> explain plan for select * from t_skip where emp_id=59;
SQL> explain plan for select * from t_skip where emp_id=59;
已解釋。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Plan hash value: 796694006
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 4 (0)| 00:00:01 |
|* 1 | INDEX SKIP SCAN | IDX_T_SKIP | 1 | 8 | 4 (0)| 00:00:01 |
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 4 (0)| 00:00:01 |
|* 1 | INDEX SKIP SCAN | IDX_T_SKIP | 1 | 8 | 4 (0)| 00:00:01 |
-------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
1 - access("EMP_ID"=59)
filter("EMP_ID"=59)
已選擇14行。
SQL> select /*+ no_index_ss(t_skip idx_t_skip) */ * from t_skip where emp_id=59;
SEX EMP_ID
---------- ----------
1 59
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SQL_ID ff8p1zzyaxyz3, child number 0
-------------------------------------
select /*+ no_index_ss(t_skip idx_t_skip) */ * from t_skip where
emp_id=59
-------------------------------------
select /*+ no_index_ss(t_skip idx_t_skip) */ * from t_skip where
emp_id=59
Plan hash value: 384721346
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 307 (100)| |
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 307 (100)| |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|* 1 | TABLE ACCESS FULL| T_SKIP | 1 | 8 | 307 (3)| 00:00:04 |
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
---------------------------------------------------
1 - filter("EMP_ID"=59)
已選擇19行。
SQL> select /*+ index_ss(t_skip idx_t_skip) */ * from t_skip where emp_id=59;
SEX EMP_ID
---------- ----------
1 59
---------- ----------
1 59
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SQL_ID 4hh6sp1m5v6vd, child number 0
-------------------------------------
select /*+ index_ss(t_skip idx_t_skip) */ * from t_skip where emp_id=59
-------------------------------------
select /*+ index_ss(t_skip idx_t_skip) */ * from t_skip where emp_id=59
Plan hash value: 796694006
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
|* 1 | INDEX SKIP SCAN | IDX_T_SKIP | 1 | 8 | 4 (0)| 00:00:01 |
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
|* 1 | INDEX SKIP SCAN | IDX_T_SKIP | 1 | 8 | 4 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
---------------------------------------------------
1 - access("EMP_ID"=59)
filter("EMP_ID"=59)
filter("EMP_ID"=59)
已選擇19行。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-751319/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle DBLink oracleOracle
- Oracle 中$ORACLE_HOME/bin/oracle檔案Oracle
- oracle 修改ORACLE例項Oracle
- oracle安裝工具目錄常用解釋oracle wallet manager/Oracle Directory Manager /oracle net manager /Oracle Net ManagOracle
- ORACLE基礎之oracle鎖(oracle lock mode)詳解Oracle
- 【Oracle】oracle tablespace&datafile -- oracle表空間 分享[轉]Oracle
- cx_Oracle 連線 OracleOracle
- [Oracle]Oracle良性SQL建議OracleSQL
- oracle之 Oracle LOB 詳解Oracle
- [oracle]centos 7 安裝oracleOracleCentOS
- Oracle工具(Oracle Tools) – SQLT(SQLTXPLAIN)OracleSQLAI
- oracle clone oracle_home 方法Oracle
- oracle 817 archive err,oracle hangOracleHive
- 【Oracle】修改oracle監聽埠Oracle
- 【Oracle】Oracle常用EVENT之三Oracle
- 【Oracle】Oracle常用EVENT之二Oracle
- 【Oracle】Oracle常用EVENT之一Oracle
- Oracle Clusterware and Oracle Grid InfrastructureOracleASTStruct
- 【Oracle】--"任性"Oracle安裝之旅Oracle
- OracleOracle
- Oracle vs PostgreSQL DBA(21)- Oracle VPDOracleSQL
- 【Oracle】Oracle logminer功能介紹Oracle
- Oracle案例12——NBU Oracle恢復Oracle
- [Oracle] -- 配置Oracle環境變數Oracle變數
- 「Oracle」Oracle 資料庫安裝Oracle資料庫
- oracle 12c Deprecation of Oracle StreamsOracle
- Oracle HowTo:How to get Oracle SCN?Oracle
- Oracle Temporary Tables(Oracle 臨時表)Oracle
- ORACLE_BASE 與 ORACLE_HOMEOracle
- Oracle OAF(Oracle Application Framework) SampleOracleAPPFramework
- 20 Differences Between Oracle on NT and Oracle on UnixOracle
- Oracle技術專題 - Oracle瑣Oracle
- ORACLE-BASE - Oracle DBA and development articlesOracledev
- oracle 學習筆記 (ORACLE NET )Oracle筆記
- For oracle databases, if the top showing the oracle database, then oracle process is using the top cOracleDatabase
- Oracle 之 Cloning $oracle_home (克隆安裝oracle軟體)Oracle
- Oracle例項和Oracle資料庫(Oracle體系結構)Oracle資料庫
- oracle維護服務 oracle解決方案 oracle售後服務Oracle