SQL逻辑读变成零
使用缓存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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。