使用缓存HINT 让逻辑读变成0.

create table t as select * from dba_objects;
insert into t select * from t;
commit;
set autotrace on
set timing on
set linesize 1000
select /*+ result_cache */ count(*) from t; ---接下来再次执行(居然发现逻辑读为0):
set autotrace on
select /*+ result_cache */ count(*) from t;

执行计划:

SQL> set autotrace on
SQL> select /*+ result_cache */ count(*) from t;
COUNT(*)
----------
145762
已用时间: 00: 00: 00.01
执行计划
------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 589 (1)| 00:00:08 |
| 1 | RESULT CACHE | d827qx1jmwjc86yqynrp1kvpny | | | |
| 2 | SORT AGGREGATE | | 1 | | |
| 3 | TABLE ACCESS FULL| T | 277K| 589 (1)| 00:00:08 |
------------------------------------------------------------------------------------------
统计信息
----------------------------------------------------------
recursive calls
db block gets
consistent gets
0 physical reads
0 redo size
425 bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
05-08 08:28