[20210528]V$INDEXED_FIXED_COLUMN檢視.txt
[20210528]V$INDEXED_FIXED_COLUMN檢視.txt
--//看了一些文件,提到V$INDEXED_FIXED_COLUMN檢視,該檢視儲存了X$ 表的索引資訊.
--//首先說明一點 X$實際上一些記憶體結構,比如陣列,指標,連結等等,實際上一些檢視就是基於這些X$表構件出來.
--//而其對應的索引是什麼結構呢,在記憶體結構上的b*tree 索引,oracle從不公開這些資訊,也許是也許不是.
--//如果知道X$ 表對應的索引,使用其索引,也許能寫出更好的sql語句.
http://ermanarslan.blogspot.com/2021/04/rdbms-vindexedfixedcolumn-useful-view.html
In this context, if a performance problem appears in a query on some v$ views, it would be useful to look at the
execution plan. If we see FIXED TABLE FULL when accessing x$ tables, we can get the information from
V$INDEXED_FIXED_COLUMN which columns of the related x$ table are indexed and then we may change our query to make the
optimizer use that index and thus solve the problem.
--//另外X$ 可能缺乏統計資訊,導致選擇不好的執行計劃,建議在改變系統配置或者新系統上線時執行:
execute sys.dbms_stats.GATHER_FIXED_OBJECTS_STATS();
execute sys.dbms_stats.GATHER_DICTIONARY_STATS();
--//收集X$表的統計資訊,也許能獲得更好的效能.
1.環境:
SYS@book> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> select * from v$session where sid=2;
no rows selected
SYS@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID 3v0kwpwuncunw, child number 0
-------------------------------------
select * from v$session where sid=2
Plan hash value: 1627146547
--------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| OMem | 1Mem | Used-Mem |
--------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 1 (100)| | | |
| 1 | MERGE JOIN CARTESIAN | | 1 | 1378 | 0 (0)| | | |
| 2 | NESTED LOOPS | | 1 | 370 | 0 (0)| | | |
|* 3 | FIXED TABLE FIXED INDEX| X$KSLWT (ind:1) | 1 | 161 | 0 (0)| | | |
|* 4 | FIXED TABLE FIXED INDEX| X$KSLED (ind:2) | 1 | 209 | 0 (0)| | | |
| 5 | BUFFER SORT | | 1 | 1008 | 0 (0)| 73728 | 73728 | |
|* 6 | FIXED TABLE FIXED INDEX| X$KSUSE (ind:1) | 1 | 1008 | 0 (0)| | | |
--------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$5C160134
3 - SEL$5C160134 / W@SEL$3
4 - SEL$5C160134 / E@SEL$3
6 - SEL$5C160134 / S@SEL$3
Predicate Information (identified by operation id):
---------------------------------------------------
3 - filter("W"."KSLWTSID"=2)
4 - filter("W"."KSLWTEVT"="E"."INDX")
6 - filter(("S"."INDX"=2 AND "S"."INST_ID"=USERENV('INSTANCE') AND BITAND("S"."KSSPAFLG",1)<>0 AND
BITAND("S"."KSUSEFLG",1)<>0))
SYS@book> select * from V$INDEXED_FIXED_COLUMN where table_name='X$KSLWT';
TABLE_NAME INDEX_NUMBER COLUMN_NAME COLUMN_POSITION
---------- ------------ -------------------- ---------------
X$KSLWT 1 KSLWTSID 0
--//僅僅X$KSLWT.KSLWTSID上有索引。要充分利用這些資訊,最佳化一些內部檢視的查詢效能。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2775012/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20120307]檢視v$session檢視的定義.txtSession
- [20210418]查詢v$檢視問題.txt
- v$sql檢視和v$sqlarea檢視的構建SQL
- [20211214]檢視檢視V$ACTIVE_SESSION_HISTORY遇到奇怪問題.txtSession
- v$session 檢視Session
- [20211019]V$DETACHED_SESSION檢視.txtSession
- 幾個檢視 v$mystat v$systata v$sessionSession
- [20210528]oracle大表空間預分配問題.txtOracle
- 【會話】V$SESSION檢視會話Session
- oracle v$sysstat效能檢視Oracle
- Oracle常用的V$檢視Oracle
- Oracle 等待事件V$檢視Oracle事件
- v$resource_limit檢視MIT
- v檢視的授權
- v$sesstat,v$mystat,v$statname和v$sysstat檢視簡介
- 【Oracle九大效能檢視】之6.v$process檢視Oracle
- 使用V$SQL_PLAN檢視SQL
- V$SQLAREA 檢視TOP_SQLSQL
- Oracle中效能檢視V$SYSSTATOracle
- v$sql_plan 檢視解析SQL
- v$active_session_history檢視Session
- oracle V$PGASTAT檢視記錄OracleAST
- V$PGASTAT動態效能檢視AST
- 授權某使用者,檢視動態效能檢視的許可權(如v$latch,v$lock,v$sqlarea,v$sql,v$sysstat)SQL
- Oracle的V$檢視和DBA_檢視的參考提示Oracle
- v$sqlarea,v$sql,v$sqltext三個檢視的區別SQL
- [20200417]跟蹤特定sql語句以及v$open_cursor檢視.txtSQL
- [20210528]Oracle 19c Max_Idle_Blocker_Time Parameter.txtOracleBloC
- v$active_session_history檢視[轉]Session
- Oracle的v$動態檢視 收藏Oracle
- V$ASM_DISK 檢視含義ASM
- V$session 檢視的小運用Session
- 自己總結的V$檢視(轉)
- 效能檢視 V$Session_LONGOPSSessionGo
- v$session_wait和v$session_event檢視SessionAI
- 【實驗】【檢視】使用v$bgprocess檢視獲得所有後臺程式資訊
- [20240911]檢視超長檢視的定義2.txt
- V$ACTIVE_SESSION_HISTORY檢視的使用Session