新增一個索引,而不影響其他應用
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
- win10怎麼清理c盤空間而不影響正常使用Win10
- 【原創】linux實時應用如何printf輸出不影響實時性?Linux
- 上手做一個華為鴻蒙手錶應用 2 - 在主頁新增一個按鈕並響應點選事件鴻蒙事件
- 表資料量影響MySQL索引選擇MySql索引
- MySQL alter 新增列對dml影響MySql
- 華為後臺某應用商品展示價格幣種隨其他應用配置而變化
- 資料庫聚簇索引——not null條件對唯一鍵索引成為聚簇索引的影響資料庫索引Null
- 一個查詢不走索引的例子索引
- Web3的應用發展及其影響Web
- 影響FMEA有效應用的因素是什麼?
- Elasticsearch 中為什麼選擇倒排索引而不選擇 B 樹索引Elasticsearch索引
- 影響靜態應用安全測試工具(SAST)分析速度的3個方面AST
- OpenTelemetry agent 對 Spring Boot 應用的影響:一次 SPI 失效的Spring Boot
- oracle點陣圖索引對DML操作的影響Oracle索引
- RAC環境下的SEQUENCE對應用的影響
- Golang 迴圈異常丟擲不影響整個請求Golang
- OpenTelemetry agent 對 Spring Boot 應用的影響:一次 SPI 失效的案例Spring Boot
- NV驅動重灌不會影響CUDA
- 如何在不影響整個業務情況下重構AppAPP
- 是什麼影響了資料庫索引選型?資料庫索引
- 16、MySQL Case-索引key對select count(*)的影響MySql索引
- 一個簡單而美觀的跨平臺播客應用程式
- 自己實現一個VUE響應式--VUE響應式原理Vue
- 如何在Web應用中新增一個JavaScript Excel檢視器WebJavaScriptExcel
- 一個不讓用加號的需求而引發的Java位運算詳解Java
- redis cluster 4.0.9 遷槽不影響讀寫Redis
- 對人工智慧的應用、發展及其影響的思考人工智慧
- 資料應用的變與不變,ShardingSphere 正在影響未來數字體驗的建設理念
- 用 CSS Grid 佈局製作一個響應式柱狀圖CSS
- UIDatePicker事件不響應問題UI事件
- Adjust 釋出全球應用趨勢報告:疫情之下,應用經濟未受明顯影響
- 元宇宙技術對於虛擬模擬應用的影響元宇宙
- 影響企業數字化應用效果的八大因素
- SAP Fiori應用索引大全索引
- 直播平臺製作,支援其他應用開啟,接收其他應用檔案並儲存
- iOS匯入其他APP下載的檔案(用其他應用開啟)iOSAPP
- 奇怪?Uiautomatorviewer 獲取同一手機上的其他應用都能成功,獲取某個應用就是一直失敗。UIView
- XamarinSQLite教程新增索引SQLite索引