<?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: CBO Surprise</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 19 Jun 2013 11:02:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: FBI Bug &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-43819</link>
		<dc:creator><![CDATA[FBI Bug &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Fri, 30 Dec 2011 17:48:22 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-43819</guid>
		<description><![CDATA[[...] this version of Oracle this resulted in the predicates being treated as &#8220;guesses on an index range scan&#8221; &#8211; which resulted in the optimizer ignoring the appropriate index (until hinted) even though [...]]]></description>
		<content:encoded><![CDATA[<p>[...] this version of Oracle this resulted in the predicates being treated as &#8220;guesses on an index range scan&#8221; &#8211; which resulted in the optimizer ignoring the appropriate index (until hinted) even though [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FBI Bug &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37637</link>
		<dc:creator><![CDATA[FBI Bug &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sun, 31 Oct 2010 08:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37637</guid>
		<description><![CDATA[[...] Update (31st Oct 2010):  I did a little extra work on this issue a few weeks later ago (see comments and pingback below), but forgot to link forward to the new article. My original conclusions were wrong; for more details see: http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Update (31st Oct 2010):  I did a little extra work on this issue a few weeks later ago (see comments and pingback below), but forgot to link forward to the new article. My original conclusions were wrong; for more details see: <a href="http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/" rel="nofollow">http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Peter</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37456</link>
		<dc:creator><![CDATA[Hans-Peter]]></dc:creator>
		<pubDate>Fri, 01 Oct 2010 17:27:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37456</guid>
		<description><![CDATA[Good that you noticed it Martin.
Thanks]]></description>
		<content:encoded><![CDATA[<p>Good that you noticed it Martin.<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Decker</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37445</link>
		<dc:creator><![CDATA[Martin Decker]]></dc:creator>
		<pubDate>Fri, 01 Oct 2010 06:56:46 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37445</guid>
		<description><![CDATA[Dear Hans-Peter,

the problem reproduces even on 11.2.0.1.2. You have accidentally not given the right table name/alias in the hint for the second example. This is why the optimizer did not honour your hint:

should be :

/*+ index(t1xx t1_range) */
instead of:
/*+ index(t1 t1_range) */

Regards,
Martin]]></description>
		<content:encoded><![CDATA[<p>Dear Hans-Peter,</p>
<p>the problem reproduces even on 11.2.0.1.2. You have accidentally not given the right table name/alias in the hint for the second example. This is why the optimizer did not honour your hint:</p>
<p>should be :</p>
<p>/*+ index(t1xx t1_range) */<br />
instead of:<br />
/*+ index(t1 t1_range) */</p>
<p>Regards,<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Peter</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37243</link>
		<dc:creator><![CDATA[Hans-Peter]]></dc:creator>
		<pubDate>Thu, 09 Sep 2010 11:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37243</guid>
		<description><![CDATA[Hi Jonathan,

I tested it on 11.2 and it seems to be fixed in 11.2.

See my test (I changed the name of t1 to t1xx)

[sourcecode]
SQL&gt; startup force
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size                  2220200 bytes
Variable Size             977276760 bytes
Database Buffers           83886080 bytes
Redo Buffers                5554176 bytes
Database mounted.
Database opened.
SQL&gt;
SQL&gt; connect scott/regit
Connected.
SQL&gt; set line 200
SQL&gt; set pagesize 0
SQL&gt; alter session set optimizer_use_sql_plan_baselines = false
  2  ;

Session altered.

SQL&gt; select
    small_vc
from
    t1xx
where
    scattered = 10
and clustered between (select 40 from dual)
              and     (select 41 from dual)  2    3    4    5    6    7    8  ;
0000020011
0000020031
0000020051
……..
0000020071

50 rows selected.

SQL&gt; select * from table(dbms_xplan.display_cursor)
  2  ;
SQL_ID  bsvcwujxd02p6, child number 0
-------------------------------------
select     small_vc from     t1xx where     scattered = 10 and
clustered between (select 40 from dual)               and     (select
41 from dual)

Plan hash value: 1241395774

---------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;         &#124;       &#124;       &#124;    17 (100)&#124;          &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1XX    &#124;     5 &#124;   140 &#124;    13   (0)&#124; 00:00:01 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; T1_EQUI &#124;     9 &#124;       &#124;     9   (0)&#124; 00:00:01 &#124;
&#124;   3 &#124;    FAST DUAL                &#124;         &#124;     1 &#124;       &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;   4 &#124;    FAST DUAL                &#124;         &#124;     1 &#124;       &#124;     2   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;SCATTERED&quot;=10 AND &quot;CLUSTERED&quot;&gt;= AND &quot;CLUSTERED&quot;= AND &quot;CLUSTERED&quot; select
    /*+ index(t1 t1_range) */
    small_vc
from
    t1xx
where
    scattered = 10
and clustered between (select 40 from dual)
              and     (select 41 from dual)  2    3    4    5    6    7    8    9  ;
0000020011
0000020031
…..
0000020951
0000020971
0000020991

50 rows selected.

SQL&gt; select * from table(dbms_xplan.display_cursor) ;
SQL_ID  da0446kv1h1v8, child number 0
-------------------------------------
select     /*+ index(t1 t1_range) */     small_vc from     t1xx where
  scattered = 10 and clustered between (select 40 from dual)
   and     (select 41 from dual)

Plan hash value: 1241395774

---------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;         &#124;       &#124;       &#124;    17 (100)&#124;          &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1XX    &#124;     5 &#124;   140 &#124;    13   (0)&#124; 00:00:01 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; T1_EQUI &#124;     9 &#124;       &#124;     9   (0)&#124; 00:00:01 &#124;
&#124;   3 &#124;    FAST DUAL                &#124;         &#124;     1 &#124;       &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;   4 &#124;    FAST DUAL                &#124;         &#124;     1 &#124;       &#124;     2   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;SCATTERED&quot;=10 AND &quot;CLUSTERED&quot;&gt;= AND &quot;CLUSTERED&quot;= AND &quot;CLUSTERED&quot;&lt;=))


24 rows selected.
[/sourcecode]
Regards Hans-Peter]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>I tested it on 11.2 and it seems to be fixed in 11.2.</p>
<p>See my test (I changed the name of t1 to t1xx)</p>
<pre class="brush: plain; title: ; notranslate">
SQL&amp;gt; startup force
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size                  2220200 bytes
Variable Size             977276760 bytes
Database Buffers           83886080 bytes
Redo Buffers                5554176 bytes
Database mounted.
Database opened.
SQL&amp;gt;
SQL&amp;gt; connect scott/regit
Connected.
SQL&amp;gt; set line 200
SQL&amp;gt; set pagesize 0
SQL&amp;gt; alter session set optimizer_use_sql_plan_baselines = false
  2  ;

Session altered.

SQL&amp;gt; select
    small_vc
from
    t1xx
where
    scattered = 10
and clustered between (select 40 from dual)
              and     (select 41 from dual)  2    3    4    5    6    7    8  ;
0000020011
0000020031
0000020051
……..
0000020071

50 rows selected.

SQL&amp;gt; select * from table(dbms_xplan.display_cursor)
  2  ;
SQL_ID  bsvcwujxd02p6, child number 0
-------------------------------------
select     small_vc from     t1xx where     scattered = 10 and
clustered between (select 40 from dual)               and     (select
41 from dual)

Plan hash value: 1241395774

---------------------------------------------------------------------------------------
| Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |         |       |       |    17 (100)|          |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1XX    |     5 |   140 |    13   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | T1_EQUI |     9 |       |     9   (0)| 00:00:01 |
|   3 |    FAST DUAL                |         |     1 |       |     2   (0)| 00:00:01 |
|   4 |    FAST DUAL                |         |     1 |       |     2   (0)| 00:00:01 |
---------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;SCATTERED&quot;=10 AND &quot;CLUSTERED&quot;&amp;gt;= AND &quot;CLUSTERED&quot;= AND &quot;CLUSTERED&quot; select
    /*+ index(t1 t1_range) */
    small_vc
from
    t1xx
where
    scattered = 10
and clustered between (select 40 from dual)
              and     (select 41 from dual)  2    3    4    5    6    7    8    9  ;
0000020011
0000020031
…..
0000020951
0000020971
0000020991

50 rows selected.

SQL&amp;gt; select * from table(dbms_xplan.display_cursor) ;
SQL_ID  da0446kv1h1v8, child number 0
-------------------------------------
select     /*+ index(t1 t1_range) */     small_vc from     t1xx where
  scattered = 10 and clustered between (select 40 from dual)
   and     (select 41 from dual)

Plan hash value: 1241395774

---------------------------------------------------------------------------------------
| Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |         |       |       |    17 (100)|          |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1XX    |     5 |   140 |    13   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | T1_EQUI |     9 |       |     9   (0)| 00:00:01 |
|   3 |    FAST DUAL                |         |     1 |       |     2   (0)| 00:00:01 |
|   4 |    FAST DUAL                |         |     1 |       |     2   (0)| 00:00:01 |
---------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;SCATTERED&quot;=10 AND &quot;CLUSTERED&quot;&amp;gt;= AND &quot;CLUSTERED&quot;= AND &quot;CLUSTERED&quot;&amp;lt;=))


24 rows selected.
</pre>
<p>Regards Hans-Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37237</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Wed, 08 Sep 2010 10:38:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37237</guid>
		<description><![CDATA[Jonathan,

I am afraid revelations like these are making me &quot;atheist&quot; about Oracle :)
On a serious note, thanks for sharing this.]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>I am afraid revelations like these are making me &#8220;atheist&#8221; about Oracle :)<br />
On a serious note, thanks for sharing this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kellyn Pedersen</title>
		<link>http://jonathanlewis.wordpress.com/2010/09/07/cbo-surprise-3/#comment-37236</link>
		<dc:creator><![CDATA[Kellyn Pedersen]]></dc:creator>
		<pubDate>Wed, 08 Sep 2010 02:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=4483#comment-37236</guid>
		<description><![CDATA[I&#039;ve csme across this once in a complex statement that I didn&#039;t have time to figure out what odd CBO &quot;quirk&quot; I was dealing with-  Excellent examples and clear explanations, thank you, Jonathan!]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve csme across this once in a complex statement that I didn&#8217;t have time to figure out what odd CBO &#8220;quirk&#8221; I was dealing with-  Excellent examples and clear explanations, thank you, Jonathan!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
