Oracle解释计划中的时间不一致

时间:2017-06-21 19:25:09

标签: sql oracle database-performance

我有以下查询,其EXPLAIN PLAN如下所示。

查询需要2.3秒。

但EXPLAIN PLAN显示INDEX FAST FULL SCAN显示时间= 00:10:06秒

有什么理由?

select count(*) from c1
COUNT(*)
----------
  68656440

Elapsed: 00:00:02.31

Execution Plan
----------------------------------------------------------
Plan hash value: 2610173813

-------------------------------------------------------------------------
| Id  | Operation             | Name    | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |         |     1 | 50450   (1)| 00:10:06 |
|   1 |  SORT AGGREGATE       |         |     1 |            |          |
|   2 |   INDEX FAST FULL SCAN| PF_TEST |    83M| 50450   (1)| 00:10:06 |
-------------------------------------------------------------------------

Note
-----

- 用于此语句的动态采样(级别= 2)

统计

      0  recursive calls
      0  db block gets
 185865  consistent gets
 185820  physical reads
      0  redo size
    529  bytes sent via SQL*Net to client
    523  bytes received via SQL*Net from client
      2  SQL*Net roundtrips to/from client
      0  sorts (memory)
      0  sorts (disk)
      1  rows processed

1 个答案:

答案 0 :(得分:2)

解释计划是对oracle认为执行该语句需要的估计,试试这个:

set timi on
select count(*) from c1;
set timi off

select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

然后看一下A-time列,是否准确? 应该是。