<?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: DOUG presentation: Why does optimizer hate my SQL?</title>
	<atom:link href="http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/</link>
	<description>Discussions about Oracle performance tuning, RAC, Oracle internal &#38; E-business suite.</description>
	<lastBuildDate>Sun, 19 May 2013 12:13:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: orainternals</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-314</link>
		<dc:creator><![CDATA[orainternals]]></dc:creator>
		<pubDate>Sun, 07 Jun 2009 14:21:03 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-314</guid>
		<description><![CDATA[Hello Randolf
   I just found your comment in the spam folder. No idea why it went in to spam and that&#039;s why the delay is.
  1.  Of course, I knew that :-)  I guess, your point is that second line should say, prior to 11g, we can mitigate this with dynamic sampling at level 4. I agree and will correct it.
  2.  True and I said that during my presentation. That line in 27 was explaining the example in later slides. I will modify that little bit to avoid confusion.
  3.  50/51 slides. Yes, I caught that during the presentation itself. But, forgot to recreate pdf before uploading.
  4.  This is exactly why I prefer to have presentation and a paper. I explained that during presentation too.
  5.  Okay your point well taken. I still think that much of OLTP queries perform better with first_rows_N optimizer mode (and I have used that successfully). But, I can see how that can also have negative effect especially after reading Jonathan&#039;s note. Let me see if i can word it better.
 
  Thanks for the feedback Randolf. I will be adding your site as reference in this presentation  :-)

Cheers
Riyaj]]></description>
		<content:encoded><![CDATA[<p>Hello Randolf<br />
   I just found your comment in the spam folder. No idea why it went in to spam and that&#8217;s why the delay is.<br />
  1.  Of course, I knew that <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   I guess, your point is that second line should say, prior to 11g, we can mitigate this with dynamic sampling at level 4. I agree and will correct it.<br />
  2.  True and I said that during my presentation. That line in 27 was explaining the example in later slides. I will modify that little bit to avoid confusion.<br />
  3.  50/51 slides. Yes, I caught that during the presentation itself. But, forgot to recreate pdf before uploading.<br />
  4.  This is exactly why I prefer to have presentation and a paper. I explained that during presentation too.<br />
  5.  Okay your point well taken. I still think that much of OLTP queries perform better with first_rows_N optimizer mode (and I have used that successfully). But, I can see how that can also have negative effect especially after reading Jonathan&#8217;s note. Let me see if i can word it better.</p>
<p>  Thanks for the feedback Randolf. I will be adding your site as reference in this presentation  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Cheers<br />
Riyaj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orainternals</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-300</link>
		<dc:creator><![CDATA[orainternals]]></dc:creator>
		<pubDate>Tue, 12 May 2009 13:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-300</guid>
		<description><![CDATA[Hi Kumar
   Thank you for visiting my blog and Thank you..]]></description>
		<content:encoded><![CDATA[<p>Hi Kumar<br />
   Thank you for visiting my blog and Thank you..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kumar</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-296</link>
		<dc:creator><![CDATA[Kumar]]></dc:creator>
		<pubDate>Sun, 03 May 2009 21:41:31 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-296</guid>
		<description><![CDATA[Hi Riyaz
Very good presentation in easy to understand format. The nice thing is it has examples which can be tried and confirmed.

- kumar]]></description>
		<content:encoded><![CDATA[<p>Hi Riyaz<br />
Very good presentation in easy to understand format. The nice thing is it has examples which can be tried and confirmed.</p>
<p>- kumar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fredericktang</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-292</link>
		<dc:creator><![CDATA[fredericktang]]></dc:creator>
		<pubDate>Fri, 24 Apr 2009 00:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-292</guid>
		<description><![CDATA[Nice presentation, I was able to pick off quite a few tips.
Thanks.

rgds,
fred]]></description>
		<content:encoded><![CDATA[<p>Nice presentation, I was able to pick off quite a few tips.<br />
Thanks.</p>
<p>rgds,<br />
fred</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randolf Geist</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-285</link>
		<dc:creator><![CDATA[Randolf Geist]]></dc:creator>
		<pubDate>Tue, 21 Apr 2009 19:43:29 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-285</guid>
		<description><![CDATA[Riyaj,

thanks for sharing the presentation. Some comments:

* Slide 25: Dynamic sampling is already available in 9i, so it&#039;s not a 10g feature. It&#039;s only that 10g by default uses level 2 whereas 9i defaults to level 1.

* Slide 27: You don&#039;t need histograms to get different plans through bind variable peeking. Range comparisons (greater than / less than etc.) or LIKE with binds are also subject to plan changes with bind variable peeking

* Slide 50/51: I think on slide 50/51 you&#039;ve mixed the &quot;good&quot; / &quot;bad&quot; clustering factor. You say on slide 50 &quot;high clustering factor&quot; but the graphics suggest that it&#039;s a &quot;good&quot; clustering factor. But a &quot;good&quot; clustering factor is &quot;low&quot; since it&#039;s close to the number of blocks. On slide 51 you say &quot;low&quot; clustering factor but again the graphics suggests a &quot;bad&quot; clustering factor which is &quot;high&quot; i.e. close to the number of rows of the table.

* Slide 55: You can index null values. You only need to add to the index a non-null column or expression. Only if the whole expression of the index is null it won&#039;t be indexed.

Your example: 

select * from t1 where n1 is null;

create index t1_idx on t1 (n1, 0);

or 

create index t1_idx on t1 (n1, &#039;&#039;);

select * from t1 where n1 is null;

---------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124;  Name       &#124; Rows  &#124; Bytes &#124; Cost  &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;             &#124;   100 &#124; 20400 &#124;    10 &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1          &#124;   100 &#124; 20400 &#124;    10 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; T1_IDX      &#124;   100 &#124;       &#124;     2 &#124;
---------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
 
   2 - access(&quot;T1&quot;.&quot;ID&quot; IS NULL)
 
* Slide 68: &quot;first_rows_N for OLTP&quot;: I don&#039;t second that. Usually a typical OLTP query identifies a very selective subset of the data, and therefore fetches all the rows identified, therefore ALL_ROWS should be in most cases the correct mode. 

See e.g. http://jonathanlewis.wordpress.com/2008/11/11/first_rows_n/

FIRST_ROWS_N is usually only applicable if you actually fetch only a part of the identified rows which are typically &quot;pagination&quot; or &quot;top n&quot; style queries. Since these should make correct use of the ROWNUM predicate the optimizer by default switches to FIRST_ROWS_N optimization (controlled by the internal parameter &quot;_optimizer_rownum_pred_based_fkr&quot;). Only if you e.g. use analytic functions for the &quot;top n&quot; or &quot;pagination&quot; an explicit activation of the FIRST_ROWS_N mode should be required.

Regards,
Randolf

Oracle related stuff blog:
http://oracle-randolf.blogspot.com/

SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/]]></description>
		<content:encoded><![CDATA[<p>Riyaj,</p>
<p>thanks for sharing the presentation. Some comments:</p>
<p>* Slide 25: Dynamic sampling is already available in 9i, so it&#8217;s not a 10g feature. It&#8217;s only that 10g by default uses level 2 whereas 9i defaults to level 1.</p>
<p>* Slide 27: You don&#8217;t need histograms to get different plans through bind variable peeking. Range comparisons (greater than / less than etc.) or LIKE with binds are also subject to plan changes with bind variable peeking</p>
<p>* Slide 50/51: I think on slide 50/51 you&#8217;ve mixed the &#8220;good&#8221; / &#8220;bad&#8221; clustering factor. You say on slide 50 &#8220;high clustering factor&#8221; but the graphics suggest that it&#8217;s a &#8220;good&#8221; clustering factor. But a &#8220;good&#8221; clustering factor is &#8220;low&#8221; since it&#8217;s close to the number of blocks. On slide 51 you say &#8220;low&#8221; clustering factor but again the graphics suggests a &#8220;bad&#8221; clustering factor which is &#8220;high&#8221; i.e. close to the number of rows of the table.</p>
<p>* Slide 55: You can index null values. You only need to add to the index a non-null column or expression. Only if the whole expression of the index is null it won&#8217;t be indexed.</p>
<p>Your example: </p>
<p>select * from t1 where n1 is null;</p>
<p>create index t1_idx on t1 (n1, 0);</p>
<p>or </p>
<p>create index t1_idx on t1 (n1, &#8221;);</p>
<p>select * from t1 where n1 is null;</p>
<p>&#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;<br />
| Id  | Operation                   |  Name       | Rows  | Bytes | Cost  |<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;<br />
|   0 | SELECT STATEMENT            |             |   100 | 20400 |    10 |<br />
|   1 |  TABLE ACCESS BY INDEX ROWID| T1          |   100 | 20400 |    10 |<br />
|*  2 |   INDEX RANGE SCAN          | T1_IDX      |   100 |       |     2 |<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;</p>
<p>Predicate Information (identified by operation id):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>   2 &#8211; access(&#8220;T1&#8243;.&#8221;ID&#8221; IS NULL)</p>
<p>* Slide 68: &#8220;first_rows_N for OLTP&#8221;: I don&#8217;t second that. Usually a typical OLTP query identifies a very selective subset of the data, and therefore fetches all the rows identified, therefore ALL_ROWS should be in most cases the correct mode. </p>
<p>See e.g. <a href="http://jonathanlewis.wordpress.com/2008/11/11/first_rows_n/" rel="nofollow">http://jonathanlewis.wordpress.com/2008/11/11/first_rows_n/</a></p>
<p>FIRST_ROWS_N is usually only applicable if you actually fetch only a part of the identified rows which are typically &#8220;pagination&#8221; or &#8220;top n&#8221; style queries. Since these should make correct use of the ROWNUM predicate the optimizer by default switches to FIRST_ROWS_N optimization (controlled by the internal parameter &#8220;_optimizer_rownum_pred_based_fkr&#8221;). Only if you e.g. use analytic functions for the &#8220;top n&#8221; or &#8220;pagination&#8221; an explicit activation of the FIRST_ROWS_N mode should be required.</p>
<p>Regards,<br />
Randolf</p>
<p>Oracle related stuff blog:<br />
<a href="http://oracle-randolf.blogspot.com/" rel="nofollow">http://oracle-randolf.blogspot.com/</a></p>
<p>SQLTools++ for Oracle (Open source Oracle GUI for Windows):<br />
<a href="http://www.sqltools-plusplus.org:7676/" rel="nofollow">http://www.sqltools-plusplus.org:7676/</a><br />
<a href="http://sourceforge.net/projects/sqlt-pp/" rel="nofollow">http://sourceforge.net/projects/sqlt-pp/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orainternals</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-284</link>
		<dc:creator><![CDATA[orainternals]]></dc:creator>
		<pubDate>Sun, 19 Apr 2009 04:21:29 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-284</guid>
		<description><![CDATA[Hi Greg
  Thanks for reading my blog. You are right about that slide and there is nothing special about 100 or 250. It is just convenience for me to visualize the histograms using one of my scripts with preset values. But, I realize that it shouldn&#039;t be a generic recommendation. I have updated the presentation correcting it. 
  
Cheers
Riyaj]]></description>
		<content:encoded><![CDATA[<p>Hi Greg<br />
  Thanks for reading my blog. You are right about that slide and there is nothing special about 100 or 250. It is just convenience for me to visualize the histograms using one of my scripts with preset values. But, I realize that it shouldn&#8217;t be a generic recommendation. I have updated the presentation correcting it. </p>
<p>Cheers<br />
Riyaj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-283</link>
		<dc:creator><![CDATA[Greg Rahn]]></dc:creator>
		<pubDate>Sat, 18 Apr 2009 23:25:57 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-283</guid>
		<description><![CDATA[Can you explain this recommendation from slide 15?
&lt;blockquote&gt;
If there are few distinct values then use that many # of buckets. 
Else use 100 or 250 depending upon the size of the table. 
&lt;/blockquote&gt;
What is special about 100 or 250 buckets?  
Why not use &lt;strong&gt;size auto&lt;/strong&gt;?]]></description>
		<content:encoded><![CDATA[<p>Can you explain this recommendation from slide 15?</p>
<blockquote><p>
If there are few distinct values then use that many # of buckets.<br />
Else use 100 or 250 depending upon the size of the table.
</p></blockquote>
<p>What is special about 100 or 250 buckets?<br />
Why not use <strong>size auto</strong>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Topics about Douglas-schools &#187; DOUG presentation: Why does optimizer hate my SQL?</title>
		<link>http://orainternals.wordpress.com/2009/04/18/doug-presentation-why-does-optimizer-hate-my-sql/#comment-282</link>
		<dc:creator><![CDATA[Topics about Douglas-schools &#187; DOUG presentation: Why does optimizer hate my SQL?]]></dc:creator>
		<pubDate>Sat, 18 Apr 2009 22:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://orainternals.wordpress.com/?p=401#comment-282</guid>
		<description><![CDATA[[...] Oracle database internals by Riyaj added an interesting post today on DOUG presentation: Why does optimizer hate my SQL?Here&#8217;s a small readingI presented about Cost based optimizer explaining why some times CBO chose inefficient access plan, even though, there is an efficient plan in the search space. This entry is to post presentation slides and they can be downloaded from Why_does_optimizer_hate_my_sql . [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Oracle database internals by Riyaj added an interesting post today on DOUG presentation: Why does optimizer hate my SQL?Here&#8217;s a small readingI presented about Cost based optimizer explaining why some times CBO chose inefficient access plan, even though, there is an efficient plan in the search space. This entry is to post presentation slides and they can be downloaded from Why_does_optimizer_hate_my_sql . [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
