硬解析物理讀VS軟解析邏輯讀 測試

yuanzai32發表於2014-01-17
前提:瞭解硬解析和軟解析的定義

硬解析物理讀VS軟解析邏輯讀

這部分比較簡單,無須多說,直接看結果
zo_leave@orcl> alter system set events 'immediate trace name flush_cache'; -- 清除緩衝區快取


系統已更改。


已用時間:  00: 00: 16.44


zo_leave@orcl> alter system flush shared_pool;   -- 清除共享池


系統已更改。


已用時間:  00: 00: 00.73
zo_leave@orcl> set autotrace traceo


zo_leave@orcl> select * from scott.emp where deptno = '10';


已用時間:  00: 00: 00.10


執行計劃
----------------------------------------------------------
Plan hash value: 3956160932


--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     3 |   261 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMP  |     3 |   261 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   1 - filter("DEPTNO"=10)


Note
-----
   - dynamic sampling used for this statement




統計資訊
----------------------------------------------------------
        522  recursive calls
          0  db block gets
         92  consistent gets
         18  physical reads
          0  redo size
        943  bytes sent via SQL*Net to client
        416  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          6  sorts (memory)
          0  sorts (disk)
          3  rows processed


-- 僅清空清除緩衝區快取
zo_leave@orcl> set autotrace off
zo_leave@orcl> alter system set events 'immediate trace name flush_cache';


系統已更改。


已用時間:  00: 00: 10.56
zo_leave@orcl> set autotrace traceo
zo_leave@orcl> select * from scott.emp where deptno = '10';


已用時間:  00: 00: 00.03


執行計劃
----------------------------------------------------------
Plan hash value: 3956160932


--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     3 |   261 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMP  |     3 |   261 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   1 - filter("DEPTNO"=10)


Note
-----
   - dynamic sampling used for this statement




統計資訊
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          8  consistent gets
          6  physical reads
          0  redo size
        943  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)
          3  rows processed


-- 不做任何處理
zo_leave@orcl> select * from scott.emp where deptno = '10';


已用時間:  00: 00: 00.00


執行計劃
----------------------------------------------------------
Plan hash value: 3956160932


--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     3 |   261 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMP  |     3 |   261 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   1 - filter("DEPTNO"=10)


Note
-----
   - dynamic sampling used for this statement




統計資訊
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          8  consistent gets
          0  physical reads
          0  redo size
        943  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)
          3  rows processed




 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26477854/viewspace-1072247/,如需轉載,請註明出處,否則將追究法律責任。

相關文章