[20202117]Function based indexes and cursor sharing.txt
[20202117]Function based indexes and cursor sharing.txt
--//昨天測試給sql打補丁在11g,根據連結介紹https://hourim.wordpress.com/2020/10/24/function-based-indexes-and-cursor-sharing/
--//視乎從19c開始即使設定CURSOR_SHARING=FORCE,對於函式索引可能不需要我介紹的這樣操作。
--//自己測試看看,加強記憶:
1.環境:
TTT@192.168.2.7:1521/orcl> select banner_full from v$version;
BANNER_FULL
----------------------------------------------------------------------
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
2.建立測試例子:
create table t1
as
select
rownum n1,
'xy' || rownum vc1,
mod(rownum, 10) n2
from
dual
connect by
level <= 1e4;
create index idx_t1 on t1(substr(vc1,3,1));
alter session set cursor_sharing=force;
select * from t1 where substr(vc1,3,1)='5';
TTT@192.168.2.7:1521/orcl> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID djypd1v8qjawh, child number 0
-------------------------------------
select * from t1 where substr(vc1,:"SYS_B_0",:"SYS_B_1")=:"SYS_B_2"
Plan hash value: 3491035275
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| E-Time |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 3 (100)| |
| 1 | TABLE ACCESS BY INDEX ROWID BATCHED| T1 | 100 | 1400 | 3 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_T1 | 40 | | 2 (0)| 00:00:01 |
-----------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T1@SEL$1
2 - SEL$1 / T1@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T1"."SYS_NC00004$"=:SYS_B_2)
--//確實如此,對於一些實際生產系統確實是一個大的進步。
TTT@192.168.2.7:1521/orcl> alter session set optimizer_features_enable='12.2.0.1';
Session altered.
TTT@192.168.2.7:1521/orcl> select * from t1 where substr(vc1,3,1)='z';
no rows selected
TTT@192.168.2.7:1521/orcl> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID djypd1v8qjawh, child number 1
-------------------------------------
select * from t1 where substr(vc1,:"SYS_B_0",:"SYS_B_1")=:"SYS_B_2"
Plan hash value: 3617692013
---------------------------------------------------------------------------
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| E-Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 10 (100)| |
|* 1 | TABLE ACCESS FULL| T1 | 100 | 1400 | 10 (0)| 00:00:01 |
---------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T1@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(SUBSTR("VC1",:SYS_B_0,:SYS_B_1)=:SYS_B_2)
--//全表掃描,無法使用函式索引。12c還沒有改進。18c已經支援這個功能。不知道那個隱含引數控制這種引為。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2737440/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20220414]Function based indexes and cursor sharing2.txtFunctionIndex
- Orale的struct,array,cursor,stored procedure,function,package的用法例子StructFunctionPackage
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- Difference between cursor and a ref cursor
- [20180510]20 Indexes.txtIndex
- javascript 中function(){},new function(),new Function(),Function 摘錄JavaScriptFunction
- PostgreSQL DBA(45) - Hypothetical Indexes in PostgreSQLSQLIndex
- 【CURSOR】Oracle 遊標 (cursor)知識梳理Oracle
- Oracle CursorOracle
- Cursor使用
- MySQL 8 新特性之Invisible IndexesMySqlIndex
- Physically Based Rendering
- Postgresql的CURSOR SHARINGSQL
- firefox css cursor handFirefoxCSS
- Oracle:cursor:mutex XOracleMutex
- JavaScript FunctionJavaScriptFunction
- [Bash] functionFunction
- python FunctionPythonFunction
- Loss FunctionFunction
- A timer based on timerfd and epoll
- PostgreSQL DBA(159) - pgAdmin(Allow vacuum command to process indexes in paralleSQLIndex
- java.util.function 中的 Function、Predicate、ConsumerJavaFunction
- CSS滑鼠樣式(cursor)CSS
- cursor pin S wait on XAI
- cursor: pin S wait on XAI
- 提點效: 使用 Cursor
- 哈哈,我好像知道 Cursor 為什麼叫 Cursor 了,真相竟然是。。。
- Oracle 19c Concepts(03):Indexes and Index-Organized TablesOracleIndexZed
- Oracle 19C 無法啟用Auto Indexes特性OracleIndex
- cmu15545筆記-索引併發控制(Concurrent Indexes)筆記索引Index
- Based UE_Project NotesProject
- 【CURSOR】Oracle 子游標無法共享的原因之V$SQL_SHARED_CURSOROracleSQL
- Function型別Function型別
- DMSQL WITH FUNCTION子句SQLFunction
- JavaScript Function物件JavaScriptFunction物件
- A.Calculating FunctionFunction
- Function pointers and callbacksFunction
- addEventListener("touchend", function ()_devFunction