<?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/"
		>
<channel>
	<title>Comments on: SQL timings for ASH II</title>
	<atom:link href="/2011/05/06/sql-timings-for-ash-ii/feed/" rel="self" type="application/rss+xml" />
	<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/</link>
	<description>database performance, SQL tuning and data visualizatoin</description>
	<lastBuildDate>Tue, 20 Aug 2019 11:13:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
	<item>
		<title>By: Kyle Hailey</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-154032</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Fri, 16 Aug 2013 16:52:34 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-154032</guid>
		<description><![CDATA[@Kuwar: also using the sql_exec_id from the longest execution you can go back into ASH and see where the query was spending it&#039;s time]]></description>
		<content:encoded><![CDATA[<p>@Kuwar: also using the sql_exec_id from the longest execution you can go back into ASH and see where the query was spending it&#8217;s time</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hailey</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-154031</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Fri, 16 Aug 2013 16:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-154031</guid>
		<description><![CDATA[@Kuwar: the above query is just the averages. It doesn&#039;t tell you max and min executions nor when the max and min happened for example. The query on http://dboptimizer.com/2011/05/06/sql-ash-timings-iii/ will show you when the maximum execution happened for example. Unfortunately it doesn&#039;t give the bind variables at the time of the slowest execution, but for queries that take more than a second it can provide a better picture than the simple averages.]]></description>
		<content:encoded><![CDATA[<p>@Kuwar: the above query is just the averages. It doesn&#8217;t tell you max and min executions nor when the max and min happened for example. The query on <a href="/2011/05/06/sql-ash-timings-iii/" rel="nofollow">http://dboptimizer.com/2011/05/06/sql-ash-timings-iii/</a> will show you when the maximum execution happened for example. Unfortunately it doesn&#8217;t give the bind variables at the time of the slowest execution, but for queries that take more than a second it can provide a better picture than the simple averages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kunwar</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-154012</link>
		<dc:creator>kunwar</dc:creator>
		<pubDate>Fri, 16 Aug 2013 04:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-154012</guid>
		<description><![CDATA[&lt;a href=&quot;#comment-153971&quot; rel=&quot;nofollow&quot;&gt;@Kyle Hailey&lt;/a&gt; 
Kyle,
Below is the query i am using the get the stats from v$sql and all i wanted to show was i was getting Elapses/exec of  58.59 ms and  16.26 ms for childs 0 and 1 .
But the data from ASH shows very high figures.

set lines 200
set pages 50000
set trimspool on

col module head &quot;Module&quot; for a8 trunc
col sql_id head &quot;SQL&#124;Id&quot; for a15
col executions head &quot;Exec&quot; for 999999999
col buffer_gets head &quot;Buffer&#124;gets&quot; for 999999999999
col gpere head &quot;Buffer&#124;Gets&#124;per Exec&quot; for 999999999999.99
col dread head &quot;Disk&#124;Reads&quot; for 999999999999
col ppere head &quot;Disk&#124;Reads&#124;per Exec&quot; for 999999999999.99
col rproc head &quot;Rows&#124;Proc&quot; for 9999999999
col gperw head &quot;Gets&#124;Per&#124;Row&quot; for 9999999999
col loads head &quot;Tot&#124;Load&quot; for 9999
col invalidations head &quot;Tot&#124;Inva&quot; for 9999
col cputs head &quot;CPU&#124;Time&#124;Per Exec(ms)&quot; for 999999999.99
col elat head &quot;Eleapsed&#124;Time&#124;Per Exec(ms)&quot; for 999999999.99
col iwait head &quot;IO&#124;Wait&#124;Per Exec(ms)&quot; for 99999999
col await head &quot;App&#124;Wait&#124;Per Exec(ms)&quot; for 99999999
col ccwait head &quot;Conc&#124;Wait(ms)&quot; for 9999999
col slaves head &quot;Avg&#124;Slaves&#124;Per Exec&quot; for 99999999
col dwait head &quot;Direc&#124;Write&quot; for 999999999
col snpdt head &quot;Snap&#124;Date&quot; for a8
col cratio head &quot;Cache&#124;Ratio&quot; for 999.99

SELECT  s_hist.*
FROM
(
SELECT 
      dst.sql_id                sql_id,
      dst.plan_hash_value	phv,
      dst.child_number	        chno,
      dst.executions            executions,
      dst.buffer_gets           buffer_gets,
      dst.disk_reads            dread,
      dst.rows_processed 	rproc,
      (1-dst.disk_reads/decode(dst.buffer_gets,0,1,dst.buffer_gets))*100 cratio,
      round((dst.buffer_gets/decode(dst.executions,0,1,dst.executions)),2) gpere,
      round((dst.disk_reads/decode(dst.executions,0,1,dst.executions)),2)  ppere,
      round((dst.buffer_gets/decode(dst.rows_processed,0,1,dst.rows_processed)),2) gperw,
      ((dst.cpu_time)/1000)/decode(dst.executions,0,1,dst.executions)       cputs,
      ((dst.elapsed_time)/1000)/decode(dst.executions,0,1,dst.executions)   elat,
      ((dst.user_io_wait_time)/1000)/decode(dst.executions,0,1,dst.executions)         iwait,
      ((dst.application_wait_time)/1000)/decode(dst.executions,0,1,dst.executions)         await,
      ((dst.px_servers_executions))/decode(dst.executions,0,1,dst.executions)         slaves,
      dst.direct_writes          dwait
FROM
      v$sql		dst
WHERE dst.sql_id                =       &#039;&amp;1&#039;  
) s_hist
/]]></description>
		<content:encoded><![CDATA[<p><a href="#comment-153971" rel="nofollow">@Kyle Hailey</a><br />
Kyle,<br />
Below is the query i am using the get the stats from v$sql and all i wanted to show was i was getting Elapses/exec of  58.59 ms and  16.26 ms for childs 0 and 1 .<br />
But the data from ASH shows very high figures.</p>
<p>set lines 200<br />
set pages 50000<br />
set trimspool on</p>
<p>col module head &#8220;Module&#8221; for a8 trunc<br />
col sql_id head &#8220;SQL|Id&#8221; for a15<br />
col executions head &#8220;Exec&#8221; for 999999999<br />
col buffer_gets head &#8220;Buffer|gets&#8221; for 999999999999<br />
col gpere head &#8220;Buffer|Gets|per Exec&#8221; for 999999999999.99<br />
col dread head &#8220;Disk|Reads&#8221; for 999999999999<br />
col ppere head &#8220;Disk|Reads|per Exec&#8221; for 999999999999.99<br />
col rproc head &#8220;Rows|Proc&#8221; for 9999999999<br />
col gperw head &#8220;Gets|Per|Row&#8221; for 9999999999<br />
col loads head &#8220;Tot|Load&#8221; for 9999<br />
col invalidations head &#8220;Tot|Inva&#8221; for 9999<br />
col cputs head &#8220;CPU|Time|Per Exec(ms)&#8221; for 999999999.99<br />
col elat head &#8220;Eleapsed|Time|Per Exec(ms)&#8221; for 999999999.99<br />
col iwait head &#8220;IO|Wait|Per Exec(ms)&#8221; for 99999999<br />
col await head &#8220;App|Wait|Per Exec(ms)&#8221; for 99999999<br />
col ccwait head &#8220;Conc|Wait(ms)&#8221; for 9999999<br />
col slaves head &#8220;Avg|Slaves|Per Exec&#8221; for 99999999<br />
col dwait head &#8220;Direc|Write&#8221; for 999999999<br />
col snpdt head &#8220;Snap|Date&#8221; for a8<br />
col cratio head &#8220;Cache|Ratio&#8221; for 999.99</p>
<p>SELECT  s_hist.*<br />
FROM<br />
(<br />
SELECT<br />
      dst.sql_id                sql_id,<br />
      dst.plan_hash_value	phv,<br />
      dst.child_number	        chno,<br />
      dst.executions            executions,<br />
      dst.buffer_gets           buffer_gets,<br />
      dst.disk_reads            dread,<br />
      dst.rows_processed 	rproc,<br />
      (1-dst.disk_reads/decode(dst.buffer_gets,0,1,dst.buffer_gets))*100 cratio,<br />
      round((dst.buffer_gets/decode(dst.executions,0,1,dst.executions)),2) gpere,<br />
      round((dst.disk_reads/decode(dst.executions,0,1,dst.executions)),2)  ppere,<br />
      round((dst.buffer_gets/decode(dst.rows_processed,0,1,dst.rows_processed)),2) gperw,<br />
      ((dst.cpu_time)/1000)/decode(dst.executions,0,1,dst.executions)       cputs,<br />
      ((dst.elapsed_time)/1000)/decode(dst.executions,0,1,dst.executions)   elat,<br />
      ((dst.user_io_wait_time)/1000)/decode(dst.executions,0,1,dst.executions)         iwait,<br />
      ((dst.application_wait_time)/1000)/decode(dst.executions,0,1,dst.executions)         await,<br />
      ((dst.px_servers_executions))/decode(dst.executions,0,1,dst.executions)         slaves,<br />
      dst.direct_writes          dwait<br />
FROM<br />
      v$sql		dst<br />
WHERE dst.sql_id                =       &#8216;&amp;1&#8242;<br />
) s_hist<br />
/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hailey</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-153971</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Mon, 12 Aug 2013 17:25:23 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-153971</guid>
		<description><![CDATA[Hi Kunwar, yes the  ASH output says your query ran more than 1 second at some point.   It looks like from the to me that your query ran
 under 1 second 190 times
 over 1 second 1263 times
 over 2 seconds 303 times
for an average of 1.06 seconds based on statistical sampling
As far as the output from v$sql, I&#039;m having trouble reading it because of the formatting in the comment.]]></description>
		<content:encoded><![CDATA[<p>Hi Kunwar, yes the  ASH output says your query ran more than 1 second at some point.   It looks like from the to me that your query ran<br />
 under 1 second 190 times<br />
 over 1 second 1263 times<br />
 over 2 seconds 303 times<br />
for an average of 1.06 seconds based on statistical sampling<br />
As far as the output from v$sql, I&#8217;m having trouble reading it because of the formatting in the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kunwar</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-153965</link>
		<dc:creator>kunwar</dc:creator>
		<pubDate>Sun, 11 Aug 2013 07:03:05 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-153965</guid>
		<description><![CDATA[Hi Kyle, One question:
Are the columns MX,MN,AV showing values in seconds or millisecond????
I am getting the below stats for one of my sql id:

SQL_ID                CT         MX         MN       AV      1      2     3     4     5
------------- ---------- ---------- ---------- -------- ------ ------ ----- ----- -----
7xzf09srjz3gu       1756          2          0      1.1    190      0  1263     0   303

Which means that maximum time for any execution is 2 seconds??
From v$sql i see below stats.As far as i know any execution time for this sql won&#039;t be more than a second.

                                                                                                           Buffer             Disk        Gets           CPU      Eleapsed           IO          App
SQL                                                     Buffer          Disk        Rows   Cache             Gets            Reads         Per          Time          Time         Wait         Wait
Id                     PHV       CHNO       Exec          gets         Reads        Proc   Ratio         per Exec         per Exec         Row  Per Exec(ms)  Per Exec(ms) Per Exec(ms) Per Exec(ms)
--------------- ---------- ---------- ---------- ------------- ------------- ----------- ------- ---------------- ---------------- ----------- ------------- ------------- ------------ ------------
      Avg
   Slaves      Direc
 Per Exec      Write
--------- ----------
7xzf09srjz3gu   2560245071          0          1            15             0           0  100.00            15.00              .00          15         10.00         58.59            0            0
        0          0

7xzf09srjz3gu   1463930066          1    7576456      90270307      11546542     3531964   87.21            11.91             1.52          26           .64         16.26           16            0
        0          0


The same trend is seen for any sql id. So are you saying that for some execution the execution time was indeed approximately 2 seconds??]]></description>
		<content:encoded><![CDATA[<p>Hi Kyle, One question:<br />
Are the columns MX,MN,AV showing values in seconds or millisecond????<br />
I am getting the below stats for one of my sql id:</p>
<p>SQL_ID                CT         MX         MN       AV      1      2     3     4     5<br />
&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8211; &#8212;&#8212; &#8212;&#8212; &#8212;&#8211; &#8212;&#8211; &#8212;&#8211;<br />
7xzf09srjz3gu       1756          2          0      1.1    190      0  1263     0   303</p>
<p>Which means that maximum time for any execution is 2 seconds??<br />
From v$sql i see below stats.As far as i know any execution time for this sql won&#8217;t be more than a second.</p>
<p>                                                                                                           Buffer             Disk        Gets           CPU      Eleapsed           IO          App<br />
SQL                                                     Buffer          Disk        Rows   Cache             Gets            Reads         Per          Time          Time         Wait         Wait<br />
Id                     PHV       CHNO       Exec          gets         Reads        Proc   Ratio         per Exec         per Exec         Row  Per Exec(ms)  Per Exec(ms) Per Exec(ms) Per Exec(ms)<br />
&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;<br />
      Avg<br />
   Slaves      Direc<br />
 Per Exec      Write<br />
&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
7xzf09srjz3gu   2560245071          0          1            15             0           0  100.00            15.00              .00          15         10.00         58.59            0            0<br />
        0          0</p>
<p>7xzf09srjz3gu   1463930066          1    7576456      90270307      11546542     3531964   87.21            11.91             1.52          26           .64         16.26           16            0<br />
        0          0</p>
<p>The same trend is seen for any sql id. So are you saying that for some execution the execution time was indeed approximately 2 seconds??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DB Optimizer &#187; SQL execution times from ASH</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-462</link>
		<dc:creator>DB Optimizer &#187; SQL execution times from ASH</dc:creator>
		<pubDate>Wed, 20 Jul 2011 18:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-462</guid>
		<description><![CDATA[[...] http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] <a href="/2011/05/06/sql-timings-for-ash-ii/" rel="nofollow">http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DB Optimizer &#187; SQL ASH timings III</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-322</link>
		<dc:creator>DB Optimizer &#187; SQL ASH timings III</dc:creator>
		<pubDate>Thu, 19 May 2011 04:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-322</guid>
		<description><![CDATA[[...] histogram of execution times [...]]]></description>
		<content:encoded><![CDATA[<p>[...] histogram of execution times [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hailey</title>
		<link>http://dboptimizer.com/2011/05/06/sql-timings-for-ash-ii/#comment-316</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Thu, 19 May 2011 01:15:34 +0000</pubDate>
		<guid isPermaLink="false">http://dboptimizer.com/?p=802#comment-316</guid>
		<description><![CDATA[&gt;&gt;   Thanks for the great posts on this topic.  
&gt;&gt; I didn’t realize that sql_exec_id had been added to
&gt;&gt; dba_hist_active_sess_history.  We have some queries with
&gt;&gt; skewed and this will give us some insight into the variation  
&gt;&gt; in execution times for those queries.  We had a question about 
&gt;&gt; the values that you are passing to width_bucket().  You are 
&gt;&gt; passing 0 and mxdelta+.1 for the min_value and max_value parameters, 
&gt;&gt; respectively.  That results in very skewed histograms in your 
&gt;&gt; examples.  (There’s 1 row where there aren’t any values in 
&gt;&gt; the 1st histogram.)  Is there any reason why you are passing 
&gt;&gt; those values instead of mndelta and mxdelta?  


   Good questions. One  is easier than the other

1) Why did I use 0 for the min bucket? It was the easiest quickest thing to put for  minimum value. A better value would have been the min value ever seen for that query as the starting bucket. I thought about this but never got around to it.

2) Why did I pass in mxdelta+.1 for the max bucket? Well this is a bit of hack that I didn&#039;t look into closely but at least  meant to document but forgot to.
With width_bucket, if I ask for 5 buckets I get 2 extra for a total of 7.
The bottom is anything below my minimum, which in this case will always have 0 values as no query should have a negative response time,  so I can ignore this bucket. The largest will be anything starting with my largest value on up so if I add a tiny bit to my max value, then this bucket never have values and always be 0 so I can ignore it and I&#039;m back to my 5 buckets.
What if I just asked for 4 buckets instead? Wouldn&#039;t this work? This would give me 6 buckets and I could ignore the first giving me 5 buckets, right?
If I asked for 4 buckets then the fifth  bucket would only have single max values in it , ie no range. For the most part this bucket will just have the value 1, unless the exact maximum elapsed time happened more than once. I&#039;d prefer the 5th bucket to actually show a range rather than a single value.]]></description>
		<content:encoded><![CDATA[<p>>>   Thanks for the great posts on this topic.<br />
>> I didn’t realize that sql_exec_id had been added to<br />
>> dba_hist_active_sess_history.  We have some queries with<br />
>> skewed and this will give us some insight into the variation<br />
>> in execution times for those queries.  We had a question about<br />
>> the values that you are passing to width_bucket().  You are<br />
>> passing 0 and mxdelta+.1 for the min_value and max_value parameters,<br />
>> respectively.  That results in very skewed histograms in your<br />
>> examples.  (There’s 1 row where there aren’t any values in<br />
>> the 1st histogram.)  Is there any reason why you are passing<br />
>> those values instead of mndelta and mxdelta?  </p>
<p>   Good questions. One  is easier than the other</p>
<p>1) Why did I use 0 for the min bucket? It was the easiest quickest thing to put for  minimum value. A better value would have been the min value ever seen for that query as the starting bucket. I thought about this but never got around to it.</p>
<p>2) Why did I pass in mxdelta+.1 for the max bucket? Well this is a bit of hack that I didn&#8217;t look into closely but at least  meant to document but forgot to.<br />
With width_bucket, if I ask for 5 buckets I get 2 extra for a total of 7.<br />
The bottom is anything below my minimum, which in this case will always have 0 values as no query should have a negative response time,  so I can ignore this bucket. The largest will be anything starting with my largest value on up so if I add a tiny bit to my max value, then this bucket never have values and always be 0 so I can ignore it and I&#8217;m back to my 5 buckets.<br />
What if I just asked for 4 buckets instead? Wouldn&#8217;t this work? This would give me 6 buckets and I could ignore the first giving me 5 buckets, right?<br />
If I asked for 4 buckets then the fifth  bucket would only have single max values in it , ie no range. For the most part this bucket will just have the value 1, unless the exact maximum elapsed time happened more than once. I&#8217;d prefer the 5th bucket to actually show a range rather than a single value.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
