<?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: Transitive Closure</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Mon, 20 May 2013 17:10:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-52052</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 13 Dec 2012 10:28:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-52052</guid>
		<description><![CDATA[Martin,

Thanks for the comment. In &quot;Cost Based Oracle - Fundamentals&quot; I mentioned (without naming it) that 10g hadintroduced a new parameter to ensure that the join predicate was retained ( _optimizer_transitivity_retain, with description &quot;retain equi-join pred upon transitive equality pred generation&quot; ). This one goes that little bit further. It would be useful to see how many other possible transformations could be blocked by this parameter change.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Thanks for the comment. In &#8220;Cost Based Oracle &#8211; Fundamentals&#8221; I mentioned (without naming it) that 10g hadintroduced a new parameter to ensure that the join predicate was retained ( _optimizer_transitivity_retain, with description &#8220;retain equi-join pred upon transitive equality pred generation&#8221; ). This one goes that little bit further. It would be useful to see how many other possible transformations could be blocked by this parameter change.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-52051</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 13 Dec 2012 10:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-52051</guid>
		<description><![CDATA[Andy,
Just one of many late replies, but the answer is that transitive closure can still be applied. The word &quot;constant&quot; covers a multitude of sins, include &quot;constants which are on an unknown value at present&quot;. Here&#039;s a little demo, cut and paste, from 11.1.0.7

[sourcecode gutter=&quot;false&quot;]

SQL&gt; explain plan for
  2  select t1.n2 , t2.n2
  3  from t1, t2
  4  where t1.n1 = :b1
  5  and t2.n1 = t1.n1
  6  /

Explained.

SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------
Plan hash value: 1167318051

----------------------------------------------------------------------
&#124; Id  &#124; Operation                    &#124; Name  &#124; Rows  &#124; Bytes &#124; Cost  &#124;
----------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT             &#124;       &#124;   225 &#124;  3600 &#124;    19 &#124;
&#124;*  1 &#124;  HASH JOIN                   &#124;       &#124;   225 &#124;  3600 &#124;    19 &#124;
&#124;   2 &#124;   TABLE ACCESS BY INDEX ROWID&#124; T1    &#124;    15 &#124;   120 &#124;     2 &#124;
&#124;*  3 &#124;    INDEX RANGE SCAN          &#124; T1_I1 &#124;    15 &#124;       &#124;     1 &#124;
&#124;*  4 &#124;   TABLE ACCESS FULL          &#124; T2    &#124;    15 &#124;   120 &#124;    15 &#124;
----------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access(&quot;T2&quot;.&quot;N1&quot;=&quot;T1&quot;.&quot;N1&quot;)
   3 - access(&quot;T1&quot;.&quot;N1&quot;=TO_NUMBER(:B1))
   4 - filter(&quot;T2&quot;.&quot;N1&quot;=TO_NUMBER(:B1))

Note
-----
   - cpu costing is off (consider enabling it)

22 rows selected.

[/sourcecode]

As you can see, the predicate has ended up being applied to both tables.
In fact, at least in this version of Oracle - I don&#039;t recall if it is the same for older versions, you can even replace the bind variable with a call to sys_content() and see transitive closure; the same would apply with a call to a deterministic function that returns a constant.]]></description>
		<content:encoded><![CDATA[<p>Andy,<br />
Just one of many late replies, but the answer is that transitive closure can still be applied. The word &#8220;constant&#8221; covers a multitude of sins, include &#8220;constants which are on an unknown value at present&#8221;. Here&#8217;s a little demo, cut and paste, from 11.1.0.7</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">

SQL&gt; explain plan for
  2  select t1.n2 , t2.n2
  3  from t1, t2
  4  where t1.n1 = :b1
  5  and t2.n1 = t1.n1
  6  /

Explained.

SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------
Plan hash value: 1167318051

----------------------------------------------------------------------
| Id  | Operation                    | Name  | Rows  | Bytes | Cost  |
----------------------------------------------------------------------
|   0 | SELECT STATEMENT             |       |   225 |  3600 |    19 |
|*  1 |  HASH JOIN                   |       |   225 |  3600 |    19 |
|   2 |   TABLE ACCESS BY INDEX ROWID| T1    |    15 |   120 |     2 |
|*  3 |    INDEX RANGE SCAN          | T1_I1 |    15 |       |     1 |
|*  4 |   TABLE ACCESS FULL          | T2    |    15 |   120 |    15 |
----------------------------------------------------------------------

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

   1 - access(&quot;T2&quot;.&quot;N1&quot;=&quot;T1&quot;.&quot;N1&quot;)
   3 - access(&quot;T1&quot;.&quot;N1&quot;=TO_NUMBER(:B1))
   4 - filter(&quot;T2&quot;.&quot;N1&quot;=TO_NUMBER(:B1))

Note
-----
   - cpu costing is off (consider enabling it)

22 rows selected.

</pre>
<p>As you can see, the predicate has ended up being applied to both tables.<br />
In fact, at least in this version of Oracle &#8211; I don&#8217;t recall if it is the same for older versions, you can even replace the bind variable with a call to sys_content() and see transitive closure; the same would apply with a call to a deterministic function that returns a constant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Decker</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-50846</link>
		<dc:creator><![CDATA[Martin Decker]]></dc:creator>
		<pubDate>Thu, 18 Oct 2012 19:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-50846</guid>
		<description><![CDATA[Good evening,

FYI: in 11.2.0.3, the transitive closure effect of removing the join predicate and replacing it with filters for each table can be prevented with 

&quot;_optimizer_filter_pushdown&quot; = false

So instead of:

FPD: Considering simple filter push in query block SEL$1 (#0)
&quot;O&quot;.&quot;CUSTOMER_ID&quot;=&quot;C&quot;.&quot;CUSTOMER_ID&quot; AND &quot;C&quot;.&quot;CUSTOMER_ID&quot;=:B1
try to generate transitive predicate from check constraints for query block SEL$1 (#0)
finally: &quot;O&quot;.&quot;CUSTOMER_ID&quot;=:B1 AND &quot;C&quot;.&quot;CUSTOMER_ID&quot;=:B2

it is disabled:
FPD: Disabled by parameter

Best regards,
Martin]]></description>
		<content:encoded><![CDATA[<p>Good evening,</p>
<p>FYI: in 11.2.0.3, the transitive closure effect of removing the join predicate and replacing it with filters for each table can be prevented with </p>
<p>&#8220;_optimizer_filter_pushdown&#8221; = false</p>
<p>So instead of:</p>
<p>FPD: Considering simple filter push in query block SEL$1 (#0)<br />
&#8220;O&#8221;.&#8221;CUSTOMER_ID&#8221;=&#8221;C&#8221;.&#8221;CUSTOMER_ID&#8221; AND &#8220;C&#8221;.&#8221;CUSTOMER_ID&#8221;=:B1<br />
try to generate transitive predicate from check constraints for query block SEL$1 (#0)<br />
finally: &#8220;O&#8221;.&#8221;CUSTOMER_ID&#8221;=:B1 AND &#8220;C&#8221;.&#8221;CUSTOMER_ID&#8221;=:B2</p>
<p>it is disabled:<br />
FPD: Disabled by parameter</p>
<p>Best regards,<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-45234</link>
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Fri, 02 Mar 2012 11:26:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-45234</guid>
		<description><![CDATA[A question

&quot;Transitive closure is relevant only if there are some constants in the mixture&quot; , you say

Does this mean that it can&#039;t be an issue if cursor_sharing = FORCE or SIMILAR ?]]></description>
		<content:encoded><![CDATA[<p>A question</p>
<p>&#8220;Transitive closure is relevant only if there are some constants in the mixture&#8221; , you say</p>
<p>Does this mean that it can&#8217;t be an issue if cursor_sharing = FORCE or SIMILAR ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhavik Desai</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-36630</link>
		<dc:creator><![CDATA[Bhavik Desai]]></dc:creator>
		<pubDate>Wed, 30 Jun 2010 12:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-36630</guid>
		<description><![CDATA[I agree that Transitive closure may provide good cardinality estimates, but many times i observed that execution pattern will not change. I tried many queries on EMP and DEPT table (Where EMP.DEPT_NO=DEPT.DEPT_NO AND DEPT.DEPT_NO=1) after addition redundant predicate (Where EMP.DEPT_NO=DEPT.DEPT_NO AND DEPT.DEPT_NO=1 AND EMP.DEPT_NO=1). EMP is having 5M rows with EMP_NO as Primary key and DEPT is having 1000 Rows with DEPT_NO primary key)]]></description>
		<content:encoded><![CDATA[<p>I agree that Transitive closure may provide good cardinality estimates, but many times i observed that execution pattern will not change. I tried many queries on EMP and DEPT table (Where EMP.DEPT_NO=DEPT.DEPT_NO AND DEPT.DEPT_NO=1) after addition redundant predicate (Where EMP.DEPT_NO=DEPT.DEPT_NO AND DEPT.DEPT_NO=1 AND EMP.DEPT_NO=1). EMP is having 5M rows with EMP_NO as Primary key and DEPT is having 1000 Rows with DEPT_NO primary key)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Predicate (again) &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-36050</link>
		<dc:creator><![CDATA[Predicate (again) &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Thu, 15 Apr 2010 18:18:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-36050</guid>
		<description><![CDATA[[...] the appearance of an extra predicate on fgc.tcp_mpf_file_group_id. This has appeared through transitive closure. (You might also notice that the join condition between tmfg and fgc has disappeared, and in some [...]]]></description>
		<content:encoded><![CDATA[<p>[...] the appearance of an extra predicate on fgc.tcp_mpf_file_group_id. This has appeared through transitive closure. (You might also notice that the join condition between tmfg and fgc has disappeared, and in some [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignoring Hints &#8211; 2 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-35473</link>
		<dc:creator><![CDATA[Ignoring Hints &#8211; 2 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Thu, 11 Feb 2010 19:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-35473</guid>
		<description><![CDATA[[...] the &#8220;missing&#8221; predicate is the join predicate. You&#8217;re looking at an example of transitive closure:  if t1.id1 = 1 and t2.id1 = t1.id1 then t2.id1 = 1 So Oracle has taken the predicate from one [...]]]></description>
		<content:encoded><![CDATA[<p>[...] the &#8220;missing&#8221; predicate is the join predicate. You&#8217;re looking at an example of transitive closure:  if t1.id1 = 1 and t2.id1 = t1.id1 then t2.id1 = 1 So Oracle has taken the predicate from one [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Predicate Problems &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-32332</link>
		<dc:creator><![CDATA[Predicate Problems &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 03 Dec 2008 20:50:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-32332</guid>
		<description><![CDATA[[...] Oracle always tries to transform your query before optimizing it. One of the transformation steps involves rewriting your predicates. This step is allowed to introduce new predicates from your table constraints, and may also rearrange your predicates through transitive closure. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Oracle always tries to transform your query before optimizing it. One of the transformation steps involves rewriting your predicates. This step is allowed to introduce new predicates from your table constraints, and may also rearrange your predicates through transitive closure. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-26594</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 12 Dec 2007 10:37:34 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-26594</guid>
		<description><![CDATA[Keyur,  if you want to disable query transformation, you can do it at the statement level with the hint /*+ no_query_transformation */.  

If you have a general problem with an entire class of queries that behaved in version &quot;X&quot; but not in version &quot;Y&quot; then you could try running the 10053 against one of them after setting &quot;optimizer_features_enable&quot; to each of the two values in turn.  You can then compare the section about optimizer environment values to see if you can spot the most likely parameter that is causing the change.

&lt;code&gt;_optimizer_transitivity_retain = false&lt;/code&gt;
This handles the case of
&lt;code&gt;if a = b and b = c then a = c.&lt;/code&gt;
Earlier versions of Oracle would take:
&lt;code&gt;where a = b and b = c&lt;/code&gt;
and change it to something like
&lt;code&gt;where a = b and a = c&lt;/code&gt;
discarding the &lt;code&gt;b=c&lt;/code&gt;
in newer versions of Oracle the new predicate is generated and the old predicate is retained - giving 3 predicates - if this parameter is set to true.


&lt;code&gt;_push_join_predicate = false&lt;/code&gt;
This parameter is not about general predicat move around, it relates to Oracle ability to push join predicates into non-mergeable views; potentially allowing a large hash join to become a nested loop approach.]]></description>
		<content:encoded><![CDATA[<p>Keyur,  if you want to disable query transformation, you can do it at the statement level with the hint /*+ no_query_transformation */.  </p>
<p>If you have a general problem with an entire class of queries that behaved in version &#8220;X&#8221; but not in version &#8220;Y&#8221; then you could try running the 10053 against one of them after setting &#8220;optimizer_features_enable&#8221; to each of the two values in turn.  You can then compare the section about optimizer environment values to see if you can spot the most likely parameter that is causing the change.</p>
<p><code>_optimizer_transitivity_retain = false</code><br />
This handles the case of<br />
<code>if a = b and b = c then a = c.</code><br />
Earlier versions of Oracle would take:<br />
<code>where a = b and b = c</code><br />
and change it to something like<br />
<code>where a = b and a = c</code><br />
discarding the <code>b=c</code><br />
in newer versions of Oracle the new predicate is generated and the old predicate is retained &#8211; giving 3 predicates &#8211; if this parameter is set to true.</p>
<p><code>_push_join_predicate = false</code><br />
This parameter is not about general predicat move around, it relates to Oracle ability to push join predicates into non-mergeable views; potentially allowing a large hash join to become a nested loop approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keyur</title>
		<link>http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-26553</link>
		<dc:creator><![CDATA[Keyur]]></dc:creator>
		<pubDate>Tue, 11 Dec 2007 22:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/01/01/transitive-closure/#comment-26553</guid>
		<description><![CDATA[I tried to find out if something is changing by setting false for following parameter but It didn&#039;t change anything.
PARAMETERS WITH ALTERED VALUES
  ******************************
  _optimizer_transitivity_retain      = false
   _push_join_predicate               = false

I thought this would avoid any push join, but still it&#039;s doing push join. 

Because It&#039;s trying possiblities in QUERY TRANFORMATION phase and then rejecting predicates. I am thinking to disable query transformation, but trying to find out how to do that.

Thanks

~ Keyur]]></description>
		<content:encoded><![CDATA[<p>I tried to find out if something is changing by setting false for following parameter but It didn&#8217;t change anything.<br />
PARAMETERS WITH ALTERED VALUES<br />
  ******************************<br />
  _optimizer_transitivity_retain      = false<br />
   _push_join_predicate               = false</p>
<p>I thought this would avoid any push join, but still it&#8217;s doing push join. </p>
<p>Because It&#8217;s trying possiblities in QUERY TRANFORMATION phase and then rejecting predicates. I am thinking to disable query transformation, but trying to find out how to do that.</p>
<p>Thanks</p>
<p>~ Keyur</p>
]]></content:encoded>
	</item>
</channel>
</rss>
