<?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: NO_QUERY_TRANSFORMATION Hint is Ignored&#8230; Well, Almost Ignored</title>
	<atom:link href="http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Rajeev</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-5260</link>
		<dc:creator><![CDATA[Rajeev]]></dc:creator>
		<pubDate>Fri, 15 Feb 2013 00:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-5260</guid>
		<description><![CDATA[Charles,

      I tried to use NO_QUERY_TRANSFORMATION and Hint is ignored in CTAS statement. Standalone SELECT ... works perfectly in 16 min&#039;s however with CTAS the execution plan changes and  takes 4hrs+ to finish. How can I keep the same execution plan with or without CTAS in 11.2.0.3 on RH Linux 5.5. 

Thanks]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>      I tried to use NO_QUERY_TRANSFORMATION and Hint is ignored in CTAS statement. Standalone SELECT &#8230; works perfectly in 16 min&#8217;s however with CTAS the execution plan changes and  takes 4hrs+ to finish. How can I keep the same execution plan with or without CTAS in 11.2.0.3 on RH Linux 5.5. </p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry Osborne</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2603</link>
		<dc:creator><![CDATA[Kerry Osborne]]></dc:creator>
		<pubDate>Thu, 06 Jan 2011 14:35:29 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2603</guid>
		<description><![CDATA[The non-hinted version got transformed to standard Oracle join syntax (as expected):

Final query after transformations:******* UNPARSED QUERY IS *******
SELECT COUNT(*) &quot;COUNT(*)&quot; FROM &quot;KSO&quot;.&quot;LITTLE_SKEW&quot; &quot;A&quot;,&quot;KSO&quot;.&quot;LITTLE_SKEW&quot; &quot;B&quot; WHERE &quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;(+)

Basically the hinted version ran (although it never returned)  but the trace file looked like the optimizer had pretty much lost it&#039;s mind. There were many transformations that were apparently still evaluated even with the hint. 

Thanks for the kind words on the book. I appreciate you taking the time to read it and comment. I haven&#039;t actually had time to read it all the way through yet myself. ;) Hopefully you&#039;ll like the last chapter as well (Plan Stability and Control) as it covers a topic that I am very interested in.]]></description>
		<content:encoded><![CDATA[<p>The non-hinted version got transformed to standard Oracle join syntax (as expected):</p>
<p>Final query after transformations:******* UNPARSED QUERY IS *******<br />
SELECT COUNT(*) &#8220;COUNT(*)&#8221; FROM &#8220;KSO&#8221;.&#8221;LITTLE_SKEW&#8221; &#8220;A&#8221;,&#8221;KSO&#8221;.&#8221;LITTLE_SKEW&#8221; &#8220;B&#8221; WHERE &#8220;A&#8221;.&#8221;PK_COL&#8221;=&#8221;B&#8221;.&#8221;PK_COL&#8221;(+)</p>
<p>Basically the hinted version ran (although it never returned)  but the trace file looked like the optimizer had pretty much lost it&#8217;s mind. There were many transformations that were apparently still evaluated even with the hint. </p>
<p>Thanks for the kind words on the book. I appreciate you taking the time to read it and comment. I haven&#8217;t actually had time to read it all the way through yet myself. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Hopefully you&#8217;ll like the last chapter as well (Plan Stability and Control) as it covers a topic that I am very interested in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2601</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 06 Jan 2011 11:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2601</guid>
		<description><![CDATA[Kerry,

Thank you for stopping by, and for performing your test on Exadata.  I am interested in seeing the &quot;Final query after transformation&quot; section of a 10053 trace for the unhinted version of the query.  I am curious to know if the final query after transformation is written any differently than it would be on a non-Exadata implementation.

By the way, I am impressed with chapter 11 of the &quot;Pro Oracle SQL&quot; book - very well written.]]></description>
		<content:encoded><![CDATA[<p>Kerry,</p>
<p>Thank you for stopping by, and for performing your test on Exadata.  I am interested in seeing the &#8220;Final query after transformation&#8221; section of a 10053 trace for the unhinted version of the query.  I am curious to know if the final query after transformation is written any differently than it would be on a non-Exadata implementation.</p>
<p>By the way, I am impressed with chapter 11 of the &#8220;Pro Oracle SQL&#8221; book &#8211; very well written.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry Osborne</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2597</link>
		<dc:creator><![CDATA[Kerry Osborne]]></dc:creator>
		<pubDate>Thu, 06 Jan 2011 04:34:04 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2597</guid>
		<description><![CDATA[Interesting idea Jonathan. I&#039;m surprised you haven&#039;t tried that yet. ;) I gave a quick try and managed to basically hang my session on the first shot. 

Here&#039;s a little output from 11.2.0.2 (Exadata)

&lt;pre&gt;
SYS@SANDBOX1&gt; select count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col;

  COUNT(*)
----------
   1300496

Elapsed: 00:00:00.88
SYS@SANDBOX1&gt; select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col;
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col
                                                                                                                      *
ERROR at line 1:
ORA-01013: user requested cancel of current operation


Elapsed: 00:03:30.21
&lt;/pre&gt;
 
&lt;pre&gt;
SYS@SANDBOX1&gt; @fss
Enter value for sql_text: %count(*) from kso.little_skew a%
Enter value for sql_id: 

SQL_ID         CHILD      EXECS   AVG_ROWS     AVG_ETIME       AVG_CPU       AVG_PIO      AVG_LIO SQL_TEXT
------------- ------ ---------- ---------- ------------- ------------- ------------- ------------ ----------------------------------------
3u689tu6mfkdw      0          1          1           .87           .87           .00       11,336 select count(*) from kso.little_skew a l
6x3g2dtmwgvyu      0          1          0        203.64        203.59           .00   25,436,471 select /*+ NO_QUERY_TRANSFORMATION */ co


2 rows selected.
&lt;/pre&gt;
 
&lt;pre&gt;
SYS@SANDBOX1&gt; @dplan
Enter value for sql_id: 3u689tu6mfkdw
Enter value for child_no: 

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  3u689tu6mfkdw, child number 0
-------------------------------------
select count(*) from kso.little_skew a left outer join kso.little_skew
b on a.pk_col = b.pk_col

Plan hash value: 1386718486

---------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name        &#124; Rows  &#124; Bytes &#124;TempSpc&#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;             &#124;       &#124;       &#124;       &#124;  4984 (100)&#124;          &#124;
&#124;   1 &#124;  SORT AGGREGATE             &#124;             &#124;     1 &#124;    12 &#124;       &#124;            &#124;          &#124;
&#124;*  2 &#124;   HASH JOIN OUTER           &#124;             &#124;  1210K&#124;    13M&#124;    18M&#124;  4984   (1)&#124; 00:01:00 &#124;
&#124;   3 &#124;    TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;       &#124;  1546   (1)&#124; 00:00:19 &#124;
&#124;   4 &#124;    TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;       &#124;  1546   (1)&#124; 00:00:19 &#124;
---------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;)


22 rows selected.
&lt;/pre&gt;
 
&lt;pre&gt;
SYS@SANDBOX1&gt; @dplan
Enter value for sql_id: 6x3g2dtmwgvyu
Enter value for child_no: 

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  6x3g2dtmwgvyu, child number 0
-------------------------------------
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a
left outer join kso.little_skew b on a.pk_col = b.pk_col

Plan hash value: 2156590542

---------------------------------------------------------------------------------------------
&#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;  1703M(100)&#124;          &#124;
&#124;   1 &#124;  SORT AGGREGATE               &#124;             &#124;     1 &#124;       &#124;            &#124;          &#124;
&#124;   2 &#124;   VIEW                        &#124;             &#124;    12G&#124;       &#124;  1703M  (1)&#124;999:59:59 &#124;
&#124;   3 &#124;    NESTED LOOPS OUTER         &#124;             &#124;    12G&#124;    67G&#124;  1703M  (1)&#124;999:59:59 &#124;
&#124;   4 &#124;     TABLE ACCESS STORAGE FULL &#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;  1546   (1)&#124; 00:00:19 &#124;
&#124;   5 &#124;     VIEW                      &#124;             &#124; 11001 &#124;       &#124;  1548   (1)&#124; 00:00:19 &#124;
&#124;*  6 &#124;      TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124; 11001 &#124; 66006 &#124;  1548   (1)&#124; 00:00:19 &#124;
---------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   6 - filter(&quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;)


24 rows selected.
&lt;/pre&gt;

I Wolfgang&#039;ed the statement and it was indeed transformed, to this:

&lt;pre&gt;
Final query after transformations:******* UNPARSED QUERY IS *******
SELECT COUNT(*) &quot;COUNT(*)&quot; FROM  (SELECT &quot;from$_subquery$_004&quot;.&quot;PK_COL&quot; &quot;PK_COL&quot;
FROM &quot;KSO&quot;.&quot;LITTLE_SKEW&quot; &quot;A&quot;, 
LATERAL( (SELECT &quot;B&quot;.&quot;PK_COL&quot; &quot;PK_COL&quot; FROM &quot;KSO&quot;.&quot;LITTLE_SKEW&quot; &quot;B&quot;
WHERE &quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;))(+) &quot;from$_subquery$_004&quot;) &quot;from$_subquery$_003&quot;
&lt;/pre&gt;

So it doesn&#039;t look like NO_QUERY_TRANSFORMATION really means &quot;NO&quot; transformations.]]></description>
		<content:encoded><![CDATA[<p>Interesting idea Jonathan. I&#8217;m surprised you haven&#8217;t tried that yet. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I gave a quick try and managed to basically hang my session on the first shot. </p>
<p>Here&#8217;s a little output from 11.2.0.2 (Exadata)</p>
<pre>
SYS@SANDBOX1&gt; select count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col;

  COUNT(*)
----------
   1300496

Elapsed: 00:00:00.88
SYS@SANDBOX1&gt; select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col;
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a left outer join kso.little_skew b on a.pk_col = b.pk_col
                                                                                                                      *
ERROR at line 1:
ORA-01013: user requested cancel of current operation


Elapsed: 00:03:30.21
</pre>
<pre>
SYS@SANDBOX1&gt; @fss
Enter value for sql_text: %count(*) from kso.little_skew a%
Enter value for sql_id: 

SQL_ID         CHILD      EXECS   AVG_ROWS     AVG_ETIME       AVG_CPU       AVG_PIO      AVG_LIO SQL_TEXT
------------- ------ ---------- ---------- ------------- ------------- ------------- ------------ ----------------------------------------
3u689tu6mfkdw      0          1          1           .87           .87           .00       11,336 select count(*) from kso.little_skew a l
6x3g2dtmwgvyu      0          1          0        203.64        203.59           .00   25,436,471 select /*+ NO_QUERY_TRANSFORMATION */ co


2 rows selected.
</pre>
<pre>
SYS@SANDBOX1&gt; @dplan
Enter value for sql_id: 3u689tu6mfkdw
Enter value for child_no: 

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  3u689tu6mfkdw, child number 0
-------------------------------------
select count(*) from kso.little_skew a left outer join kso.little_skew
b on a.pk_col = b.pk_col

Plan hash value: 1386718486

---------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |             |       |       |       |  4984 (100)|          |
|   1 |  SORT AGGREGATE             |             |     1 |    12 |       |            |          |
|*  2 |   HASH JOIN OUTER           |             |  1210K|    13M|    18M|  4984   (1)| 00:01:00 |
|   3 |    TABLE ACCESS STORAGE FULL| LITTLE_SKEW |  1100K|  6445K|       |  1546   (1)| 00:00:19 |
|   4 |    TABLE ACCESS STORAGE FULL| LITTLE_SKEW |  1100K|  6445K|       |  1546   (1)| 00:00:19 |
---------------------------------------------------------------------------------------------------

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

   2 - access("A"."PK_COL"="B"."PK_COL")


22 rows selected.
</pre>
<pre>
SYS@SANDBOX1&gt; @dplan
Enter value for sql_id: 6x3g2dtmwgvyu
Enter value for child_no: 

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  6x3g2dtmwgvyu, child number 0
-------------------------------------
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a
left outer join kso.little_skew b on a.pk_col = b.pk_col

Plan hash value: 2156590542

---------------------------------------------------------------------------------------------
| Id  | Operation                     | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |             |       |       |  1703M(100)|          |
|   1 |  SORT AGGREGATE               |             |     1 |       |            |          |
|   2 |   VIEW                        |             |    12G|       |  1703M  (1)|999:59:59 |
|   3 |    NESTED LOOPS OUTER         |             |    12G|    67G|  1703M  (1)|999:59:59 |
|   4 |     TABLE ACCESS STORAGE FULL | LITTLE_SKEW |  1100K|  6445K|  1546   (1)| 00:00:19 |
|   5 |     VIEW                      |             | 11001 |       |  1548   (1)| 00:00:19 |
|*  6 |      TABLE ACCESS STORAGE FULL| LITTLE_SKEW | 11001 | 66006 |  1548   (1)| 00:00:19 |
---------------------------------------------------------------------------------------------

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

   6 - filter("A"."PK_COL"="B"."PK_COL")


24 rows selected.
</pre>
<p>I Wolfgang&#8217;ed the statement and it was indeed transformed, to this:</p>
<pre>
Final query after transformations:******* UNPARSED QUERY IS *******
SELECT COUNT(*) "COUNT(*)" FROM  (SELECT "from$_subquery$_004"."PK_COL" "PK_COL"
FROM "KSO"."LITTLE_SKEW" "A", 
LATERAL( (SELECT "B"."PK_COL" "PK_COL" FROM "KSO"."LITTLE_SKEW" "B"
WHERE "A"."PK_COL"="B"."PK_COL"))(+) "from$_subquery$_004") "from$_subquery$_003"
</pre>
<p>So it doesn&#8217;t look like NO_QUERY_TRANSFORMATION really means &#8220;NO&#8221; transformations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2584</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Tue, 04 Jan 2011 20:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2584</guid>
		<description><![CDATA[The specific Wordpress theme that I selected &quot;Freshy by Jude&quot; includes in its cascading style sheet (CSS) the description for the code blocks.  The Freshy theme was one of only a small number that supported horizontally scrolling code sections, which are definitely needed in a large number of my blog posts.  I then paid Wordpress for the option (roughly $50 USD per year) to modify the cascading style sheet so that I could fine tune the appearance of this blog (you might be able to do the same, and then borrow the code section formatting from the Freshy theme).

You can see why my blog was modified by looking at the comments in these blog articles:
http://hoopercharles.wordpress.com/2009/12/01/sql-plan_hash_value-changes-for-the-same-sql-statement/
http://hoopercharles.wordpress.com/2010/04/08/true-or-false-autotrace/]]></description>
		<content:encoded><![CDATA[<p>The specific WordPress theme that I selected &#8220;Freshy by Jude&#8221; includes in its cascading style sheet (CSS) the description for the code blocks.  The Freshy theme was one of only a small number that supported horizontally scrolling code sections, which are definitely needed in a large number of my blog posts.  I then paid WordPress for the option (roughly $50 USD per year) to modify the cascading style sheet so that I could fine tune the appearance of this blog (you might be able to do the same, and then borrow the code section formatting from the Freshy theme).</p>
<p>You can see why my blog was modified by looking at the comments in these blog articles:<br />
<a href="http://hoopercharles.wordpress.com/2009/12/01/sql-plan_hash_value-changes-for-the-same-sql-statement/" rel="nofollow">http://hoopercharles.wordpress.com/2009/12/01/sql-plan_hash_value-changes-for-the-same-sql-statement/</a><br />
<a href="http://hoopercharles.wordpress.com/2010/04/08/true-or-false-autotrace/" rel="nofollow">http://hoopercharles.wordpress.com/2010/04/08/true-or-false-autotrace/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2583</link>
		<dc:creator><![CDATA[Anil]]></dc:creator>
		<pubDate>Tue, 04 Jan 2011 20:05:37 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2583</guid>
		<description><![CDATA[Hi charles,
Your posts on Oracle are pretty good. But, my question is something else.

How are you able to embed your code into a block? I&#039;d love to do the same. Could you please explain or give me the source?

Thanks,
Anil]]></description>
		<content:encoded><![CDATA[<p>Hi charles,<br />
Your posts on Oracle are pretty good. But, my question is something else.</p>
<p>How are you able to embed your code into a block? I&#8217;d love to do the same. Could you please explain or give me the source?</p>
<p>Thanks,<br />
Anil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2576</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 03 Jan 2011 21:35:38 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2576</guid>
		<description><![CDATA[I just noticed something as a result of what Kerry Osborne wrote into chapter 11 (page 342) of the SQL book.  Autotrace will show in the &lt;strong&gt;Predicate Information&lt;/strong&gt; section more detailed information, for example &quot;&lt;strong&gt;1 - filter( EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=:B1))&lt;/strong&gt;&quot;, while the 10053 trace file and DBMS_XPLAN.DISPLAY_CURSOR function display less detail, for example &quot;&lt;strong&gt;1 - filter( IS NOT NULL)&lt;/strong&gt;&quot;.

For example, if we rerun the script from my previous comment with AUTOTRACE enabled:
[code]
SET AUTOTRACE TRACEONLY EXPLAIN
[/code]
We will see the more extensive detail provided by AUTOTRACE:

OPTIMIZER_FEATURES_ENABLE=&#039;8.1.7&#039;, unhinted:
[code]
SQL&gt; SELECT
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 1304214603

-----------------------------------------------------------------
&#124; Id  &#124; Operation            &#124; Name     &#124; Rows  &#124; Bytes &#124; Cost  &#124;
-----------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT     &#124;          &#124;    80 &#124;  1280 &#124;     6 &#124;
&#124;*  1 &#124;  HASH JOIN           &#124;          &#124;    80 &#124;  1280 &#124;     6 &#124;
&#124;   2 &#124;   VIEW               &#124; VW_NSO_1 &#124;    80 &#124;  1040 &#124;     4 &#124;
&#124;   3 &#124;    SORT UNIQUE       &#124;          &#124;    80 &#124;   240 &#124;     4 &#124;
&#124;   4 &#124;     TABLE ACCESS FULL&#124; T2       &#124;  1000 &#124;  3000 &#124;     1 &#124;
&#124;   5 &#124;   TABLE ACCESS FULL  &#124; T1       &#124;   100 &#124;   300 &#124;     1 &#124;
-----------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;$nso_col_1&quot;)

Note
-----
   - cpu costing is off (consider enabling it)
[/code]
 
OPTIMIZER_FEATURES_ENABLE=&#039;8.1.7&#039;, hinted with NO_QUERY_TRANSFORMATION:
[code]
SQL&gt; SELECT /*+ NO_QUERY_TRANSFORMATION */
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 895956251

-----------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost  &#124;
-----------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;     5 &#124;    15 &#124;     1 &#124;
&#124;*  1 &#124;  FILTER            &#124;      &#124;       &#124;       &#124;       &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;     5 &#124;    15 &#124;     1 &#124;
&#124;*  3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;    13 &#124;    39 &#124;     1 &#124;
-----------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter( EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=:B1))
   3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)

Note
-----
   - cpu costing is off (consider enabling it)
[/code]
 
OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;, unhinted:
[code]
SQL&gt; SELECT
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 1713220790

---------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;    80 &#124;   480 &#124;     6  (17)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  HASH JOIN SEMI    &#124;      &#124;    80 &#124;   480 &#124;     6  (17)&#124; 00:00:01 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100 &#124;   300 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;  1000 &#124;  3000 &#124;     3   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]
 
OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;, hinted with NO_QUERY_TRANSFORMATION:
[code]
SQL&gt; SELECT /*+ NO_QUERY_TRANSFORMATION */
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 895956251

---------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;     1 &#124;     3 &#124;   102   (0)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  FILTER            &#124;      &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100 &#124;   300 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;*  3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;     2 &#124;     6 &#124;     2   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter( EXISTS (SELECT /*+ */ 0 FROM &quot;T2&quot; &quot;T2&quot; WHERE
              &quot;T2&quot;.&quot;C1&quot;=:B1))
   3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
[/code]

Of course it is possible to pull the execution plans from the server&#039;s memory to compare with something like this:
[code]
SET LINESIZE 140
SET TRIMSPOOL ON
SET PAGESIZE 1000

SELECT /*+ LEADING(S) */
  T.PLAN_TABLE_OUTPUT
FROM
  (SELECT
    SQL_ID,
    CHILD_NUMBER
  FROM
    V$SQL
  WHERE
    SQL_TEXT LIKE &#039;SELECT %T1.C1 IN (%&#039;) S,
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(S.SQL_ID,S.CHILD_NUMBER,&#039;TYPICAL&#039;)) T;
[/code]

I guess that it is good to try to learn something new every day.]]></description>
		<content:encoded><![CDATA[<p>I just noticed something as a result of what Kerry Osborne wrote into chapter 11 (page 342) of the SQL book.  Autotrace will show in the <strong>Predicate Information</strong> section more detailed information, for example &#8220;<strong>1 &#8211; filter( EXISTS (SELECT 0 FROM &#8220;T2&#8243; &#8220;T2&#8243; WHERE &#8220;T2&#8243;.&#8221;C1&#8243;=:B1))</strong>&#8220;, while the 10053 trace file and DBMS_XPLAN.DISPLAY_CURSOR function display less detail, for example &#8220;<strong>1 &#8211; filter( IS NOT NULL)</strong>&#8220;.</p>
<p>For example, if we rerun the script from my previous comment with AUTOTRACE enabled:</p>
<pre class="brush: plain; title: ; notranslate">
SET AUTOTRACE TRACEONLY EXPLAIN
</pre>
<p>We will see the more extensive detail provided by AUTOTRACE:</p>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;8.1.7&#8242;, unhinted:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 1304214603

-----------------------------------------------------------------
| Id  | Operation            | Name     | Rows  | Bytes | Cost  |
-----------------------------------------------------------------
|   0 | SELECT STATEMENT     |          |    80 |  1280 |     6 |
|*  1 |  HASH JOIN           |          |    80 |  1280 |     6 |
|   2 |   VIEW               | VW_NSO_1 |    80 |  1040 |     4 |
|   3 |    SORT UNIQUE       |          |    80 |   240 |     4 |
|   4 |     TABLE ACCESS FULL| T2       |  1000 |  3000 |     1 |
|   5 |   TABLE ACCESS FULL  | T1       |   100 |   300 |     1 |
-----------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;$nso_col_1&quot;)

Note
-----
   - cpu costing is off (consider enabling it)
</pre>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;8.1.7&#8242;, hinted with NO_QUERY_TRANSFORMATION:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT /*+ NO_QUERY_TRANSFORMATION */
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 895956251

-----------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost  |
-----------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     5 |    15 |     1 |
|*  1 |  FILTER            |      |       |       |       |
|   2 |   TABLE ACCESS FULL| T1   |     5 |    15 |     1 |
|*  3 |   TABLE ACCESS FULL| T2   |    13 |    39 |     1 |
-----------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter( EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=:B1))
   3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)

Note
-----
   - cpu costing is off (consider enabling it)
</pre>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;10.2.0.2&#8242;, unhinted:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 1713220790

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |    80 |   480 |     6  (17)| 00:00:01 |
|*  1 |  HASH JOIN SEMI    |      |    80 |   480 |     6  (17)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| T1   |   100 |   300 |     2   (0)| 00:00:01 |
|   3 |   TABLE ACCESS FULL| T2   |  1000 |  3000 |     3   (0)| 00:00:01 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;10.2.0.2&#8242;, hinted with NO_QUERY_TRANSFORMATION:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT /*+ NO_QUERY_TRANSFORMATION */
  2    T1.C1,
  3    2
  4  FROM
  5    T1
  6  WHERE
  7    T1.C1 IN (
  8      SELECT
  9        T2.C1
 10      FROM
 11        T2);

Execution Plan
----------------------------------------------------------
Plan hash value: 895956251

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 |     3 |   102   (0)| 00:00:01 |
|*  1 |  FILTER            |      |       |       |            |          |
|   2 |   TABLE ACCESS FULL| T1   |   100 |   300 |     2   (0)| 00:00:01 |
|*  3 |   TABLE ACCESS FULL| T2   |     2 |     6 |     2   (0)| 00:00:01 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter( EXISTS (SELECT /*+ */ 0 FROM &quot;T2&quot; &quot;T2&quot; WHERE
              &quot;T2&quot;.&quot;C1&quot;=:B1))
   3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
</pre>
<p>Of course it is possible to pull the execution plans from the server&#8217;s memory to compare with something like this:</p>
<pre class="brush: plain; title: ; notranslate">
SET LINESIZE 140
SET TRIMSPOOL ON
SET PAGESIZE 1000

SELECT /*+ LEADING(S) */
  T.PLAN_TABLE_OUTPUT
FROM
  (SELECT
    SQL_ID,
    CHILD_NUMBER
  FROM
    V$SQL
  WHERE
    SQL_TEXT LIKE 'SELECT %T1.C1 IN (%') S,
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(S.SQL_ID,S.CHILD_NUMBER,'TYPICAL')) T;
</pre>
<p>I guess that it is good to try to learn something new every day.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2574</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 03 Jan 2011 15:22:48 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2574</guid>
		<description><![CDATA[Jonathan,

Thank you for the comments.  I am probably remembering incorrectly, but I thought that the decision to convert an IN type query to an EXISTS type query was a cost-based decision starting with Oracle Database 10.1 - but maybe I am confusing that transformation decision with the transformation decision to convert an IN type query into an inline view.

I mentioned in the blog article that Oracle Database 8.1.7.x did not automatically transform IN type queries into EXISTS type queries, so if we were to set OPTIMIZER_FEATURES_ENABLE to 8.1.7, we should see that same behavior.  Here is a test that was performed on Oracle Database 10.2.0.2:
[code]
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;8.1.7&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER=&#039;NO_QUERY_TRANSFORM_817&#039;;
 
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;
 
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;
 
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER=&#039;NO_QUERY_TRANSFORM_102&#039;;
 
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;
 
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;
[/code]

The result?  The transformation was *not* made from an IN type query to an EXISTS type query unless the NO_QUERY_TRANSFORMATION hint was provided.  From looking at the 10053 trace file, it appears that the optimizer did not even consider transforming the query to an EXISTS type query unless the NO_QUERY_TRANSFORMATION hint was provided.  Here is partial output from the 10053 trace file:
OPTIMIZER_FEATURES_ENABLE=&#039;8.1.7&#039;, unhinted:
[code]
***************
Subquery Unnest
***************
SU: Considering subquery unnesting in query block SEL$1 (#0)
SU:   Transform an ANY subquery to semi-join or distinct.
Registered qb: SEL$683B0107 0x9de4df8 (SUBQ INTO VIEW FOR COMPLEX UNNEST SEL$2)
  signature (): qb_name=SEL$683B0107 nbfros=1 flg=0
    fro(0): flg=0 objn=114487 hint_alias=&quot;T2&quot;@&quot;SEL$2&quot;
Registered qb: SEL$5DA710D3 0x9de7690 (SUBQUERY UNNEST SEL$1; SEL$2)
  signature (): qb_name=SEL$5DA710D3 nbfros=2 flg=0
    fro(0): flg=0 objn=114486 hint_alias=&quot;T1&quot;@&quot;SEL$1&quot;
    fro(1): flg=5 objn=0 hint_alias=&quot;VW_NSO_1&quot;@&quot;SEL$5DA710D3&quot;
...
******* UNPARSED QUERY IS *******
SELECT &quot;T1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM  (SELECT DISTINCT &quot;T2&quot;.&quot;C1&quot; &quot;$nso_col_1&quot; FROM 
&quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot;) &quot;VW_NSO_1&quot;,&quot;TESTUSER&quot;.&quot;T1&quot; &quot;T1&quot; WHERE &quot;T1&quot;.&quot;C1&quot;=&quot;VW_NSO_1&quot;.&quot;$nso_col_1&quot;
kkoqbc-end
          : call(in-use=50912, alloc=65448), compile(in-use=47944, alloc=50120)
apadrv-end: call(in-use=50912, alloc=65448), compile(in-use=49136, alloc=50120)
 
sql_id=5605v8hmasq62.
Current SQL statement for this session:
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
----------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation             &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
----------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT      &#124;         &#124;       &#124;       &#124;     6 &#124;           &#124;
&#124; 1   &#124;  HASH JOIN            &#124;         &#124;    80 &#124;  1280 &#124;     6 &#124;           &#124;
&#124; 2   &#124;   VIEW                &#124; VW_NSO_1&#124;    80 &#124;  1040 &#124;     4 &#124;           &#124;
&#124; 3   &#124;    SORT UNIQUE        &#124;         &#124;    80 &#124;   240 &#124;     4 &#124;           &#124;
&#124; 4   &#124;     TABLE ACCESS FULL &#124; T2      &#124;  1000 &#124;  3000 &#124;     1 &#124;           &#124;
&#124; 5   &#124;   TABLE ACCESS FULL   &#124; T1      &#124;   100 &#124;   300 &#124;     1 &#124;           &#124;
----------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;$nso_col_1&quot;)
[/code]
 
OPTIMIZER_FEATURES_ENABLE=&#039;8.1.7&#039;, hinted with NO_QUERY_TRANSFORMATION:
[code]
Registered qb: SEL$1 0x9de7690 (PARSER)
  signature (): qb_name=SEL$1 nbfros=1 flg=0
    fro(0): flg=4 objn=114486 hint_alias=&quot;T1&quot;@&quot;SEL$1&quot;
Registered qb: SEL$2 0x9de4df8 (PARSER)
  signature (): qb_name=SEL$2 nbfros=1 flg=0
    fro(0): flg=4 objn=114487 hint_alias=&quot;T2&quot;@&quot;SEL$2&quot;
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#0).
PM:   Checking validity of predicate move-around in SEL$1 (#0).
PM:     PM bypassed: Predicate move-around not enabled.
CBQT: Validity checks failed for 2dqpt9zsngrrm.
CVM: Considering view merge in query block SEL$1 (#0)
CVM: Considering view merge in query block SEL$2 (#0)
CBQT: Validity checks failed for 2dqpt9zsngrrm.
***************
Subquery Unnest
***************
SU: Considering subquery unnesting in query block SEL$1 (#0)
SU:   Unnesting subquery SEL$2 (#0)
SU:     SU bypassed: No unnest hint.
*************************
Set-Join Conversion (SJC)
*************************
SJC: Considering set-join conversion in SEL$1 (#0).
SJC: Considering set-join conversion in SEL$2 (#0).
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#0).
PM:   Checking validity of predicate move-around in SEL$1 (#0).
PM:     PM bypassed: Predicate move-around not enabled.
FPD: Considering simple filter push in SEL$1 (#0)
FPD:   Current where clause predicates in SEL$1 (#0) :
          EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
FPD: Considering simple filter push in SEL$2 (#0)
FPD:   Current where clause predicates in SEL$2 (#0) :
         &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$2 (#0)
predicates with check contraints: &quot;T2&quot;.&quot;C1&quot;=:B1
after transitive predicate generation: &quot;T2&quot;.&quot;C1&quot;=:B1
finally: &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
predicates with check contraints:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
after transitive predicate generation:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
finally:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
...
******* UNPARSED QUERY IS *******
SELECT &quot;SYS_ALIAS_1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T1&quot; &quot;SYS_ALIAS_1&quot; 
WHERE  EXISTS (SELECT 0 FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=&quot;SYS_ALIAS_1&quot;.&quot;C1&quot;)
kkoqbc-end
          : call(in-use=45136, alloc=65448), compile(in-use=45576, alloc=46360)
apadrv-end: call(in-use=45136, alloc=65448), compile(in-use=46744, alloc=50120)
 
sql_id=0xskx5manu92p.
Current SQL statement for this session:
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation           &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT    &#124;         &#124;       &#124;       &#124;     1 &#124;           &#124;
&#124; 1   &#124;  FILTER             &#124;         &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 2   &#124;   TABLE ACCESS FULL &#124; T1      &#124;     5 &#124;    15 &#124;     1 &#124;           &#124;
&#124; 3   &#124;   TABLE ACCESS FULL &#124; T2      &#124;    13 &#124;    39 &#124;     1 &#124;           &#124;
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - filter( IS NOT NULL)
3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
[/code]
--------------------------------
 
OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;, unhinted:
[code]
*******************************
Cost-Based Complex View Merging
*******************************
CVM: Finding query blocks in SEL$5DA710D3 (#1) that are valid to merge.
Query block (0000000009DE0F58) before join elimination:
SQL:
Query block (0000000009DE0F58) unchanged
SU:   Transforming ANY subquery to a join.
...
******* UNPARSED QUERY IS *******
SELECT &quot;T1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot;,&quot;TESTUSER&quot;.&quot;T1&quot; &quot;T1&quot; 
WHERE &quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;
kkoqbc-end
          : call(in-use=34992, alloc=49080), compile(in-use=66128, alloc=103680)
apadrv-end: call(in-use=34992, alloc=49080), compile(in-use=66984, alloc=103680)
 
sql_id=5605v8hmasq62.
Current SQL statement for this session:
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation           &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT    &#124;         &#124;       &#124;       &#124;     6 &#124;           &#124;
&#124; 1   &#124;  HASH JOIN SEMI     &#124;         &#124;    80 &#124;   480 &#124;     6 &#124;  00:00:01 &#124;
&#124; 2   &#124;   TABLE ACCESS FULL &#124; T1      &#124;   100 &#124;   300 &#124;     2 &#124;  00:00:01 &#124;
&#124; 3   &#124;   TABLE ACCESS FULL &#124; T2      &#124;  1000 &#124;  3000 &#124;     3 &#124;  00:00:01 &#124;
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]
 
OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;, hinted with NO_QUERY_TRANSFORMATION:
[code]
COST-BASED QUERY TRANSFORMATIONS
********************************
FPD: Considering simple filter push (pre rewrite) in SEL$1 (#0)
FPD:   Current where clause predicates in SEL$1 (#0) :
         &quot;T1&quot;.&quot;C1&quot;=ANY (SELECT &quot;T2&quot;.&quot;C1&quot; FROM &quot;T2&quot; &quot;T2&quot;)
Registered qb: SEL$1 0x9de0f58 (COPY SEL$1)
  signature(): NULL
Registered qb: SEL$2 0x119ffd20 (COPY SEL$2)
  signature(): NULL
*****************************
Cost-Based Subquery Unnesting
*****************************
SU: No subqueries to consider in query block SEL$2 (#2).
SU: Considering subquery unnesting in query block SEL$1 (#1)
SU: Performing unnesting that does not require costing.
SU: Considering subquery unnest on SEL$1 (#1).
SU:   Checking validity of unnesting subquery SEL$2 (#2)
SU:     SU bypassed: Negative hint found.
*******************************
Cost-Based Complex View Merging
*******************************
CVM: Finding query blocks in SEL$1 (#1) that are valid to merge.
*************************
Set-Join Conversion (SJC)
*************************
SJC: Considering set-join conversion in SEL$1 (#1).
SJC: Considering set-join conversion in SEL$2 (#2).
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#1).
PM:   Checking validity of predicate move-around in SEL$1 (#1).
PM:     PM bypassed: Outer query contains no views.
***********************************
Cost-Based Filter Predicate Pull-Up
***********************************
***********************************
Cost-Based Join Predicate Push-down
***********************************
JPPD: Checking validity of push-down in query block SEL$2 (#2)
JPPD:   No view found to push predicate into.
JPPD: Checking validity of push-down in query block SEL$1 (#1)
JPPD:   No view found to push predicate into.
JPPD: Applying transformation directives
JPPD: Checking validity of push-down in query block SEL$2 (#2)
JPPD:   No view found to push predicate into.
JPPD: Checking validity of push-down in query block SEL$1 (#1)
JPPD:   No view found to push predicate into.
FPD: Considering simple filter push in SEL$1 (#1)
FPD:   Current where clause predicates in SEL$1 (#1) :
          EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
FPD: Considering simple filter push in SEL$2 (#2)
FPD:   Current where clause predicates in SEL$2 (#2) :
         &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$2 (#2)
predicates with check contraints: &quot;T2&quot;.&quot;C1&quot;=:B1
after transitive predicate generation: &quot;T2&quot;.&quot;C1&quot;=:B1
finally: &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#1)
predicates with check contraints:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
after transitive predicate generation:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
finally:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
...
******* UNPARSED QUERY IS *******
SELECT /*+ */ &quot;SYS_ALIAS_1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T1&quot; &quot;SYS_ALIAS_1&quot; 
WHERE  EXISTS (SELECT /*+ */ 0 FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=&quot;SYS_ALIAS_1&quot;.&quot;C1&quot;)
kkoqbc-end
          : call(in-use=93048, alloc=98184), compile(in-use=78880, alloc=103680)
apadrv-end: call(in-use=93048, alloc=98184), compile(in-use=80000, alloc=103680)
 
sql_id=0xskx5manu92p.
Current SQL statement for this session:
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation           &#124; Name    &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT    &#124;         &#124;       &#124;       &#124;   102 &#124;           &#124;
&#124; 1   &#124;  FILTER             &#124;         &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 2   &#124;   TABLE ACCESS FULL &#124; T1      &#124;   100 &#124;   300 &#124;     2 &#124;  00:00:01 &#124;
&#124; 3   &#124;   TABLE ACCESS FULL &#124; T2      &#124;     2 &#124;     6 &#124;     2 &#124;  00:00:01 &#124;
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - filter( IS NOT NULL)
3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
[/code]

Other than the differences in cardinality estimates and cost estimates, the execution plans with the NO_QUERY_TRANSFORMATION hint appear to be identical, regardless of the OPTIMIZER_FEATURES_ENABLE value.  I am not expecting an explanation of why this happens, I just thought that it would be interesting to post these findings.]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Thank you for the comments.  I am probably remembering incorrectly, but I thought that the decision to convert an IN type query to an EXISTS type query was a cost-based decision starting with Oracle Database 10.1 &#8211; but maybe I am confusing that transformation decision with the transformation decision to convert an IN type query into an inline view.</p>
<p>I mentioned in the blog article that Oracle Database 8.1.7.x did not automatically transform IN type queries into EXISTS type queries, so if we were to set OPTIMIZER_FEATURES_ENABLE to 8.1.7, we should see that same behavior.  Here is a test that was performed on Oracle Database 10.2.0.2:</p>
<pre class="brush: plain; title: ; notranslate">
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='8.1.7';
ALTER SESSION SET TRACEFILE_IDENTIFIER='NO_QUERY_TRANSFORM_817';
 
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';
 
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.2.0.2';
ALTER SESSION SET TRACEFILE_IDENTIFIER='NO_QUERY_TRANSFORM_102';
 
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);
 
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2);

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';
</pre>
<p>The result?  The transformation was *not* made from an IN type query to an EXISTS type query unless the NO_QUERY_TRANSFORMATION hint was provided.  From looking at the 10053 trace file, it appears that the optimizer did not even consider transforming the query to an EXISTS type query unless the NO_QUERY_TRANSFORMATION hint was provided.  Here is partial output from the 10053 trace file:<br />
OPTIMIZER_FEATURES_ENABLE=&#8217;8.1.7&#8242;, unhinted:</p>
<pre class="brush: plain; title: ; notranslate">
***************
Subquery Unnest
***************
SU: Considering subquery unnesting in query block SEL$1 (#0)
SU:   Transform an ANY subquery to semi-join or distinct.
Registered qb: SEL$683B0107 0x9de4df8 (SUBQ INTO VIEW FOR COMPLEX UNNEST SEL$2)
  signature (): qb_name=SEL$683B0107 nbfros=1 flg=0
    fro(0): flg=0 objn=114487 hint_alias=&quot;T2&quot;@&quot;SEL$2&quot;
Registered qb: SEL$5DA710D3 0x9de7690 (SUBQUERY UNNEST SEL$1; SEL$2)
  signature (): qb_name=SEL$5DA710D3 nbfros=2 flg=0
    fro(0): flg=0 objn=114486 hint_alias=&quot;T1&quot;@&quot;SEL$1&quot;
    fro(1): flg=5 objn=0 hint_alias=&quot;VW_NSO_1&quot;@&quot;SEL$5DA710D3&quot;
...
******* UNPARSED QUERY IS *******
SELECT &quot;T1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM  (SELECT DISTINCT &quot;T2&quot;.&quot;C1&quot; &quot;$nso_col_1&quot; FROM 
&quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot;) &quot;VW_NSO_1&quot;,&quot;TESTUSER&quot;.&quot;T1&quot; &quot;T1&quot; WHERE &quot;T1&quot;.&quot;C1&quot;=&quot;VW_NSO_1&quot;.&quot;$nso_col_1&quot;
kkoqbc-end
          : call(in-use=50912, alloc=65448), compile(in-use=47944, alloc=50120)
apadrv-end: call(in-use=50912, alloc=65448), compile(in-use=49136, alloc=50120)
 
sql_id=5605v8hmasq62.
Current SQL statement for this session:
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
----------------------------------------+-----------------------------------+
| Id  | Operation             | Name    | Rows  | Bytes | Cost  | Time      |
----------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT      |         |       |       |     6 |           |
| 1   |  HASH JOIN            |         |    80 |  1280 |     6 |           |
| 2   |   VIEW                | VW_NSO_1|    80 |  1040 |     4 |           |
| 3   |    SORT UNIQUE        |         |    80 |   240 |     4 |           |
| 4   |     TABLE ACCESS FULL | T2      |  1000 |  3000 |     1 |           |
| 5   |   TABLE ACCESS FULL   | T1      |   100 |   300 |     1 |           |
----------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;$nso_col_1&quot;)
</pre>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;8.1.7&#8242;, hinted with NO_QUERY_TRANSFORMATION:</p>
<pre class="brush: plain; title: ; notranslate">
Registered qb: SEL$1 0x9de7690 (PARSER)
  signature (): qb_name=SEL$1 nbfros=1 flg=0
    fro(0): flg=4 objn=114486 hint_alias=&quot;T1&quot;@&quot;SEL$1&quot;
Registered qb: SEL$2 0x9de4df8 (PARSER)
  signature (): qb_name=SEL$2 nbfros=1 flg=0
    fro(0): flg=4 objn=114487 hint_alias=&quot;T2&quot;@&quot;SEL$2&quot;
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#0).
PM:   Checking validity of predicate move-around in SEL$1 (#0).
PM:     PM bypassed: Predicate move-around not enabled.
CBQT: Validity checks failed for 2dqpt9zsngrrm.
CVM: Considering view merge in query block SEL$1 (#0)
CVM: Considering view merge in query block SEL$2 (#0)
CBQT: Validity checks failed for 2dqpt9zsngrrm.
***************
Subquery Unnest
***************
SU: Considering subquery unnesting in query block SEL$1 (#0)
SU:   Unnesting subquery SEL$2 (#0)
SU:     SU bypassed: No unnest hint.
*************************
Set-Join Conversion (SJC)
*************************
SJC: Considering set-join conversion in SEL$1 (#0).
SJC: Considering set-join conversion in SEL$2 (#0).
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#0).
PM:   Checking validity of predicate move-around in SEL$1 (#0).
PM:     PM bypassed: Predicate move-around not enabled.
FPD: Considering simple filter push in SEL$1 (#0)
FPD:   Current where clause predicates in SEL$1 (#0) :
          EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
FPD: Considering simple filter push in SEL$2 (#0)
FPD:   Current where clause predicates in SEL$2 (#0) :
         &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$2 (#0)
predicates with check contraints: &quot;T2&quot;.&quot;C1&quot;=:B1
after transitive predicate generation: &quot;T2&quot;.&quot;C1&quot;=:B1
finally: &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
predicates with check contraints:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
after transitive predicate generation:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
finally:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
...
******* UNPARSED QUERY IS *******
SELECT &quot;SYS_ALIAS_1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T1&quot; &quot;SYS_ALIAS_1&quot; 
WHERE  EXISTS (SELECT 0 FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=&quot;SYS_ALIAS_1&quot;.&quot;C1&quot;)
kkoqbc-end
          : call(in-use=45136, alloc=65448), compile(in-use=45576, alloc=46360)
apadrv-end: call(in-use=45136, alloc=65448), compile(in-use=46744, alloc=50120)
 
sql_id=0xskx5manu92p.
Current SQL statement for this session:
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
| Id  | Operation           | Name    | Rows  | Bytes | Cost  | Time      |
--------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT    |         |       |       |     1 |           |
| 1   |  FILTER             |         |       |       |       |           |
| 2   |   TABLE ACCESS FULL | T1      |     5 |    15 |     1 |           |
| 3   |   TABLE ACCESS FULL | T2      |    13 |    39 |     1 |           |
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - filter( IS NOT NULL)
3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;10.2.0.2&#8242;, unhinted:</p>
<pre class="brush: plain; title: ; notranslate">
*******************************
Cost-Based Complex View Merging
*******************************
CVM: Finding query blocks in SEL$5DA710D3 (#1) that are valid to merge.
Query block (0000000009DE0F58) before join elimination:
SQL:
Query block (0000000009DE0F58) unchanged
SU:   Transforming ANY subquery to a join.
...
******* UNPARSED QUERY IS *******
SELECT &quot;T1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot;,&quot;TESTUSER&quot;.&quot;T1&quot; &quot;T1&quot; 
WHERE &quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;
kkoqbc-end
          : call(in-use=34992, alloc=49080), compile(in-use=66128, alloc=103680)
apadrv-end: call(in-use=34992, alloc=49080), compile(in-use=66984, alloc=103680)
 
sql_id=5605v8hmasq62.
Current SQL statement for this session:
SELECT
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
| Id  | Operation           | Name    | Rows  | Bytes | Cost  | Time      |
--------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT    |         |       |       |     6 |           |
| 1   |  HASH JOIN SEMI     |         |    80 |   480 |     6 |  00:00:01 |
| 2   |   TABLE ACCESS FULL | T1      |   100 |   300 |     2 |  00:00:01 |
| 3   |   TABLE ACCESS FULL | T2      |  1000 |  3000 |     3 |  00:00:01 |
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<p>OPTIMIZER_FEATURES_ENABLE=&#8217;10.2.0.2&#8242;, hinted with NO_QUERY_TRANSFORMATION:</p>
<pre class="brush: plain; title: ; notranslate">
COST-BASED QUERY TRANSFORMATIONS
********************************
FPD: Considering simple filter push (pre rewrite) in SEL$1 (#0)
FPD:   Current where clause predicates in SEL$1 (#0) :
         &quot;T1&quot;.&quot;C1&quot;=ANY (SELECT &quot;T2&quot;.&quot;C1&quot; FROM &quot;T2&quot; &quot;T2&quot;)
Registered qb: SEL$1 0x9de0f58 (COPY SEL$1)
  signature(): NULL
Registered qb: SEL$2 0x119ffd20 (COPY SEL$2)
  signature(): NULL
*****************************
Cost-Based Subquery Unnesting
*****************************
SU: No subqueries to consider in query block SEL$2 (#2).
SU: Considering subquery unnesting in query block SEL$1 (#1)
SU: Performing unnesting that does not require costing.
SU: Considering subquery unnest on SEL$1 (#1).
SU:   Checking validity of unnesting subquery SEL$2 (#2)
SU:     SU bypassed: Negative hint found.
*******************************
Cost-Based Complex View Merging
*******************************
CVM: Finding query blocks in SEL$1 (#1) that are valid to merge.
*************************
Set-Join Conversion (SJC)
*************************
SJC: Considering set-join conversion in SEL$1 (#1).
SJC: Considering set-join conversion in SEL$2 (#2).
**************************
Predicate Move-Around (PM)
**************************
PM: Considering predicate move-around in SEL$1 (#1).
PM:   Checking validity of predicate move-around in SEL$1 (#1).
PM:     PM bypassed: Outer query contains no views.
***********************************
Cost-Based Filter Predicate Pull-Up
***********************************
***********************************
Cost-Based Join Predicate Push-down
***********************************
JPPD: Checking validity of push-down in query block SEL$2 (#2)
JPPD:   No view found to push predicate into.
JPPD: Checking validity of push-down in query block SEL$1 (#1)
JPPD:   No view found to push predicate into.
JPPD: Applying transformation directives
JPPD: Checking validity of push-down in query block SEL$2 (#2)
JPPD:   No view found to push predicate into.
JPPD: Checking validity of push-down in query block SEL$1 (#1)
JPPD:   No view found to push predicate into.
FPD: Considering simple filter push in SEL$1 (#1)
FPD:   Current where clause predicates in SEL$1 (#1) :
          EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
FPD: Considering simple filter push in SEL$2 (#2)
FPD:   Current where clause predicates in SEL$2 (#2) :
         &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$2 (#2)
predicates with check contraints: &quot;T2&quot;.&quot;C1&quot;=:B1
after transitive predicate generation: &quot;T2&quot;.&quot;C1&quot;=:B1
finally: &quot;T2&quot;.&quot;C1&quot;=:B1
kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#1)
predicates with check contraints:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
after transitive predicate generation:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
finally:  EXISTS (SELECT 0 FROM &quot;T2&quot; &quot;T2&quot;)
...
******* UNPARSED QUERY IS *******
SELECT /*+ */ &quot;SYS_ALIAS_1&quot;.&quot;C1&quot; &quot;C1&quot;,2 &quot;2&quot; FROM &quot;TESTUSER&quot;.&quot;T1&quot; &quot;SYS_ALIAS_1&quot; 
WHERE  EXISTS (SELECT /*+ */ 0 FROM &quot;TESTUSER&quot;.&quot;T2&quot; &quot;T2&quot; WHERE &quot;T2&quot;.&quot;C1&quot;=&quot;SYS_ALIAS_1&quot;.&quot;C1&quot;)
kkoqbc-end
          : call(in-use=93048, alloc=98184), compile(in-use=78880, alloc=103680)
apadrv-end: call(in-use=93048, alloc=98184), compile(in-use=80000, alloc=103680)
 
sql_id=0xskx5manu92p.
Current SQL statement for this session:
SELECT /*+ NO_QUERY_TRANSFORMATION */
  T1.C1,
  2
FROM
  T1
WHERE
  T1.C1 IN (
    SELECT
      T2.C1
    FROM
      T2)
 
============
Plan Table
============
--------------------------------------+-----------------------------------+
| Id  | Operation           | Name    | Rows  | Bytes | Cost  | Time      |
--------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT    |         |       |       |   102 |           |
| 1   |  FILTER             |         |       |       |       |           |
| 2   |   TABLE ACCESS FULL | T1      |   100 |   300 |     2 |  00:00:01 |
| 3   |   TABLE ACCESS FULL | T2      |     2 |     6 |     2 |  00:00:01 |
--------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - filter( IS NOT NULL)
3 - filter(&quot;T2&quot;.&quot;C1&quot;=:B1)
</pre>
<p>Other than the differences in cardinality estimates and cost estimates, the execution plans with the NO_QUERY_TRANSFORMATION hint appear to be identical, regardless of the OPTIMIZER_FEATURES_ENABLE value.  I am not expecting an explanation of why this happens, I just thought that it would be interesting to post these findings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2572</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 03 Jan 2011 09:01:57 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4187#comment-2572</guid>
		<description><![CDATA[Charles,

It could be quite entertaining to think about what Oracle would do with ANSI SQL if you include the /*+ no_query_transformation */ hint. If it meant what it appears to mean then Oracle wouldn&#039;t be able to optimise it at all because ANSI has to be transformed BEFORE optimisation.

I&#039;ve always assumed that the hint meant &quot;no cost based query transformation&quot; - which would allow some &quot;heuristic&quot; transformations and &quot;canonical&quot; transformations to take place.  (Canonical probably isn&#039;t the right word, but I was thinking of the IN / EXISTS rewrite that ought to have nothing to do with cost, and simply acted to standardise the text).]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>It could be quite entertaining to think about what Oracle would do with ANSI SQL if you include the /*+ no_query_transformation */ hint. If it meant what it appears to mean then Oracle wouldn&#8217;t be able to optimise it at all because ANSI has to be transformed BEFORE optimisation.</p>
<p>I&#8217;ve always assumed that the hint meant &#8220;no cost based query transformation&#8221; &#8211; which would allow some &#8220;heuristic&#8221; transformations and &#8220;canonical&#8221; transformations to take place.  (Canonical probably isn&#8217;t the right word, but I was thinking of the IN / EXISTS rewrite that ought to have nothing to do with cost, and simply acted to standardise the text).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
