11g新特性--invisible index
從11g開始,可以建立一個invisible的索引,優化器會忽略這個索引,但DML操作會維護索引,這可以在刪除索引之前,用來測試對查詢是否有影響。
SQL> create table t as select rownum id from dual connect by level<=100000;
Table created.
SQL> create index idx_t on t(id) tablespace users;
Index created.
SQL> exec dbms_stats.gather_table_stats(user,'t');
PL/SQL procedure successfully completed.
SQL> set autot traceonly explain
SQL> select * from t where id=1;
Execution Plan
----------------------------------------------------------
Plan hash value: 2296882198
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 5 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IDX_T | 1 | 5 | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ID"=1)
SQL> drop index idx_t;
Index dropped.
SQL> create index idx_t on t(id) tablespace users invisible;
Index created.
SQL> exec dbms_stats.gather_table_stats(user,'t');
PL/SQL procedure successfully completed.
SQL> select * from t where id=1;
Execution Plan
----------------------------------------------------------
Plan hash value: 1601196873
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 5 | 47 (3)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T | 1 | 5 | 47 (3)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"=1)
可見,當索引為invisible時,優化器會忽略該索引,將索引狀態改為visible後,優化器又可以使用索引了
SQL> alter index idx_t visible;
Index altered.
SQL> select * from t where id=1;
Execution Plan
----------------------------------------------------------
Plan hash value: 2296882198
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 5 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IDX_T | 1 | 5 | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ID"=1)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10972173/viewspace-752007/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 11g新特性: 索引不可見(Index Invisible)索引Index
- Invisible IndexIndex
- MySQL 8 新特性之Invisible IndexesMySqlIndex
- index , virtual , invisibleIndex
- 11G 新特性: 新加的提示 CHANGE_DUPKEY_ERROR_INDEXErrorIndex
- 11G 新特性: 新加的提示IGNORE_ROW_ON_DUPKEY_INDEXIndex
- oracle invisible index與unusable index的區別OracleIndex
- 【ORACLE新特性】11G 分割槽新特性Oracle
- Oracle 11g 新特性Oracle
- 11g data guard 新特性
- 11g新特性--active dataguard
- oracle 11g 的新特性Oracle
- 11G新特性:FLASHBACK ARCHIVEHive
- MySQL 8.0新特性-倒敘索引 desc indexMySql索引Index
- 11g新特性:Pending Statistics
- Oracle 11g 新特性簡介Oracle
- Oracle 11g 新特性之DRCPOracle
- 11g 新特性—— Active Database DuplicationDatabase
- Oracle 11g新特性:Result CacheOracle
- 11g新特性--result caching
- Oracle 11g 新特性(轉載)Oracle
- 11G新特性:FLASHBACK ARCHIVE - 01Hive
- 11G新特性:FLASHBACK ARCHIVE – 02Hive
- Oracle 11g新特性之SecureFilesOracle
- 11g新特性:不可視索引索引
- 11g新特性--pending statistics
- oracle DG 11g新特性彙總Oracle
- ORACLE 11G新特性之列新增操作Oracle
- 【11g新特性】(I/O calibration)
- Oracle 11g 新特性 -- SecureFiles 說明Oracle
- oracle 11g 新特性 表壓縮Oracle
- 【DataGuard】11g 新特性:Active Data Guard
- Go最重要的特性是invisible - JackGo
- Oracle資料庫中的不可見索引 invisible indexOracle資料庫索引Index
- Oracle 11g 新特性 -- SQL Plan Management 示例OracleSQL
- 11g叢集新特性-scan機制
- 11g新特性--自動儲存管理
- 11G 新特性:密碼大小寫策略密碼