<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Parent-Child Relationships and the Questions Left Unanswered by TKPROF, Re-Learning Something Old</title>
	<atom:link href="http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Mon, 13 May 2013 14:10:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/#comment-4371</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 05 Feb 2012 14:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5968#comment-4371</guid>
		<description><![CDATA[Rick,

Thanks for the comments.]]></description>
		<content:encoded><![CDATA[<p>Rick,</p>
<p>Thanks for the comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Parker</title>
		<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/#comment-4367</link>
		<dc:creator><![CDATA[Rick Parker]]></dc:creator>
		<pubDate>Thu, 02 Feb 2012 16:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5968#comment-4367</guid>
		<description><![CDATA[Hi Charles and Mich.

This is really cool. I came here from OTN and saw the struff that Charles is showing and then Mich&#039;s stuff. They are great, A very good explanation and examples of treating tkprof output and aggregates.

Thanks,

Rick]]></description>
		<content:encoded><![CDATA[<p>Hi Charles and Mich.</p>
<p>This is really cool. I came here from OTN and saw the struff that Charles is showing and then Mich&#8217;s stuff. They are great, A very good explanation and examples of treating tkprof output and aggregates.</p>
<p>Thanks,</p>
<p>Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mich Talebzadeh</title>
		<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/#comment-4356</link>
		<dc:creator><![CDATA[Mich Talebzadeh]]></dc:creator>
		<pubDate>Mon, 30 Jan 2012 23:20:34 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5968#comment-4356</guid>
		<description><![CDATA[Hi Charles

Thanks for the tip on using PLAN_STAT.

Anyway I modified the query to use PLAN_STAT in trace

DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=&gt;true, plan_stat=&gt;&#039;ALL_EXECUTIONS&#039; );

And that was cool as it showed the stat for 100 rows fetched. The number of physical reads (pr) from stats lines I worked out from trace file

Total pr from stat for ssdtest table scan
&lt;pre&gt;
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep STAT &#124; grep TDASH &#124; awk &#039;{print $13}&#039; &#124; sed -e &#039;s/pr=//g&#039; &#124; awk &#039;{SUM+=$0}END {print &quot;Total pr from stat lines is &quot;,SUM}&#039;
Total pr from stat lines is  194142802
&lt;/pre&gt;
&lt;pre&gt;
SELECT *
FROM
 TDASH WHERE OBJECT_ID = :B1


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.01       0.00          2         47          0           0
Execute    100      0.00       0.00          6         54          0           0
Fetch      100     13.62    6423.32  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     13.63    6423.34  194142810  194831113          0         100
&lt;/pre&gt;
Which is what it says in tkprof report for this loop section 

and Parse and Execute come from
&lt;pre&gt;
PARSING IN CURSOR #13 len=42 dep=1 uid=96 oct=3 lid=96 tim=1327941028415359 hv=605892470 ad=&#039;43fde4d40&#039; sqlid=&#039;78kxqdhk1ubvq&#039;
SELECT * FROM TDASH WHERE OBJECT_ID = :B1
END OF STMT
PARSE #13:c=12001,e=7676,p=2,cr=47,cu=0,mis=1,r=0,dep=1,og=1,plh=0,tim=1327941028415357
&lt;/pre&gt;
&lt;pre&gt;
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep &#039;EXEC #13&#039;&#124;grep -v p=0
EXEC #13:c=0,e=5333,p=6,cr=54,cu=0,mis=0,r=0,dep=1,og=1,plh=1148949653,tim=1327941028420736
&lt;/pre&gt;
2 physical blocks from PARSE and 6 from EXEC line.

Overall elapsed time
&lt;pre&gt;
PARSING IN CURSOR #12 len=226 dep=2 uid=0 oct=3 lid=0 tim=1327941028408229 hv=1011610568 ad=&#039;443ad4ef8&#039; sqlid=&#039;9tgj4g8y4rwy8&#039;
CLOSE #3:c=0,e=10,dep=0,type=0,tim=1327947451920359
&lt;/pre&gt;
&lt;pre&gt;
Time = select 1327947451920359 - 1327941028408229 from dual;

1327947451920359-1327941028408229
---------------------------------
                       6423512130 
= 6423.5 sec
&lt;/pre&gt;

and a silly one from tkprof last line
&lt;pre&gt;
    6423  elapsed seconds in trace file.
&lt;/pre&gt;

And the number of direct path reads from trace
&lt;pre&gt;
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep &#039;direct path read&#039;&#124;wc -l
total = 1517298
&lt;/pre&gt;
&lt;pre&gt;
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep &#039;direct path read&#039; &#124; awk &#039;{print $13}&#039; &#124;sed -e &#039;s/cnt=//g&#039; &gt; 111
&lt;/pre&gt;
&lt;pre&gt;
oracle@rhes564:/u01/app/oracle/diag/rdbms/mydb/mydb/trace% cat 111&#124;awk &#039;{SUM+=$0}END {print SUM}&#039;
total blocks = 193906261
Waited = cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep &#039;direct path read&#039; &#124; awk &#039;{print $7}&#039; &gt; 000
cat 000 &#124; awk &#039;{SUM+=$0}END {print SUM/1000000}&#039;
6054.28 sec
&lt;/pre&gt;

See what tkprof says:
&lt;pre&gt;
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  Disk file operations I/O                        3        0.00          0.00
  db file sequential read                         2        0.00          0.00
  direct path read                          1517298        0.07       6054.28
  asynch descriptor resize                      196        0.00          0.00
********************************************************************************
&lt;/pre&gt;

Now working out the total CPU time:

Total CPU time 
&lt;pre&gt;
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc &#124; grep &#039;EXEC #&#039; &#124; cut -d &quot;=&quot; -f2 &#124; cut -d &quot;,&quot; -f1 &#124; awk &#039;{SUM+=$0}END {print &quot;CPU in sec is &quot;,SUM/1000000}&#039;

CPU in sec is  18.2971
&lt;/pre&gt;

What does tkprof says on overall
&lt;pre&gt;
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      2      4.65       4.79        317      48643          0           2
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      4.65       4.79        317      48643          0           2


OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse       10      0.01       0.00          2         47          0           0
Execute    130      0.00       0.01          6         55          2           1
Fetch      141     13.62    6423.32  194142810  194831113          0         141
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      281     13.64    6423.35  194142818  194831215          2         142
&lt;/pre&gt;
And the sum =  4.65+ 13.64 = 18.29 sec

Which is what I get from the EXEC lines in trace file (CPU in sec is  18.2971) and it confirms that RECURSIVE  matrices do not include NON-RECURSIVE stats.

It shows that if you suspect tkprof is not giving the correct info, the best place to look is the trace file and if you have a little shell routine you can get every detail from trace file.

Regards,

Mich]]></description>
		<content:encoded><![CDATA[<p>Hi Charles</p>
<p>Thanks for the tip on using PLAN_STAT.</p>
<p>Anyway I modified the query to use PLAN_STAT in trace</p>
<p>DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=&gt;true, plan_stat=&gt;&#8217;ALL_EXECUTIONS&#8217; );</p>
<p>And that was cool as it showed the stat for 100 rows fetched. The number of physical reads (pr) from stats lines I worked out from trace file</p>
<p>Total pr from stat for ssdtest table scan</p>
<pre>
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep STAT | grep TDASH | awk '{print $13}' | sed -e 's/pr=//g' | awk '{SUM+=$0}END {print "Total pr from stat lines is ",SUM}'
Total pr from stat lines is  194142802
</pre>
<pre>
SELECT *
FROM
 TDASH WHERE OBJECT_ID = :B1


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.01       0.00          2         47          0           0
Execute    100      0.00       0.00          6         54          0           0
Fetch      100     13.62    6423.32  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     13.63    6423.34  194142810  194831113          0         100
</pre>
<p>Which is what it says in tkprof report for this loop section </p>
<p>and Parse and Execute come from</p>
<pre>
PARSING IN CURSOR #13 len=42 dep=1 uid=96 oct=3 lid=96 tim=1327941028415359 hv=605892470 ad='43fde4d40' sqlid='78kxqdhk1ubvq'
SELECT * FROM TDASH WHERE OBJECT_ID = :B1
END OF STMT
PARSE #13:c=12001,e=7676,p=2,cr=47,cu=0,mis=1,r=0,dep=1,og=1,plh=0,tim=1327941028415357
</pre>
<pre>
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep 'EXEC #13'|grep -v p=0
EXEC #13:c=0,e=5333,p=6,cr=54,cu=0,mis=0,r=0,dep=1,og=1,plh=1148949653,tim=1327941028420736
</pre>
<p>2 physical blocks from PARSE and 6 from EXEC line.</p>
<p>Overall elapsed time</p>
<pre>
PARSING IN CURSOR #12 len=226 dep=2 uid=0 oct=3 lid=0 tim=1327941028408229 hv=1011610568 ad='443ad4ef8' sqlid='9tgj4g8y4rwy8'
CLOSE #3:c=0,e=10,dep=0,type=0,tim=1327947451920359
</pre>
<pre>
Time = select 1327947451920359 - 1327941028408229 from dual;

1327947451920359-1327941028408229
---------------------------------
                       6423512130 
= 6423.5 sec
</pre>
<p>and a silly one from tkprof last line</p>
<pre>
    6423  elapsed seconds in trace file.
</pre>
<p>And the number of direct path reads from trace</p>
<pre>
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep 'direct path read'|wc -l
total = 1517298
</pre>
<pre>
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep 'direct path read' | awk '{print $13}' |sed -e 's/cnt=//g' &gt; 111
</pre>
<pre>
oracle@rhes564:/u01/app/oracle/diag/rdbms/mydb/mydb/trace% cat 111|awk '{SUM+=$0}END {print SUM}'
total blocks = 193906261
Waited = cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep 'direct path read' | awk '{print $7}' &gt; 000
cat 000 | awk '{SUM+=$0}END {print SUM/1000000}'
6054.28 sec
</pre>
<p>See what tkprof says:</p>
<pre>
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  Disk file operations I/O                        3        0.00          0.00
  db file sequential read                         2        0.00          0.00
  direct path read                          1517298        0.07       6054.28
  asynch descriptor resize                      196        0.00          0.00
********************************************************************************
</pre>
<p>Now working out the total CPU time:</p>
<p>Total CPU time </p>
<pre>
cat mydb_ora_9530_test_with_tdash_ssdtester_noindex.trc | grep 'EXEC #' | cut -d "=" -f2 | cut -d "," -f1 | awk '{SUM+=$0}END {print "CPU in sec is ",SUM/1000000}'

CPU in sec is  18.2971
</pre>
<p>What does tkprof says on overall</p>
<pre>
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      2      4.65       4.79        317      48643          0           2
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3      4.65       4.79        317      48643          0           2


OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse       10      0.01       0.00          2         47          0           0
Execute    130      0.00       0.01          6         55          2           1
Fetch      141     13.62    6423.32  194142810  194831113          0         141
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      281     13.64    6423.35  194142818  194831215          2         142
</pre>
<p>And the sum =  4.65+ 13.64 = 18.29 sec</p>
<p>Which is what I get from the EXEC lines in trace file (CPU in sec is  18.2971) and it confirms that RECURSIVE  matrices do not include NON-RECURSIVE stats.</p>
<p>It shows that if you suspect tkprof is not giving the correct info, the best place to look is the trace file and if you have a little shell routine you can get every detail from trace file.</p>
<p>Regards,</p>
<p>Mich</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/#comment-4351</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 30 Jan 2012 14:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5968#comment-4351</guid>
		<description><![CDATA[Hi Mitch,

Thanks for showing how to use Unix/Linux OS tools to parse the raw 10046 trace files.

Oracle Database 11.1.0.6 and later by default will output the STAT lines (the Row Source Operation execution plan) in a trace file only after the first execution of the SQL statement (can you see where those lines appeared in your trace, it should be shortly after the first EXEC).  Earlier versions would only output the STAT lines when the cursor was closed.  That likely explains why the TKPROF Row Source Operation execution plan shows &lt;b&gt;cr=1948310 pr=1941430&lt;/b&gt; and not &lt;b&gt;cr=194831114 pr=194142806&lt;/b&gt;.  

You can control the frequency at which the STAT lines are written with the help of the new PLAN_STAT parameter for the DBMS_MONITOR.SESSION_TRACE_ENABLE call, but there does not appear to be an option to revert back to the pre-11.1.0.6 STAT writing method:
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_monitor.htm#i1003679]]></description>
		<content:encoded><![CDATA[<p>Hi Mitch,</p>
<p>Thanks for showing how to use Unix/Linux OS tools to parse the raw 10046 trace files.</p>
<p>Oracle Database 11.1.0.6 and later by default will output the STAT lines (the Row Source Operation execution plan) in a trace file only after the first execution of the SQL statement (can you see where those lines appeared in your trace, it should be shortly after the first EXEC).  Earlier versions would only output the STAT lines when the cursor was closed.  That likely explains why the TKPROF Row Source Operation execution plan shows <b>cr=1948310 pr=1941430</b> and not <b>cr=194831114 pr=194142806</b>.  </p>
<p>You can control the frequency at which the STAT lines are written with the help of the new PLAN_STAT parameter for the DBMS_MONITOR.SESSION_TRACE_ENABLE call, but there does not appear to be an option to revert back to the pre-11.1.0.6 STAT writing method:<br />
<a href="http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_monitor.htm#i1003679" rel="nofollow">http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_monitor.htm#i1003679</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mich Talebzadeh</title>
		<link>http://hoopercharles.wordpress.com/2012/01/30/parent-child-relationships-and-the-questions-left-unanswered-by-tkprof-re-learning-something-old/#comment-4350</link>
		<dc:creator><![CDATA[Mich Talebzadeh]]></dc:creator>
		<pubDate>Mon, 30 Jan 2012 13:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5968#comment-4350</guid>
		<description><![CDATA[Hi Charles,

Thanks for details. I saw the OP questions in OTN and wondered about the points.

I do agree with your points that the trace file is best to analyze for details. Also if one uses sed and awk with trace one can pretty get the results quickly including sums!

For example I was looking at the number of waits due to direct path reads for a full table scan of order of 1,726,920 rows. What I got from tkprof report was:
&lt;pre&gt;
SELECT *
FROM
 TDASH WHERE OBJECT_ID = :B1


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          1         48          0           0
Execute    100      0.00       0.00          3         54          0           0
Fetch      100     11.99   11808.99  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     12.00   11809.00  194142806  194831114          0         100

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 93     (recursive depth: 1)

Rows     Row Source Operation
-------  ---------------------------------------------------
      1  TABLE ACCESS FULL TDASH (cr=1948310 pr=1941430 pw=0 time=0 us cost=526948 size=8092 card=1)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  Disk file operations I/O                        3        0.00          0.00
  db file sequential read                         2        0.01          0.02
  direct path read                          1468497        0.66      11397.13
  asynch descriptor resize                      196        0.00          0.00
********************************************************************************
&lt;/pre&gt;
Now let me double check that &quot;Total Waited&quot; for direct path read from the trace file itself
A &quot;typical wait&quot; for direct path in trace shows:
&lt;pre&gt;
WAIT #13: nam=&#039;direct path read&#039; ela= 7509 file number=13 first dba=544512 block cnt=128 obj#=75856 tim=1327880589449318
&lt;/pre&gt;
The block size count may vary from 16 to 120, 126 and 128. 

So roughly we expect 7509 microseconds elapsed time for each wait
&lt;pre&gt;
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc &#124; grep &#039;direct path read&#039; &#124; wc -l
1468497 
&lt;/pre&gt;
OK we have 1468497 waits in this case that agrees with tkprof report

Get the elapsed time
&lt;pre&gt;
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc &#124; grep &#039;direct path read&#039; &#124; awk &#039;{print $7}&#039; &gt; 000
&lt;/pre&gt;
Sum the elapsed time
&lt;pre&gt;
cat ooo &#124; awk &#039;{SUM+=$0}END {print SUM/1000000}&#039;

11397.1 sec
&lt;/pre&gt;
So that is what tkprof is showing

Sum the number of blocks read
&lt;pre&gt;
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc &#124; grep &#039;direct path&#039; &#124; grep 75856 &#124; awk &#039;{print $13}&#039; &#124; sed -e &#039;s/cnt=//g&#039; &gt; 111
cat 111&#124;awk &#039;{SUM+=$0}END {print SUM}&#039;
187631839
&lt;/pre&gt;
So we read 187,631,839 blocks via direct path read. the stat shows 
&lt;pre&gt;
Rows     Row Source Operation
-------  ---------------------------------------------------
      1  TABLE ACCESS FULL TDASH (cr=1948310 pr=1941430 pw=0 time=0 us cost=526948 size=8092 card=1)
&lt;/pre&gt;
Now the way I interpret this is that each row resulted in 1948310 buffer reads that included 1,941,430 physical block reads. In my case I read the first 100 rows from the table and hence would expect 194,831,000 buffers reads and 194,143,000 physical block reads. Let us check against tkprof report. It shows 194142806 physical block reads and 194831114 buffer reads as below.
&lt;pre&gt;
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          1         48          0           0
Execute    100      0.00       0.00          3         54          0           0
Fetch      100     11.99   11808.99  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     12.00   11809.00  194142806  194831114          0         100
&lt;/pre&gt;
So in summary it is really a bit of intution I guess.

I found this article very useful. Thanks for sharing your findings Charles

Regards,

Mich]]></description>
		<content:encoded><![CDATA[<p>Hi Charles,</p>
<p>Thanks for details. I saw the OP questions in OTN and wondered about the points.</p>
<p>I do agree with your points that the trace file is best to analyze for details. Also if one uses sed and awk with trace one can pretty get the results quickly including sums!</p>
<p>For example I was looking at the number of waits due to direct path reads for a full table scan of order of 1,726,920 rows. What I got from tkprof report was:</p>
<pre>
SELECT *
FROM
 TDASH WHERE OBJECT_ID = :B1


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          1         48          0           0
Execute    100      0.00       0.00          3         54          0           0
Fetch      100     11.99   11808.99  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     12.00   11809.00  194142806  194831114          0         100

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 93     (recursive depth: 1)

Rows     Row Source Operation
-------  ---------------------------------------------------
      1  TABLE ACCESS FULL TDASH (cr=1948310 pr=1941430 pw=0 time=0 us cost=526948 size=8092 card=1)


Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  Disk file operations I/O                        3        0.00          0.00
  db file sequential read                         2        0.01          0.02
  direct path read                          1468497        0.66      11397.13
  asynch descriptor resize                      196        0.00          0.00
********************************************************************************
</pre>
<p>Now let me double check that &#8220;Total Waited&#8221; for direct path read from the trace file itself<br />
A &#8220;typical wait&#8221; for direct path in trace shows:</p>
<pre>
WAIT #13: nam='direct path read' ela= 7509 file number=13 first dba=544512 block cnt=128 obj#=75856 tim=1327880589449318
</pre>
<p>The block size count may vary from 16 to 120, 126 and 128. </p>
<p>So roughly we expect 7509 microseconds elapsed time for each wait</p>
<pre>
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc | grep 'direct path read' | wc -l
1468497 
</pre>
<p>OK we have 1468497 waits in this case that agrees with tkprof report</p>
<p>Get the elapsed time</p>
<pre>
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc | grep 'direct path read' | awk '{print $7}' &gt; 000
</pre>
<p>Sum the elapsed time</p>
<pre>
cat ooo | awk '{SUM+=$0}END {print SUM/1000000}'

11397.1 sec
</pre>
<p>So that is what tkprof is showing</p>
<p>Sum the number of blocks read</p>
<pre>
cat mydb_ora_30587_test_with_tdash_tester_noindex.trc | grep 'direct path' | grep 75856 | awk '{print $13}' | sed -e 's/cnt=//g' &gt; 111
cat 111|awk '{SUM+=$0}END {print SUM}'
187631839
</pre>
<p>So we read 187,631,839 blocks via direct path read. the stat shows </p>
<pre>
Rows     Row Source Operation
-------  ---------------------------------------------------
      1  TABLE ACCESS FULL TDASH (cr=1948310 pr=1941430 pw=0 time=0 us cost=526948 size=8092 card=1)
</pre>
<p>Now the way I interpret this is that each row resulted in 1948310 buffer reads that included 1,941,430 physical block reads. In my case I read the first 100 rows from the table and hence would expect 194,831,000 buffers reads and 194,143,000 physical block reads. Let us check against tkprof report. It shows 194142806 physical block reads and 194831114 buffer reads as below.</p>
<pre>
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          1         48          0           0
Execute    100      0.00       0.00          3         54          0           0
Fetch      100     11.99   11808.99  194142802  194831012          0         100
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      201     12.00   11809.00  194142806  194831114          0         100
</pre>
<p>So in summary it is really a bit of intution I guess.</p>
<p>I found this article very useful. Thanks for sharing your findings Charles</p>
<p>Regards,</p>
<p>Mich</p>
]]></content:encoded>
	</item>
</channel>
</rss>
