这个tkprof文件最后的一部分如下:
- OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
- call count cpu elapsed disk query current rows
- ------- ------ -------- ---------- ---------- ---------- ---------- ----------
- Parse 11 0.03 0.16 0 0 0 0
- Execute 41 0.07 0.22 0 0 0 0
- Fetch 48 0.03 0.12 3 118 0 50
- ------- ------ -------- ---------- ---------- ---------- ---------- ----------
- total 100 0.14 0.51 3 118 0 50
- Misses in library cache during parse: 11
- Misses in library cache during execute: 11
- Elapsed times include waiting on following events:
- Event waited on Times Max. Wait Total Waited
- ---------------------------------------- Waited ---------- ------------
- db file sequential read 3 0.02 0.05
- 3 user SQL statements in session.
- 41 internal SQL statements in session.
- 44 SQL statements in session.
- ********************************************************************************
- Trace file: orcl_ora_6004.trc
- Trace file compatibility: 10.01.00
- Sort options: fchela
- 1 session in tracefile.
- 3 user SQL statements in trace file.
- 41 internal SQL statements in trace file.
- 44 SQL statements in trace file.
- 14 unique SQL statements in trace file.
- 902 lines in trace file.
- 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里读取的数据
