<?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: Filter &#8220;Bug&#8221;</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 01:50:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Missing Filter &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-45217</link>
		<dc:creator><![CDATA[Missing Filter &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 29 Feb 2012 21:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-45217</guid>
		<description><![CDATA[[...] during an index range scan &#8211; it&#8217;s a topic I wrote about a few months ago with the title &#8220;filter bug&#8221; because the plan shows (or, rather, fails to show) a &#8220;missing&#8221; filter operation, which [...]]]></description>
		<content:encoded><![CDATA[<p>[...] during an index range scan &#8211; it&#8217;s a topic I wrote about a few months ago with the title &#8220;filter bug&#8221; because the plan shows (or, rather, fails to show) a &#8220;missing&#8221; filter operation, which [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quiz Night &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37749</link>
		<dc:creator><![CDATA[Quiz Night &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sun, 21 Nov 2010 11:10:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37749</guid>
		<description><![CDATA[[...] did the choosing &#8211; how could it possible by wrong ! Given the number of times I&#8217;ve said &#8220;you must include the predicate section&#8221;, why isn&#8217;t it there ? (answer: it&#8217;s display_awr). In fact lines 5 and 6 were redundant [...]]]></description>
		<content:encoded><![CDATA[<p>[...] did the choosing &#8211; how could it possible by wrong ! Given the number of times I&#8217;ve said &#8220;you must include the predicate section&#8221;, why isn&#8217;t it there ? (answer: it&#8217;s display_awr). In fact lines 5 and 6 were redundant [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todor Botev</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37170</link>
		<dc:creator><![CDATA[Todor Botev]]></dc:creator>
		<pubDate>Thu, 02 Sep 2010 07:02:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37170</guid>
		<description><![CDATA[Is the change from an &quot;equality&quot; to an &quot;IN&quot; subquery really important for the execution plan? I cannot test it right now but i could imagine we would get a &quot;Type 1&quot; plan (no filter, no multi-child parent rows) with the &quot;IN&quot; subquery, too. The only difference which &quot;IN&quot; brings is that the index access to the parent table will be a &quot;range&quot; instead of &quot;unique&quot; scan.

What really makes the FILTER operation unavoidable is the NO_UNNEST hint isn&#039;t it? It dictates that the subquery gets executed as is for every row from the parent - hence the filter.]]></description>
		<content:encoded><![CDATA[<p>Is the change from an &#8220;equality&#8221; to an &#8220;IN&#8221; subquery really important for the execution plan? I cannot test it right now but i could imagine we would get a &#8220;Type 1&#8243; plan (no filter, no multi-child parent rows) with the &#8220;IN&#8221; subquery, too. The only difference which &#8220;IN&#8221; brings is that the index access to the parent table will be a &#8220;range&#8221; instead of &#8220;unique&#8221; scan.</p>
<p>What really makes the FILTER operation unavoidable is the NO_UNNEST hint isn&#8217;t it? It dictates that the subquery gets executed as is for every row from the parent &#8211; hence the filter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37166</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 17:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37166</guid>
		<description><![CDATA[That&#039;s a bit like the old &quot;the first step is over to the right and near the top&quot; description of where to start reading execution plans. It&#039;s not accurate, and it would be quite hard to express the idea precisely, but I know what you mean.]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s a bit like the old &#8220;the first step is over to the right and near the top&#8221; description of where to start reading execution plans. It&#8217;s not accurate, and it would be quite hard to express the idea precisely, but I know what you mean.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37165</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 17:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37165</guid>
		<description><![CDATA[Narenda,

At a fairly low level what you&#039;re describing is the difference between:
&lt;blockquote&gt;
call function A, then call function B with the result of A
and
call function A, which calls function B
&lt;/blockquote&gt;

I don&#039;t really think there&#039;s going to be a significant difference whichever option you choose (although there may be some interesting ramifications in parallel queries) - but whichever action is chosen I think the plan could still be written to show the FILTER operation as a separate operation simply for clarity of view.  (Remember, as I pointed out to Henish, execution plans don&#039;t, and probably can&#039;t, show us a perfect representation of what&#039;s going on.)]]></description>
		<content:encoded><![CDATA[<p>Narenda,</p>
<p>At a fairly low level what you&#8217;re describing is the difference between:</p>
<blockquote><p>
call function A, then call function B with the result of A<br />
and<br />
call function A, which calls function B
</p></blockquote>
<p>I don&#8217;t really think there&#8217;s going to be a significant difference whichever option you choose (although there may be some interesting ramifications in parallel queries) &#8211; but whichever action is chosen I think the plan could still be written to show the FILTER operation as a separate operation simply for clarity of view.  (Remember, as I pointed out to Henish, execution plans don&#8217;t, and probably can&#8217;t, show us a perfect representation of what&#8217;s going on.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37164</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 17:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37164</guid>
		<description><![CDATA[Henish,

I think you just have to decide that the execution plan can&#039;t always be a perfect description of everything that&#039;s happening.

The &quot;sort aggregate&quot; has to be there because there&#039;s a max() in the subquery - even though the optimizer knows there will be only one row because of the &quot;first row&quot; and knows it won&#039;t need to sort that one row. The oddity is just a side-effect of the min/max method.]]></description>
		<content:encoded><![CDATA[<p>Henish,</p>
<p>I think you just have to decide that the execution plan can&#8217;t always be a perfect description of everything that&#8217;s happening.</p>
<p>The &#8220;sort aggregate&#8221; has to be there because there&#8217;s a max() in the subquery &#8211; even though the optimizer knows there will be only one row because of the &#8220;first row&#8221; and knows it won&#8217;t need to sort that one row. The oddity is just a side-effect of the min/max method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: henish</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37162</link>
		<dc:creator><![CDATA[henish]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 14:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37162</guid>
		<description><![CDATA[Hello Sir,
[sourcecode gutter=&quot;false&quot;]

--------------------------------------------------------------------------
&#124; Id  &#124; Operation                      &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost  &#124;  
--------------------------------------------------------------------------  
&#124;   0 &#124; SELECT STATEMENT               &#124;         &#124;     1 &#124;    19 &#124;     4 &#124;  
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID   &#124; MIN_MAX &#124;     1 &#124;    19 &#124;     2 &#124;  
&#124;*  2 &#124;   INDEX UNIQUE SCAN            &#124; MM_PK   &#124;     1 &#124;       &#124;     1 &#124;  
&#124;   3 &#124;    SORT AGGREGATE              &#124;         &#124;     1 &#124;     8 &#124;       &#124;  
&#124;   4 &#124;     FIRST ROW                  &#124;         &#124;    10 &#124;    80 &#124;     2 &#124;  
&#124;*  5 &#124;      INDEX RANGE SCAN (MIN/MAX)&#124; MM_PK   &#124;    10 &#124;    80 &#124;     2 &#124;  
--------------------------------------------------------------------------  
  
Predicate Information (identified by operation id):  
---------------------------------------------------  
2 - access(&quot;MM1&quot;.&quot;ID_PARENT&quot;=100 AND &quot;MM1&quot;.&quot;ID_CHILD&quot;= (SELECT  
MAX(&quot;MM2&quot;.&quot;ID_CHILD&quot;) FROM &quot;MIN_MAX&quot; &quot;MM2&quot; WHERE &quot;MM2&quot;.&quot;ID_PARENT&quot;=100))  
5 - access(&quot;MM2&quot;.&quot;ID_PARENT&quot;=100) 
[/sourcecode]

in the above plan will sort happen first and get the first row? than why first row come before sort aggregate if we read plan from bottom up?

OR 

will oracle stop scaning when it read value &gt;100 and return the last value for id_child if my assumption is correct for index mm_pk define as (id_parent, id_child)?


Thanks]]></description>
		<content:encoded><![CDATA[<p>Hello Sir,</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">

--------------------------------------------------------------------------
| Id  | Operation                      | Name    | Rows  | Bytes | Cost  |  
--------------------------------------------------------------------------  
|   0 | SELECT STATEMENT               |         |     1 |    19 |     4 |  
|   1 |  TABLE ACCESS BY INDEX ROWID   | MIN_MAX |     1 |    19 |     2 |  
|*  2 |   INDEX UNIQUE SCAN            | MM_PK   |     1 |       |     1 |  
|   3 |    SORT AGGREGATE              |         |     1 |     8 |       |  
|   4 |     FIRST ROW                  |         |    10 |    80 |     2 |  
|*  5 |      INDEX RANGE SCAN (MIN/MAX)| MM_PK   |    10 |    80 |     2 |  
--------------------------------------------------------------------------  
  
Predicate Information (identified by operation id):  
---------------------------------------------------  
2 - access(&quot;MM1&quot;.&quot;ID_PARENT&quot;=100 AND &quot;MM1&quot;.&quot;ID_CHILD&quot;= (SELECT  
MAX(&quot;MM2&quot;.&quot;ID_CHILD&quot;) FROM &quot;MIN_MAX&quot; &quot;MM2&quot; WHERE &quot;MM2&quot;.&quot;ID_PARENT&quot;=100))  
5 - access(&quot;MM2&quot;.&quot;ID_PARENT&quot;=100) 
</pre>
<p>in the above plan will sort happen first and get the first row? than why first row come before sort aggregate if we read plan from bottom up?</p>
<p>OR </p>
<p>will oracle stop scaning when it read value &gt;100 and return the last value for id_child if my assumption is correct for index mm_pk define as (id_parent, id_child)?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37157</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 08:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37157</guid>
		<description><![CDATA[Apologies as I missed to add this in my previous post. I generally tend to read execution plan bottom-up, when checking predicates section. The earlier predicate is applied the better is my general approach. Hence the above question.]]></description>
		<content:encoded><![CDATA[<p>Apologies as I missed to add this in my previous post. I generally tend to read execution plan bottom-up, when checking predicates section. The earlier predicate is applied the better is my general approach. Hence the above question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://jonathanlewis.wordpress.com/2010/08/31/filter-bug/#comment-37156</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Wed, 01 Sep 2010 08:18:08 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=207#comment-37156</guid>
		<description><![CDATA[Jonathan,

Can you please explain why your &quot;ideal&quot; plan is better than the original plan?
My understanding is the ideal plan will range scan the index and provide the rows to the next step which will filter them based on subquery. But the original plan will apply subquery filter and access predicate to the range scan, thereby filtering rows early. Or am I misunderstood on how &quot;access&quot; and &quot;filter&quot; predicates are applied?]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Can you please explain why your &#8220;ideal&#8221; plan is better than the original plan?<br />
My understanding is the ideal plan will range scan the index and provide the rows to the next step which will filter them based on subquery. But the original plan will apply subquery filter and access predicate to the range scan, thereby filtering rows early. Or am I misunderstood on how &#8220;access&#8221; and &#8220;filter&#8221; predicates are applied?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
