INDEX FULL SCAN和INDEX FAST FULL SCAN區別
---請記住這個INDEX FULL SCAN掃描方式,並體會與INDEX FAST FULL SCAN的區別
drop table t purge;
create table t as select * from dba_objects;
update t set object_id=rownum;
commit;
alter table T modify object_id not null;
create index idx_object_id on t(object_id);
set autotrace traceonly
set linesize 1000
select * from t order by object_id;
執行計劃
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 88780 | 17M| 1208 (1)| 00:00:15 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 88780 | 17M| 1208 (1)| 00:00:15 |
| 2 | INDEX FULL SCAN | IDX_OBJECT_ID | 88780 | | 164 (1)| 00:00:02 |
---------------------------------------------------------------------------------------------
統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
10873 consistent gets
0 physical reads
0 redo size
8116181 bytes sent via SQL*Net to client
54040 bytes received via SQL*Net from client
4877 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
73130 rows processed
drop table t purge;
create table t as select * from dba_objects ;
update t set object_id=rownum;
commit;
alter table T modify object_id not null;
create index idx_object_id on t(object_id);
set autotrace traceonly
set linesize 1000
select count(*) from t;
執行計劃
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 49 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FAST FULL SCAN| IDX_OBJECT_ID | 88780 | 49 (0)| 00:00:01 |
-------------------------------------------------------------------------------
統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
170 consistent gets
0 physical reads
0 redo size
425 bytes sent via SQL*Net to client
415 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
總結:fast為無序讀,一次讀取多個塊,full為有序讀,每次讀取單個塊。
梁老師課程總結。
drop table t purge;
create table t as select * from dba_objects;
update t set object_id=rownum;
commit;
alter table T modify object_id not null;
create index idx_object_id on t(object_id);
set autotrace traceonly
set linesize 1000
select * from t order by object_id;
執行計劃
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 88780 | 17M| 1208 (1)| 00:00:15 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 88780 | 17M| 1208 (1)| 00:00:15 |
| 2 | INDEX FULL SCAN | IDX_OBJECT_ID | 88780 | | 164 (1)| 00:00:02 |
---------------------------------------------------------------------------------------------
統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
10873 consistent gets
0 physical reads
0 redo size
8116181 bytes sent via SQL*Net to client
54040 bytes received via SQL*Net from client
4877 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
73130 rows processed
drop table t purge;
create table t as select * from dba_objects ;
update t set object_id=rownum;
commit;
alter table T modify object_id not null;
create index idx_object_id on t(object_id);
set autotrace traceonly
set linesize 1000
select count(*) from t;
執行計劃
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 49 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FAST FULL SCAN| IDX_OBJECT_ID | 88780 | 49 (0)| 00:00:01 |
-------------------------------------------------------------------------------
統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
170 consistent gets
0 physical reads
0 redo size
425 bytes sent via SQL*Net to client
415 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
總結:fast為無序讀,一次讀取多個塊,full為有序讀,每次讀取單個塊。
梁老師課程總結。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29135257/viewspace-2085123/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- index full scan 和 index FAST full scan 區別IndexAST
- INDEX FULL SCAN和INDEX FAST FULL SCAN的區別IndexAST
- 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
- rowid,index,INDEX FULL SCAN,INDEX FAST FULL SCAN|IndexAST
- Index Full Scan 與 Index Fast Full Scan (Final)IndexAST
- index full scan 和 index fast full scan (IFS,FFS)的不同IndexAST
- Index的掃描方式:index full scan/index fast full scanIndexAST
- index fast full scan 和 nullIndexASTNull
- Index Full Scan和Index Fast Full Scan行為差異分析(上)IndexAST
- Index Full Scan和Index Fast Full Scan行為差異分析(下)IndexAST
- Fast full index scan 淺析ASTIndex
- index range scan,index fast full scan,index skip scan發生的條件IndexAST
- [總結]關於index range scans & INDEX (FAST FULL SCAN)IndexAST
- SELECT COUNT(*) 索引會走 index fast full scan索引IndexAST
- 收集full table / index scan sqlIndexSQL
- 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 Scan Or Full Table Scan)索引Index
- 轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 【優化】INDEX FULL SCAN (MIN/MAX)訪問路徑優化Index
- 【最佳化】INDEX FULL SCAN (MIN/MAX)訪問路徑Index
- Fast Full Index Scans的特點!ASTIndex
- 【TUNE_ORACLE】列出走了INDEX FULL SCAN的SQL參考OracleIndexSQL
- oracle index unique scan/index range scan和mysql range/const/ref/eq_ref的區別OracleIndexMySql
- 20180316不使用INDEX FULL SCAN (MIN/MAX)Index
- INDEX SKIP SCANIndex
- Oracle學習系列—資料庫最佳化—Full Scans和Fast Full Index ScansOracle資料庫ASTIndex
- Clustered Index Scan and Clustered Index SeekIndex
- 理解index skip scanIndex
- Index Unique Scan (213)Index
- PostgreSQL DBA(119) - pgAdmin(LIMIT:Index Scan vs Bitmap Index Scan)SQLMITIndex
- [轉貼]Skip Scan IndexIndex
- 關於INDEX SKIP SCANIndex
- Index Range Scan (214)Index