zoukankan      html  css  js  c++  java
  • index range scan和index fast full scan

    SQL> create index idx_1 on t1(object_id);
    
    Index created.
    
    SQL> set linesie 200
    SP2-0158: unknown SET option "linesie"
    SQL> select max(object_id) from t1;
    
    MAX(OBJECT_ID)
    --------------
    	175920
    
    SQL> select count(*) from t1 where object_id>170000;
    
      COUNT(*)
    ----------
          9696
    
    SQL> set autot trace
    SQL> select count(*) from t1 where object_id>170000;
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3018594191
    
    ---------------------------------------------------------------------------
    | Id  | Operation	  | Name  | Rows  | Bytes | Cost (%CPU)| Time	  |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |	  |	1 |    13 |    40   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |	  |	1 |    13 |	       |	  |
    |*  2 |   INDEX RANGE SCAN| IDX_1 | 20427 |   259K|    40   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("OBJECT_ID">170000)
    
    Note
    -----
       - dynamic sampling used for this statement
    
    
    Statistics
    ----------------------------------------------------------
    	  0  recursive calls
    	  0  db block gets
    	 25  consistent gets
    	  0  physical reads
    	  0  redo size
    	516  bytes sent via SQL*Net to client
    	492  bytes received via SQL*Net from client
    	  2  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	  1  rows processed
    
    SQL> select count(*) from t1 where object_id>170000;
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3018594191
    
    ---------------------------------------------------------------------------
    | Id  | Operation	  | Name  | Rows  | Bytes | Cost (%CPU)| Time	  |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |	  |	1 |	5 |   133   (1)| 00:00:02 |
    |   1 |  SORT AGGREGATE   |	  |	1 |	5 |	       |	  |
    |*  2 |   INDEX RANGE SCAN| IDX_1 | 55470 |   270K|   133   (1)| 00:00:02 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("OBJECT_ID">170000)
    
    
    Statistics
    ----------------------------------------------------------
    	  1  recursive calls
    	  0  db block gets
    	 25  consistent gets
    	  0  physical reads
    	  0  redo size
    	516  bytes sent via SQL*Net to client
    	492  bytes received via SQL*Net from client
    	  2  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	  1  rows processed
    
    SQL> select count(*) from t1 where object_id>1;
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1271403589
    
    -------------------------------------------------------------------------------
    | Id  | Operation	      | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT      |       |     1 |     5 |   865	(3)| 00:00:11 |
    |   1 |  SORT AGGREGATE       |       |     1 |     5 | 	   |	      |
    |*  2 |   INDEX FAST FULL SCAN| IDX_1 |  1648K|  8048K|   865	(3)| 00:00:11 |
    -------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("OBJECT_ID">1)
    
    
    Statistics
    ----------------------------------------------------------
    	  1  recursive calls
    	  0  db block gets
           3652  consistent gets
    	522  physical reads
    	  0  redo size
    	518  bytes sent via SQL*Net to client
    	492  bytes received via SQL*Net from client
    	  2  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	  1  rows processed
    
    
    SQL> select count(*) from t1 where object_id>=170000;
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3018594191
    
    ---------------------------------------------------------------------------
    | Id  | Operation	  | Name  | Rows  | Bytes | Cost (%CPU)| Time	  |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |	  |	1 |	5 |   133   (1)| 00:00:02 |
    |   1 |  SORT AGGREGATE   |	  |	1 |	5 |	       |	  |
    |*  2 |   INDEX RANGE SCAN| IDX_1 | 55502 |   271K|   133   (1)| 00:00:02 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("OBJECT_ID">=170000)
    
    
    Statistics
    ----------------------------------------------------------
    	  1  recursive calls
    	  0  db block gets
    	 25  consistent gets
    	  0  physical reads
    	  0  redo size
    	516  bytes sent via SQL*Net to client
    	492  bytes received via SQL*Net from client
    	  2  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	  1  rows processed

  • 相关阅读:
    看板娘相关源码介绍
    Spring框架实体bean转json返回前端报错:Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)
    Spring Data JPA介绍以及dao层(持久层)标准接口或自定义方法规则
    BeanNotOfRequiredTypeException:Bean named 'XXXX' is expected to be of type 'XXX' but was actually of type 'com.sun.proxy.$Proxy211'
    RedisDesktopManager的编译
    Spring-Boot中@Scheduled注解不生效
    @Async 注解不生效
    使用MongoTemplate,启动时候报错:org.springframework.beans.factory.BeanCreationException
    【个人经验之谈】计算机相关的就业、培训等问题解疑答惑
    简单java mail demo收发邮件例子,各种邮件类型
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13352014.html
Copyright © 2011-2022 走看看