码迷,mamicode.com
首页 > 数据库 > 详细

SQL逻辑读变成零

时间:2014-07-13 22:54:22      阅读:352      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   strong   os   

使用缓存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 |
------------------------------------------------------------------------------------------
统计信息
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          0  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

 

SQL逻辑读变成零,布布扣,bubuko.com

SQL逻辑读变成零

标签:style   blog   color   使用   strong   os   

原文地址:http://www.cnblogs.com/yg_zhang/p/3840486.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!