INDEX FULL SCAN和INDEX FAST FULL SCAN区别

Posted ClarkYu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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为有序读,每次读取单个块。
梁老师课程总结。

以上是关于INDEX FULL SCAN和INDEX FAST FULL SCAN区别的主要内容,如果未能解决你的问题,请参考以下文章

INDEX FULL SCAN和INDEX FAST FULL SCAN的区别

Index Full Scan vs Index Fast Full Scan-1103

index seek和index scan 提高sql 效率

index seek与index scan

Clustered Index Scan 与 Clustered Index Seek

INDEX SKIP SCAN适用场景