你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle 工具:tkprof

[日期:2012-09-24] 来源:Linux社区  作者:linwaterbin [字体:大 中 小]

这个tkprof文件最后的一部分如下:

  1. OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS  
  2.   
  3. call     count       cpu    elapsed       disk      query    current        rows  
  4. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  5. Parse       11      0.03       0.16          0          0          0           0  
  6. Execute     41      0.07       0.22          0          0          0           0  
  7. Fetch       48      0.03       0.12          3        118          0          50  
  8. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  9. total      100      0.14       0.51          3        118          0          50  
  10.   
  11. Misses in library cache during parse: 11  
  12. Misses in library cache during execute: 11  
  13.   
  14. Elapsed times include waiting on following events:  
  15.   Event waited on                             Times   Max. Wait  Total Waited  
  16.   ----------------------------------------   Waited  ----------  ------------   
  17.   db file sequential read                         3        0.02          0.05  
  18.   
  19.     3  user  SQL statements in session.  
  20.    41  internal SQL statements in session.  
  21.    44  SQL statements in session.  
  22. ********************************************************************************  
  23. Trace file: orcl_ora_6004.trc  
  24. Trace file compatibility: 10.01.00  
  25. Sort options: fchela    
  26.        1  session in tracefile.  
  27.        3  user  SQL statements in trace file.  
  28.       41  internal SQL statements in trace file.  
  29.       44  SQL statements in trace file.  
  30.       14  unique SQL statements in trace file.  
  31.      902  lines in trace file.  
  32.       55  elapsed seconds in trace file.  

注释:

① 这个session共有44条sql语句在里面,对于递归的语句一共分析了41次

② 计算hit ratio

logical reads=consistent gets+ db block gets

consistent gets=query列的execute+query列的fetch

db block gets=current列的execute+current列的fetch

因此,logical reads=118+0+0+0=118

physical reads=disk列,即:3

所以,hit ratio=L/(L+P)=97.5%

③ 还有一对参数非常重要,fetch的次数以及取得的记录的行数,一般来说,以尽可能少的fetch来取得尽可能多的记录数,也就是,fetch的值要远远小于取得的记录数才好。从上面这个例子可知,fetch了48,rows 50,这表明有些记录是通过好几次的fetch才得到的。这个session的有些sql是需要优化的。

④ 从query列的parse可以看出从row cache里读取的数据

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款