新增一個索引,而不影響其他應用
SQL> select * from test;
ID
----------
1
2
3
4
5
ID
----------
1
2
3
4
5
1.將索引建立為不可見
SQL> create index test_idx1 on test(id) invisible;
Index created.
2.指示最佳化器考慮不可見索引
SQL> alter system set optimizer_use_invisible_indexes=true;
System altered.
3.檢視執行計劃
SQL> set autotrace trace explain
SQL> select id from test where id=2;
Execution Plan
----------------------------------------------------------
Plan hash value: 4100545912
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| TEST_IDX1 | 1 | 13 | 1 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ID"=2)
Note
-----
- dynamic sampling used for this statement (level=2)
4.不用的時候,讓最佳化器忽略不可見索引
SQL> alter system set optimizer_use_invisible_indexes=false;
System altered.
SQL> select id from test where id=2;
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| TEST | 1 | 13 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"=2)
Note
-----
- dynamic sampling used for this statement (level=2)
-----------------------------------
kingsql分享
hongzhuohui@kingsql.com
轉載請註明出處
SQL> create index test_idx1 on test(id) invisible;
Index created.
2.指示最佳化器考慮不可見索引
SQL> alter system set optimizer_use_invisible_indexes=true;
System altered.
3.檢視執行計劃
SQL> set autotrace trace explain
SQL> select id from test where id=2;
Execution Plan
----------------------------------------------------------
Plan hash value: 4100545912
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| TEST_IDX1 | 1 | 13 | 1 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ID"=2)
Note
-----
- dynamic sampling used for this statement (level=2)
4.不用的時候,讓最佳化器忽略不可見索引
SQL> alter system set optimizer_use_invisible_indexes=false;
System altered.
SQL> select id from test where id=2;
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| TEST | 1 | 13 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"=2)
Note
-----
- dynamic sampling used for this statement (level=2)
-----------------------------------
kingsql分享
hongzhuohui@kingsql.com
轉載請註明出處
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1266136/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在不影響程式使用的情況下新增shellcode
- 【Oracle】-【COMMIT對索引的影響】-從trace看COMMIT對索引的影響OracleMIT索引
- win10怎麼清理c盤空間而不影響正常使用Win10
- shrink 操作對索引的影響索引
- Update操作對索引的影響索引
- 資料列not null對索引影響一例Null索引
- 上手做一個華為鴻蒙手錶應用 2 - 在主頁新增一個按鈕並響應點選事件鴻蒙事件
- ocfs格式化同一個陣列裡面的LUN , 對其他LUN影響大麼 ?陣列
- 為Java應用程式新增退出事件響應Java事件
- MySQL alter 新增列對dml影響MySql
- 新增欄位對SQL的影響SQL
- 【Oracle】-【ROWNUM與索引】-索引對ROWNUM檢索的影響Oracle索引
- GHOST漏洞可能影響WordPress和PHP應用PHP
- 【原創】linux實時應用如何printf輸出不影響實時性?Linux
- 表資料量影響MySQL索引選擇MySql索引
- 華為後臺某應用商品展示價格幣種隨其他應用配置而變化
- Web3的應用發展及其影響Web
- delete語句對索引的影響之分析delete索引
- 索引對直接路徑載入的影響索引
- Oracle 外來鍵索引影響阻塞問題Oracle索引
- 影響靜態應用安全測試工具(SAST)分析速度的3個方面AST
- 一個查詢不走索引的例子索引
- [譯] 響應式 Web 應用(一)Web
- 如何在不影響整個業務情況下重構AppAPP
- Golang 迴圈異常丟擲不影響整個請求Golang
- RAC環境下的SEQUENCE對應用的影響
- 影響FMEA有效應用的因素是什麼?
- 8個華麗而實用的Java圖表應用Java
- Elasticsearch 中為什麼選擇倒排索引而不選擇 B 樹索引Elasticsearch索引
- 【如何拒絕Win10_1703更新,且不影響其他更新】Win10
- oracle點陣圖索引對DML操作的影響Oracle索引
- stopkey對索引掃描的影響測試TopK索引
- 表資料的儲存對索引的影響索引
- 索引及排序對執行計劃的影響索引排序
- shrink 與rebuild對索引高度的影響對比Rebuild索引
- CONTEXT索引對COMMIT操作的影響 (ZT)Context索引MIT
- 分割槽表的不同操作對索引的影響索引
- 編寫不受魔術引號影響的php應用PHP