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

Oracle 工具:tkprof

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

这个tkprof文件中两个sql语句摘入如下:

  1. ********************************************************************************  
  2.   
  3. select count(*)   
  4. from  
  5.  t  
  6.   
  7.   
  8. call     count       cpu    elapsed       disk      query    current        rows  
  9. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  10. Parse        1      0.01       0.06          0          0          0           0  
  11. Execute      1      0.00       0.00          0          0          0           0  
  12. Fetch        2      0.00       0.01          6          7          0           1  
  13. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  14. total        4      0.01       0.08          6          7          0           1  
  15.   
  16. Misses in library cache during parse: 1  
  17. Optimizer mode: ALL_ROWS  
  18. Parsing user id: 55    
  19.   
  20. Rows     Row Source Operation  
  21. -------  ---------------------------------------------------   
  22.       1  SORT AGGREGATE (cr=7 pr=6 pw=0 time=15493 us)  
  23.       2   TABLE ACCESS FULL T (cr=7 pr=6 pw=0 time=15449 us)  
  24.   
  25.   
  26. Elapsed times include waiting on following events:  
  27.   Event waited on                             Times   Max. Wait  Total Waited  
  28.   ----------------------------------------   Waited  ----------  ------------   
  29.   SQL*Net message to client                       2        0.00          0.00  
  30.   db file sequential read                         1        0.01          0.01  
  31.   db file scattered read                          1        0.00          0.00  
  32.   SQL*Net message from client                     2        0.00          0.00  

注释:

从上面的输出可以看到,这条语句访问了7个块来找到需要select的记录,返回1条记录。

这个查询parse了1次,而且是hard parse 1次。

select语句主要看fetch这一行

  1. ********************************************************************************  
  2.   
  3. update t1 set tname='think high'   
  4. where  
  5.  id=1  
  6.   
  7.   
  8. call     count       cpu    elapsed       disk      query    current        rows  
  9. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  10. Parse        1      0.00       0.00          0          0          0           0  
  11. Execute      1      0.00       0.03          0          5          2           1  
  12. Fetch        0      0.00       0.00          0          0          0           0  
  13. ------- ------  -------- ---------- ---------- ---------- ----------  ----------   
  14. total        2      0.00       0.03          0          1          1           1  
  15.   
  16. Misses in library cache during parse: 1  
  17. Optimizer mode: ALL_ROWS  
  18. Parsing user id: 55    
  19.   
  20. Rows     Row Source Operation  
  21. -------  ---------------------------------------------------   
  22.       1  UPDATE  T1 (cr=1 pr=0 pw=0 time=31186 us)  
  23.       1   INDEX UNIQUE SCAN INDEX_T1 (cr=1 pr=0 pw=0 time=23 us)(object id 54498)  
  24.   
  25.   
  26. Elapsed times include waiting on following events:  
  27.   Event waited on                             Times   Max. Wait  Total Waited  
  28.   ----------------------------------------   Waited  ----------  ------------   
  29.   SQL*Net message to client                       1        0.00          0.00  
  30.   SQL*Net message from client                     1        0.00          0.00  

注释:

这条语句访问了5个block来找到需要的update的记录,在执行update的时候只访问了2个,一共更新了1条记录

DML语句主要看execute这一行

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

       

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