首页 > 代码库 > SQL逻辑读变成零
SQL逻辑读变成零
使用缓存HINT 让逻辑读变成0.
create table t as select * from dba_objects;insert into t select * from t;commit;set autotrace onset timing onset linesize 1000select /*+ result_cache */ count(*) from t;---接下来再次执行(居然发现逻辑读为0):set autotrace on select /*+ result_cache */ count(*) from t;
执行计划:
SQL> set autotrace onSQL> 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。