[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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20211019]V$DETACHED_SESSION檢視.txtSession
- [20210418]查詢v$檢視問題.txt
- [20211214]檢視檢視V$ACTIVE_SESSION_HISTORY遇到奇怪問題.txtSession
- [20181103]12c檢視V$EVENT_NAME.txt
- [20201207]12c v$open_cursor檢視.txt
- [20210528]oracle大表空間預分配問題.txtOracle
- [20190312]檢視v$datafile欄位OFFLINE_CHANGE#, ONLINE_CHANGE#.txt
- [20180907]訪問v$檢視與一致性讀取.txt
- [20200211]檢視v$db_object_cache的CHILD_LATCH欄位.txtObject
- [20200212]使用DBMS_SHARED_POOL.MARKHOT與檢視v$open_cursor.txt
- [20200417]跟蹤特定sql語句以及v$open_cursor檢視.txtSQL
- [20210528]Oracle 19c Max_Idle_Blocker_Time Parameter.txtOracleBloC
- [20180503]檢視提示使用索引.txt索引
- [20240911]檢視超長檢視的定義2.txt
- [20200422]跟蹤特定sql語句以及v$open_cursor檢視(補充).txtSQL
- [20200417]跟蹤特定sql語句以及v$open_cursor檢視2.txtSQL
- 檢視V$DATAGUARD_STATS
- [20230323]ps命令檢視thread.txtthread
- [20200424]跟蹤特定sql語句以及v$open_cursor檢視(再補充).txtSQL
- [20221130]測試訪問檢視v$session幾種情況的效能差異.txtSession
- [20190416]檢視shared latch gets的變化.txt
- [20231012]如何檢視unicode編碼內容.txtUnicode
- [20190324]奇怪的GV$FILESPACE_USAGE檢視.txt
- [20190104]ipcs檢視共享記憶體段.txt記憶體
- [20211206]toad下job建立檢視問題.txt
- [20210422]如何檢視字元的ascii編碼.txt字元ASCII
- [20210423]建立檢視以及欄位長度.txt
- [20180814]慎用檢視錶壓縮率指令碼.txt指令碼
- [20190506]檢視巢狀與繫結變數.txt巢狀變數
- [20210207]使用gdb檢視等待事件11g.txt事件
- [20210208][20200426]檢視shared latch gets的變化.txt
- V$ACTIVE_SESSION_HISTORY檢視的使用Session
- [20181004]12c dba_source檢視定義.txt
- 讓你在macOS上快速檢視txt文字檔案Mac
- [20180322]檢視統計資訊的儲存歷史.txt
- [20221128]再談防水牆(檢視訪問效能問題).txt
- [20210114]toad檢視真實執行計劃問題.txt
- ORACLE 閃回檢視v$flashback_database_log/statOracleDatabase