先执行

SQL> alter session set statistics_level=all;

会话已更改。

再执行SQL语句:

SQL> select count(*) from tb_16million;

  COUNT(*)
----------
  16000000

再查看带有A-time的执行计划:

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

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------
SQL_ID  8k8dgbz5g9cta, child number 0
-------------------------------------
select count(*) from tb_16million

Plan hash value: 685847080

------------------------------------------------------------------------------------------------------------
| Id  | Operation             | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |                 |      1 |        |      1 |00:00:02.44 |   35573 |   1707 |
|   1 |  SORT AGGREGATE       |                 |      1 |      1 |      1 |00:00:02.44 |   35573 |   1707 |

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------
|   2 |   INDEX FAST FULL SCAN| TB_16MILLION_PK |      1 |     16M|     16M|00:00:01.77 |   35573 |   1707 |
------------------------------------------------------------------------------------------------------------


已选择14行。

SQL>