`
1enny
  • 浏览: 70232 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

SQL语句的解析_硬解析_软解析

 
阅读更多
oracle010

SQL语句的解析_硬解析_软解析

share pool:缓存sql语句和执行计划

sql语句的三大步骤:1. 解析(parse)、执行(EXE)、获取数据(fetch)

share pool的三大组成:free、库缓存(Libera cache)(sql、执行计划)、字典缓存(row cache)

数据字典:数据库自身的信息
select * from v$sgastat a where a.pool='share pool' and a.NAME='free memery';
select * from v$sgastat a where a.NAME like '%row cache%';


解析:硬解析和软解析(都要平凡的访问数据字典,所以数据把数据字典放在share pre中)
硬解析:在library cache中没有缓存,就硬解析
解析:检查语句的语法、用户权限、表是否存在和选择最合适的执行方案(最消耗资源)做为执行计划
软解析:在library cache中有缓存,但还要软解析
解析:判断用户权限,没有选执行方案

SQL> select * from v$sysstat where NAME like 'parse%';

STATISTIC# NAME
---------- ----------------------------------------------------------------
CLASS VALUE STAT_ID
---------- ---------- ----------
547 parse time cpu
64 1970 206905303

548 parse time elapsed
64 9716 1431595225

549 parse count (total)//总共解析数目
64 55536 63887964

550 parse count (hard)//硬解析数目,软解析:total-hard
64 4572 143509059

551 parse count (failures)//失败的解析条数
64 31 1118776443

552 parse count (describe)
64 12 469016317
通过软、硬解析可以知道解析的命中率,可以通过他来进行适当的优化



















分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics