rowid,index,INDEX FULL SCAN,INDEX FAST FULL SCAN|
物理ROWID,它的組成:
1到6位表示DATA_OBJECT_ID
7到9位表示FILE_ID
10到15位表示FILE_ID下的BLOCK_ID(dba_segments)
16到18位表示的BLOCK_ID中的第機條記錄
編碼規則為64進位制:
ABCDEF 0-5
GHIJK 6-10
LMNOP 11-15
QRSTU 16-20
VWXYZ 21-25
abcdef 26-31
ghijk 32-36
lmnop 37-41
qrstu 42-46
vwxyz 47-51
01234 52-56
56789 57-61
+/ 62-63
TABLE ACCESS FULL(讀取物理資料塊時是按順序的)
select a.rowid||'' row_id,a.* from sfism4.r_wip_tracking_t a;
可以看到rowid是按64進位制從小到大的,第一個AAANnYAAGAAAAK8AAA,AAANnYAAGAAAAK8AAB,可以理解rowid在資料塊中是連續的
select 13*64*64+39*64+24 "AAANnY",6 "AAG",10*64+60 "AAAAK8",0 "AAA" from dual;
AAANnY AAG AAAAK8 AAA
55768 6 700 0
select * from dba_objects where data_object_id=55768;
select * from dba_segments where segment_name='R_WIP_TRACKING_T';
OWNER SEGMENT_NAME PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME HEADER_FILE HEADER_BLOCK BYTES BLOCKS EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS RELATIVE_FNO BUFFER_POOL
SFISM4 R_WIP_TRACKING_T TABLE USER02 6 699 720896 88 11 65536 1 2147483645 6 DEFAULT
看到全表掃描的第一行是在第700號block,和這裡的HEADER_BLOCK699只差一個塊。
select * from dba_extents where file_id=6 and segment_name='R_WIP_TRACKING_T'; 最後一個extent BLOCK_ID為69793
但到了AAANnYAAGAAAAK9AAc突然跳到AAANnYAAGAAAAK+AAA,看到最後一行資料ROWID:AAANnYAAGAAARCoAAN為69800號block,而dba_segments中blocks為88。可以理解為segment中的extent不一定是連續的,但extent中的block一定是連續的。
INDEX FULL SCAN和INDEX UNIQUE SCAN或INDEX RANGE SCAN(都是按索引鍵值順序讀取的,注:鍵值相鄰的行,所在的表的block不一定相鄰)
select /*+ index(a pk_wip_tracking_t)*/a.rowid||'' row_id,a.serial_number from sfism4.r_wip_tracking_t a order by serial_number asc;
| 0 | SELECT STATEMENT
| 1 | INDEX FULL SCAN | PK_WIP_TRACKING_T
發現執行計劃中就不需要SORT ORDER BY排序操作,證明在做INDEX FULL SCAN時按索引順序進行的掃描
INDEX FAST FULL SCAN(索引塊多塊讀取,不按索引鍵的順序)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-712104/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- INDEX UNIQUE SCAN,INDEX FULL SCAN和INDEX FAST FULL SCANIndexAST
- Index Full Scan vs Index Fast Full ScanIndexAST
- Index Full Scan 與 Index Fast Full ScanIndexAST
- INDEX FULL SCAN和INDEX FAST FULL SCAN區別IndexAST
- index full scan 和 index FAST full scan 區別IndexAST
- Index Full Scan 與 Index Fast Full Scan (Final)IndexAST
- Index的掃描方式:index full scan/index fast full scanIndexAST
- INDEX FULL SCAN和INDEX FAST FULL SCAN的區別IndexAST
- index full scan 和 index fast full scan (IFS,FFS)的不同IndexAST
- Index Full Scan和Index Fast Full Scan行為差異分析(上)IndexAST
- Index Full Scan和Index Fast Full Scan行為差異分析(下)IndexAST
- index range scan,index fast full scan,index skip scan發生的條件IndexAST
- index fast full scan 和 nullIndexASTNull
- Fast full index scan 淺析ASTIndex
- [總結]關於index range scans & INDEX (FAST FULL SCAN)IndexAST
- 收集full table / index scan sqlIndexSQL
- SELECT COUNT(*) 索引會走 index fast full scan索引IndexAST
- Index Full Scans和Index Fast Full ScansIndexAST
- index fast full scan不能使用並行的實驗IndexAST並行
- FBI? MAX? INDEX FULL SCAN (MIN/MAX)?Index
- oracle實驗記錄(INDEX fast full scan 的成本計算)OracleIndexAST
- 【優化】INDEX FULL SCAN (MIN/MAX)訪問路徑優化Index
- (轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- Fast Full Index Scans的特點!ASTIndex
- 【最佳化】INDEX FULL SCAN (MIN/MAX)訪問路徑Index
- Clustered Index Scan and Clustered Index SeekIndex
- 【TUNE_ORACLE】列出走了INDEX FULL SCAN的SQL參考OracleIndexSQL
- INDEX SKIP SCANIndex
- 理解index skip scanIndex
- Index Unique Scan (213)Index
- 20180316不使用INDEX FULL SCAN (MIN/MAX)Index
- PostgreSQL DBA(119) - pgAdmin(LIMIT:Index Scan vs Bitmap Index Scan)SQLMITIndex
- [轉貼]Skip Scan IndexIndex
- 關於INDEX SKIP SCANIndex
- Index Range Scan (214)Index
- oracle hint之full,index,index_asc,index_desc,index_combile示例OracleIndex
- 索引優化index skip scan索引優化Index