前提:了解硬解析和软解析的定义
硬解析物理读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
硬解析物理读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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26477854/viewspace-1072247/