<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>The Oracle Instructor</title>
	<atom:link href="http://uhesse.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://uhesse.com</link>
	<description>Explain, Exemplify, Empower</description>
	<lastBuildDate>Wed, 22 May 2013 10:01:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='uhesse.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/b84180298f7f793d1504fa3912ccc5dd?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>The Oracle Instructor</title>
		<link>http://uhesse.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://uhesse.com/osd.xml" title="The Oracle Instructor" />
	<atom:link rel='hub' href='http://uhesse.com/?pushpress=hub'/>
		<item>
		<title>Evidence for successful #Oracle Performance Tuning</title>
		<link>http://uhesse.com/2013/04/16/evidence-for-successful-oracle-performance-tuning/</link>
		<comments>http://uhesse.com/2013/04/16/evidence-for-successful-oracle-performance-tuning/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 09:50:52 +0000</pubDate>
		<dc:creator>Uwe Hesse</dc:creator>
				<category><![CDATA[TOI]]></category>
		<category><![CDATA[AWR]]></category>
		<category><![CDATA[Performance Tuning]]></category>

		<guid isPermaLink="false">http://uhesse.com/?p=1292</guid>
		<description><![CDATA[This article shows an easy way to determine, whether your Oracle Database Performance Tuning task has been successful &#8211; or not. In the end, it boils down to &#8220;The objective for tuning an Oracle system could be stated as reducing the time that users spend in performing some action on the database, or simply reducing [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uhesse.com&#038;blog=6195767&#038;post=1292&#038;subd=uhesse&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:justify;">This article shows an easy way to determine, whether your Oracle Database Performance Tuning task has been successful &#8211; or not. In the end, it boils down to <em>&#8220;The objective for tuning an Oracle system could be stated as reducing the time that users spend in performing some action on the database, or simply <span style="color:#ff0000;">reducing DB time</span>.&#8221;</em> as the <a title="...simply reducing DB time." href="http://docs.oracle.com/cd/E11882_01/server.112/e16638/autostat.htm#i37457" target="_blank">Online Documentation</a> says. Best proof would be a confirmation from the end users that run time got reduced; second best is a proof of reduced DB time, which is discussed here.</p>
<p style="text-align:justify;">A tuning task should always end with such a proof; your gut feeling or high confidence is not sufficient &#8211; or as I like to say: &#8220;Don&#8217;t believe it, test it!&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p style="text-align:justify;">The demo scenario: With an Oracle Enterprise Edition version 11.2.0.3, an application uses these commands to delete rows:</p>
<pre style="text-align:justify;"><code>SQL&gt; create table t as select * from dual <span style="color:#ff0000;">where 1=2 -- see * below ;
 </span></code>
Table created.
SQL&gt; begin
 for i in 1..100000 loop
 execute immediate 'delete from t where dummy='||to_char(i);
 end loop;
 end;
 /</pre>
<p style="text-align:justify;">I am pretty sure that this code is not optimal, because it uses <a href="http://uhesse.com/2009/12/22/when-to-use-bindvariables-or-literals/" target="_blank">Literals instead of Bind Variables</a> where it is not appropriate. Before I implement an improved version of the code, I take a <span style="color:#ff0000;">Baseline</span> with Automatic Workload Repository (AWR) snapshots. On my demo system, snapshots are taken every ten minutes:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/em_homepage_850.png"><img class="aligncenter size-full wp-image-1293" alt="EM Homepage at 8:51 am" src="http://uhesse.files.wordpress.com/2013/04/em_homepage_850.png?w=620&#038;h=282" width="620" height="282" /></a>The code with Literals was just called &#8211; now about 10 minutes later on the Enterprise Manager (EM) Performance page:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/cpu_peak_850.png"><img class="aligncenter size-full wp-image-1294" alt="CPU peak on EM Performance page" src="http://uhesse.files.wordpress.com/2013/04/cpu_peak_850.png?w=620&#038;h=408" width="620" height="408" /></a>The AWR report that I take (with EM or with awrrpt.sql) as the baseline shows the following:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/awr_baseline_1.png"><img class="aligncenter size-full wp-image-1295" alt="AWR report baseline DB time" src="http://uhesse.files.wordpress.com/2013/04/awr_baseline_1.png?w=620"   /></a>Notice especially the poor <em>Library Cache</em> hit ration, significant for not using Bind Variables &#8211; and the meaningless high <em>Buffer Cache</em> hit ration <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/awr_baseline_2.png"><img class="aligncenter size-full wp-image-1296" alt="AWR baseline low Library Cache hit ratio" src="http://uhesse.files.wordpress.com/2013/04/awr_baseline_2.png?w=620"   /></a>Starting <span style="color:#ff0000;">after 9:00 am</span>, my improved code that uses Bind Variables runs:</p>
<pre><code>SQL&gt; begin
 for i in 1..100000 loop
 delete from t where dummy=to_char(i);
 end loop;
 end; 
 /</code></pre>
<p style="text-align:justify;">The EM Performance page show no peak during the next 10 minutes which represent my <span style="color:#ff0000;">comparison period</span> after the tuning task:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/no_peak.png"><img class="aligncenter size-full wp-image-1297" alt="No peak on EM Performance page after tuning task" src="http://uhesse.files.wordpress.com/2013/04/no_peak.png?w=620&#038;h=403" width="620" height="403" /></a>Let&#8217;s look at the AWR report of the second snapshot range after the tuning task:</p>
<p style="text-align:justify;"><a href="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task1.png"><img class="aligncenter size-full wp-image-1298" alt="AWR report after tuning task shows reduced DB time" src="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task1.png?w=620"   /></a><strong>Same wall clock time, same application load, but reduced DB time &#8211; I was successful!</strong> Could stop here, but some more details:</p>
<p style="text-align:justify;"><a href="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task2.png"><img class="aligncenter size-full wp-image-1299" alt="AWR report shows improved Library Cache hit ratio" src="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task2.png?w=620"   /></a>The important (especially for OLTP systems) Library Cache hit ratio is now very good. A very convenient way to compare the two snapshot ranges is the &#8216;AWR Compare Periods&#8217; feature in EM (or awrddrpt.sql) , which shows us instructively:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/compare_dbtime.png"><img class="aligncenter size-full wp-image-1300" alt="AWR Compare Periods with less DB time" src="http://uhesse.files.wordpress.com/2013/04/compare_dbtime.png?w=620&#038;h=228" width="620" height="228" /></a>Although in both periods, CPU was the top event (also in % DB time), it took much less time in total for the 2nd period:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/compare_topevents.png"><img class="aligncenter size-full wp-image-1301" alt="AWR compare periods with less CPU wait for 2nd period" src="http://uhesse.files.wordpress.com/2013/04/compare_topevents.png?w=620&#038;h=163" width="620" height="163" /></a>The Time Model Statistics confirm a strongly reduced Parse Time for the 2nd period:</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/time_model_statistics.png"><img class="aligncenter size-full wp-image-1302" alt="Time Model Statistics show reduced Parse Time for 2nd period" src="http://uhesse.files.wordpress.com/2013/04/time_model_statistics.png?w=620&#038;h=461" width="620" height="461" /></a>Especially, we see a striking improvement for the run time of the code with Bind Variables: From about 82 seconds down to about 3 seconds!</p>
<p style="text-align:justify;"><a href="http://uhesse.files.wordpress.com/2013/04/sql_comparison.png"><img class="aligncenter size-full wp-image-1303" alt="SQL comparison section show much less run time in 2nd period" src="http://uhesse.files.wordpress.com/2013/04/sql_comparison.png?w=620&#038;h=327" width="620" height="327" /></a>This kind of proof (less DB time) can be used also in cases where the reduction of run time for a single statement is not so obvious as in my example. If 1000 users had done each 100 deletes, they would have seen not much difference in run time each &#8211; but the parse time summarizes and impacts overall performance similar as seen here. If you would like to see the three original AWR reports were I took the screen shots above from, they are here as PDFs</p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/awr_report_baseline.pdf">AWR_Report_baseline</a></p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/awr_report_after_tuning_task.pdf">AWR_report_after_tuning_task</a></p>
<p><a href="http://uhesse.files.wordpress.com/2013/04/awr_compare_periods.pdf">AWR_Compare_Periods</a></p>
<p style="text-align:justify;"><strong>Conclusion:</strong> You will &#8211; and should &#8211; be able to prove the effectiveness of your Oracle Database Tuning task with a reduction of DB time from an AWR report comparison. After all, you don&#8217;t want to waste your efforts, do you? <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p style="text-align:justify;"><span style="color:#ff0000;">*</span> My apologies to anyone who tried the first code without the addendum <span style="color:#ff0000;">where1=2</span> &#8211; it doesn&#8217;t work. Apparently, I have deleted the one row in the table during my preparation of the demo.</p>
<br /> Tagged: <a href='http://uhesse.com/tag/awr/'>AWR</a>, <a href='http://uhesse.com/tag/performance-tuning/'>Performance Tuning</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uhesse.wordpress.com/1292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uhesse.wordpress.com/1292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uhesse.wordpress.com/1292/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uhesse.com&#038;blog=6195767&#038;post=1292&#038;subd=uhesse&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uhesse.com/2013/04/16/evidence-for-successful-oracle-performance-tuning/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<georss:point>48.139127 11.580186</georss:point>
		<geo:lat>48.139127</geo:lat>
		<geo:long>11.580186</geo:long>
		<media:content url="http://1.gravatar.com/avatar/73cdb20b4d2a2fa1f3c7b63f8d32b6b0?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Uwe Hesse</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/em_homepage_850.png" medium="image">
			<media:title type="html">EM Homepage at 8:51 am</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/cpu_peak_850.png" medium="image">
			<media:title type="html">CPU peak on EM Performance page</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/awr_baseline_1.png" medium="image">
			<media:title type="html">AWR report baseline DB time</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/awr_baseline_2.png" medium="image">
			<media:title type="html">AWR baseline low Library Cache hit ratio</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/no_peak.png" medium="image">
			<media:title type="html">No peak on EM Performance page after tuning task</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task1.png" medium="image">
			<media:title type="html">AWR report after tuning task shows reduced DB time</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/awr_after_tuning_task2.png" medium="image">
			<media:title type="html">AWR report shows improved Library Cache hit ratio</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/compare_dbtime.png" medium="image">
			<media:title type="html">AWR Compare Periods with less DB time</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/compare_topevents.png" medium="image">
			<media:title type="html">AWR compare periods with less CPU wait for 2nd period</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/time_model_statistics.png" medium="image">
			<media:title type="html">Time Model Statistics show reduced Parse Time for 2nd period</media:title>
		</media:content>

		<media:content url="http://uhesse.files.wordpress.com/2013/04/sql_comparison.png" medium="image">
			<media:title type="html">SQL comparison section show much less run time in 2nd period</media:title>
		</media:content>
	</item>
	</channel>
</rss>
