<?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: SELECT Statement is Fast, INSERT INTO Using the SELECT Statement is Brutally Slow 1</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Mon, 13 May 2013 14:10:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2485</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 20 Dec 2010 00:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2485</guid>
		<description><![CDATA[Great tips for troubleshooting the problem.  I wonder if the OPTIMIZER_FEATURES_ENABLE value of 10.1.0.4 causes the optimizer to unconditionally perform the complex view merging like 9i.  There is a definite behavior change in the optimization of some queries with the OPTIMIZER_FEATURES_ENABLE parameter set to 10.1.0.4 compared to 10.1.0.5 or 10.2.0.1.  I need to spend some time digging through 10053 trace files to satisfy a curiosity about this unexpected performance issue.]]></description>
		<content:encoded><![CDATA[<p>Great tips for troubleshooting the problem.  I wonder if the OPTIMIZER_FEATURES_ENABLE value of 10.1.0.4 causes the optimizer to unconditionally perform the complex view merging like 9i.  There is a definite behavior change in the optimization of some queries with the OPTIMIZER_FEATURES_ENABLE parameter set to 10.1.0.4 compared to 10.1.0.5 or 10.2.0.1.  I need to spend some time digging through 10053 trace files to satisfy a curiosity about this unexpected performance issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2484</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 20 Dec 2010 00:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2484</guid>
		<description><![CDATA[Jonathan,

Thank you for providing the link to that article.  I recall reading about that feedback loop in your &quot;Cost-Based Oracle Fundamentals&quot; book.  Speaking of which, I am still waiting for volumes 2 and 3 of the book series.  :-)

It is interesting that the performance problem is present in the test case script (found in the follow-up article) when the OPTIMIZER_FEATURES_ENABLE is set to 10.1.0.4 in both Oracle Database 10.2.0.2 and 11.2.0.1, but the problem is not present in Oracle Database 10.2.0.5 when the test is repeated in either the Standard Edition or the Enterprise Edition (that will be illustrated in part 3).]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Thank you for providing the link to that article.  I recall reading about that feedback loop in your &#8220;Cost-Based Oracle Fundamentals&#8221; book.  Speaking of which, I am still waiting for volumes 2 and 3 of the book series.  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>It is interesting that the performance problem is present in the test case script (found in the follow-up article) when the OPTIMIZER_FEATURES_ENABLE is set to 10.1.0.4 in both Oracle Database 10.2.0.2 and 11.2.0.1, but the problem is not present in Oracle Database 10.2.0.5 when the test is repeated in either the Standard Edition or the Enterprise Edition (that will be illustrated in part 3).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2475</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sat, 18 Dec 2010 17:00:17 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2475</guid>
		<description><![CDATA[Part 2 of the blog article series is now on this blog.  I am able to reproduce the execution plan change with a reproducible test case on Oracle Database 11.2.0.1 (see the execution plans at the end of the second article).]]></description>
		<content:encoded><![CDATA[<p>Part 2 of the blog article series is now on this blog.  I am able to reproduce the execution plan change with a reproducible test case on Oracle Database 11.2.0.1 (see the execution plans at the end of the second article).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2474</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 18 Dec 2010 16:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2474</guid>
		<description><![CDATA[Charles,

Just  hogging things here, but I realised I missed an opportunity to advertise my extremely excellent blog ;) where there&#039;s a little note that shows this type of CVM. http://jonathanlewis.wordpress.com/2007/03/08/transformation-and-optimisation/]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>Just  hogging things here, but I realised I missed an opportunity to advertise my extremely excellent blog <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  where there&#8217;s a little note that shows this type of CVM. <a href="http://jonathanlewis.wordpress.com/2007/03/08/transformation-and-optimisation/" rel="nofollow">http://jonathanlewis.wordpress.com/2007/03/08/transformation-and-optimisation/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2471</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 18 Dec 2010 16:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2471</guid>
		<description><![CDATA[Charles,

I forgot to say - after checking what was going on, I&#039;d try to model it with a simpler example - &quot;insert as select from two table join which could be satisfied by index-only acceses&quot; (similar to the original nested loop join section.

Regards
Jonathan Lewis]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>I forgot to say &#8211; after checking what was going on, I&#8217;d try to model it with a simpler example &#8211; &#8220;insert as select from two table join which could be satisfied by index-only acceses&#8221; (similar to the original nested loop join section.</p>
<p>Regards<br />
Jonathan Lewis</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2470</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 18 Dec 2010 16:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2470</guid>
		<description><![CDATA[Charles,

I am a late arrival at this party - but my approach would be as follows:
Comparing lines 4 - 7 in the first plan with lines 4  - 10 in the second plan, there&#039;s clearly an example of complex view merging taking place (&quot;group by then join&quot; turns into &quot;join then group by&quot;).

The complex view merging would have been unconditional in 9i - but should be costed in 10g: so (although I rarely use the 10053 trace this early in an investigation) I would assume in this case that there was a bug in the optimizer code somewhere in the handling of the &quot;insert as select&quot;. 

I&#039;d use the no_merge hint suggested by Flado to check that the behaviour changed to the desired behavious. And I&#039;d look at three trace files (select, insert unhinted, insert hinted) to see if I could spot the place where CVM (complex view merging) failed to appear when expected, or appeared with an unsuitable cost; or where the cost of not merging appeared to  be higher than the cost of merging.]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>I am a late arrival at this party &#8211; but my approach would be as follows:<br />
Comparing lines 4 &#8211; 7 in the first plan with lines 4  &#8211; 10 in the second plan, there&#8217;s clearly an example of complex view merging taking place (&#8220;group by then join&#8221; turns into &#8220;join then group by&#8221;).</p>
<p>The complex view merging would have been unconditional in 9i &#8211; but should be costed in 10g: so (although I rarely use the 10053 trace this early in an investigation) I would assume in this case that there was a bug in the optimizer code somewhere in the handling of the &#8220;insert as select&#8221;. </p>
<p>I&#8217;d use the no_merge hint suggested by Flado to check that the behaviour changed to the desired behavious. And I&#8217;d look at three trace files (select, insert unhinted, insert hinted) to see if I could spot the place where CVM (complex view merging) failed to appear when expected, or appeared with an unsuitable cost; or where the cost of not merging appeared to  be higher than the cost of merging.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2465</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 13:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2465</guid>
		<description><![CDATA[I have not had any time to investigate this particular SQL statement - the NO_QUERY_TRANSFORMATION hint generated the execution plan that I expected to see, so I moved on to other items.

For an experiment, I created the following script:
[code]
CREATE TABLE T1_DEST (
  PART_ID VARCHAR2(30),
  REQUIRED_DATE DATE,
  QTY NUMBER,
  PLAN_LEVEL NUMBER);

SET TIMING ON
SET ARRAYSIZE 1000

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.1.0.4&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;SELECT_10.1.0.4&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.1.0.4&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.2.0.2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.2.0.2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;;
ALTER SESSION SET &quot;_OPTIMIZER_UNDO_COST_CHANGE&quot;=&#039;10.2.0.2&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_UNDO_10.2.0.2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_UNDO_10.2.0.2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;
[/code]

(disconnect and reconnect)
[code]
SET TIMING ON
SET ARRAYSIZE 1000

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_INDEX_COST_ADJ=100;
ALTER SESSION SET OPTIMIZER_INDEX_CACHING=0;
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.1.0.4&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;SELECT_10.1.0.4-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.1.0.4-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.2.0.2-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_10.2.0.2-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE=&#039;10.2.0.2&#039;;
ALTER SESSION SET &quot;_OPTIMIZER_UNDO_COST_CHANGE&quot;=&#039;10.2.0.2&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_UNDO_10.2.0.2-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;

ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;INSERT_UNDO_10.2.0.2-2&#039;;
ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;) PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,&#039;NOT-IN-SYSTEM&#039;),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS &#039;10053 TRACE NAME CONTEXT OFF&#039;;
[/code]

The execution plans that were produced from the 10053 trace follow (note that if a hard parse was not performed, nothing will be written to a trace file, so that probably explains why some of the trace file results are missing):
select_10.1.0.4:
[code]
------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                    &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT             &#124;                &#124;       &#124;       &#124;   157 &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY               &#124;                &#124;   204 &#124;   17K &#124;   157 &#124;  00:00:01 &#124;
&#124; 2   &#124;   FILTER                     &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    HASH JOIN OUTER           &#124;                &#124;   374 &#124;   31K &#124;   156 &#124;  00:00:01 &#124;
&#124; 4   &#124;     NESTED LOOPS             &#124;                &#124;   194 &#124;  9506 &#124;    47 &#124;  00:00:01 &#124;
&#124; 5   &#124;      VIEW                    &#124;                &#124;  1993 &#124;   35K &#124;    46 &#124;  00:00:01 &#124;
&#124; 6   &#124;       SORT GROUP BY          &#124;                &#124;  1993 &#124;   39K &#124;    46 &#124;  00:00:01 &#124;
&#124; 7   &#124;        FILTER                &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 9   &#124;      INDEX RANGE SCAN        &#124; EDI830_LINES_PK&#124;     1 &#124;    31 &#124;     1 &#124;  00:00:01 &#124;
&#124; 10  &#124;     VIEW                     &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 11  &#124;      SORT GROUP BY           &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 12  &#124;       HASH JOIN              &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 13  &#124;        TABLE ACCESS FULL     &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 14  &#124;        TABLE ACCESS FULL     &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_10.1.0.4:
[code]
-------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                     &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
-------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; INSERT STATEMENT              &#124;                &#124;       &#124;       &#124;  272K &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY                &#124;                &#124;   204 &#124;   13K &#124;  272K &#124;  00:22:07 &#124;
&#124; 2   &#124;   FILTER                      &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    MERGE JOIN OUTER           &#124;                &#124;   75K &#124; 5046K &#124;  272K &#124;  00:22:07 &#124;
&#124; 4   &#124;     VIEW                      &#124;                &#124;   69K &#124; 2129K &#124;  272K &#124;  00:22:06 &#124;
&#124; 5   &#124;      FILTER                   &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 6   &#124;       SORT GROUP BY           &#124;                &#124;   69K &#124; 3502K &#124;  272K &#124;  00:22:06 &#124;
&#124; 7   &#124;        FILTER                 &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         HASH JOIN             &#124;                &#124;  104M &#124; 5326M &#124;  1154 &#124;  00:00:06 &#124;
&#124; 9   &#124;          INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 10  &#124;          TABLE ACCESS FULL    &#124; EDI830_LINES   &#124;  236K &#124; 7311K &#124;   941 &#124;  00:00:05 &#124;
&#124; 11  &#124;     SORT JOIN                 &#124;                &#124;  6261 &#124;  220K &#124;   110 &#124;  00:00:01 &#124;
&#124; 12  &#124;      VIEW                     &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 13  &#124;       SORT GROUP BY           &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 14  &#124;        HASH JOIN              &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 15  &#124;         TABLE ACCESS FULL     &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 16  &#124;         TABLE ACCESS FULL     &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
-------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
5 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
8 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
10 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
11 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
11 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
14 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
15 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
16 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_10.2.0.2:
[code]
------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                    &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT             &#124;                &#124;       &#124;       &#124;   157 &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY               &#124;                &#124;   204 &#124;   17K &#124;   157 &#124;  00:00:01 &#124;
&#124; 2   &#124;   FILTER                     &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    HASH JOIN OUTER           &#124;                &#124;   374 &#124;   31K &#124;   156 &#124;  00:00:01 &#124;
&#124; 4   &#124;     NESTED LOOPS             &#124;                &#124;   194 &#124;  9506 &#124;    47 &#124;  00:00:01 &#124;
&#124; 5   &#124;      VIEW                    &#124;                &#124;  1993 &#124;   35K &#124;    46 &#124;  00:00:01 &#124;
&#124; 6   &#124;       HASH GROUP BY          &#124;                &#124;  1993 &#124;   39K &#124;    46 &#124;  00:00:01 &#124;
&#124; 7   &#124;        FILTER                &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 9   &#124;      INDEX RANGE SCAN        &#124; EDI830_LINES_PK&#124;     1 &#124;    31 &#124;     1 &#124;  00:00:01 &#124;
&#124; 10  &#124;     VIEW                     &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 11  &#124;      HASH GROUP BY           &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 12  &#124;       HASH JOIN              &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 13  &#124;        TABLE ACCESS FULL     &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 14  &#124;        TABLE ACCESS FULL     &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_undo_10.2.0.2:
[code]
------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                    &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT             &#124;                &#124;       &#124;       &#124;   157 &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY               &#124;                &#124;   204 &#124;   17K &#124;   157 &#124;  00:00:01 &#124;
&#124; 2   &#124;   FILTER                     &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    HASH JOIN OUTER           &#124;                &#124;   375 &#124;   31K &#124;   156 &#124;  00:00:01 &#124;
&#124; 4   &#124;     NESTED LOOPS             &#124;                &#124;   194 &#124;  9506 &#124;    47 &#124;  00:00:01 &#124;
&#124; 5   &#124;      VIEW                    &#124;                &#124;  1993 &#124;   35K &#124;    46 &#124;  00:00:01 &#124;
&#124; 6   &#124;       HASH GROUP BY          &#124;                &#124;  1993 &#124;   39K &#124;    46 &#124;  00:00:01 &#124;
&#124; 7   &#124;        FILTER                &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 9   &#124;      INDEX RANGE SCAN        &#124; EDI830_LINES_PK&#124;     1 &#124;    31 &#124;     1 &#124;  00:00:01 &#124;
&#124; 10  &#124;     VIEW                     &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 11  &#124;      HASH GROUP BY           &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 12  &#124;       HASH JOIN              &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 13  &#124;        TABLE ACCESS FULL     &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 14  &#124;        TABLE ACCESS FULL     &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

select_10.1.0.4-2:
[code]
------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                    &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; SELECT STATEMENT             &#124;                &#124;       &#124;       &#124;  1101 &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY               &#124;                &#124;    11 &#124;   935 &#124;  1101 &#124;  00:00:06 &#124;
&#124; 2   &#124;   HASH JOIN                  &#124;                &#124;    11 &#124;   935 &#124;  1100 &#124;  00:00:06 &#124;
&#124; 3   &#124;    FILTER                    &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 4   &#124;     HASH JOIN OUTER          &#124;                &#124;  2186 &#124;  115K &#124;   155 &#124;  00:00:01 &#124;
&#124; 5   &#124;      VIEW                    &#124;                &#124;  1993 &#124;   35K &#124;    46 &#124;  00:00:01 &#124;
&#124; 6   &#124;       SORT GROUP BY          &#124;                &#124;  1993 &#124;   39K &#124;    46 &#124;  00:00:01 &#124;
&#124; 7   &#124;        FILTER                &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 9   &#124;      VIEW                    &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 10  &#124;       SORT GROUP BY          &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 11  &#124;        HASH JOIN             &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 12  &#124;         TABLE ACCESS FULL    &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 13  &#124;         TABLE ACCESS FULL    &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
&#124; 14  &#124;    TABLE ACCESS FULL         &#124; EDI830_LINES   &#124;  236K &#124; 7311K &#124;   941 &#124;  00:00:05 &#124;
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot;)
2 - filter(&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
3 - filter(COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200)
4 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
11 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
12 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
13 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
14 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
[/code]

insert_10.1.0.4-2:
[code]
-------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                     &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
-------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; INSERT STATEMENT              &#124;                &#124;       &#124;       &#124;  272K &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY                &#124;                &#124;   204 &#124;   13K &#124;  272K &#124;  00:22:07 &#124;
&#124; 2   &#124;   FILTER                      &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    MERGE JOIN OUTER           &#124;                &#124;   75K &#124; 5046K &#124;  272K &#124;  00:22:07 &#124;
&#124; 4   &#124;     VIEW                      &#124;                &#124;   69K &#124; 2129K &#124;  272K &#124;  00:22:06 &#124;
&#124; 5   &#124;      FILTER                   &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 6   &#124;       SORT GROUP BY           &#124;                &#124;   69K &#124; 3502K &#124;  272K &#124;  00:22:06 &#124;
&#124; 7   &#124;        FILTER                 &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 8   &#124;         HASH JOIN             &#124;                &#124;  104M &#124; 5326M &#124;  1154 &#124;  00:00:06 &#124;
&#124; 9   &#124;          INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 10  &#124;          TABLE ACCESS FULL    &#124; EDI830_LINES   &#124;  236K &#124; 7311K &#124;   941 &#124;  00:00:05 &#124;
&#124; 11  &#124;     SORT JOIN                 &#124;                &#124;  6261 &#124;  220K &#124;   110 &#124;  00:00:01 &#124;
&#124; 12  &#124;      VIEW                     &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 13  &#124;       SORT GROUP BY           &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 14  &#124;        HASH JOIN              &#124;                &#124;  8185 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 15  &#124;         TABLE ACCESS FULL     &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 16  &#124;         TABLE ACCESS FULL     &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
-------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
5 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
8 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
10 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
11 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
11 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
14 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
15 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
16 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_10.2.0.2-2:
[code]
--------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                      &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; INSERT STATEMENT               &#124;                &#124;       &#124;       &#124;  274K &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY                 &#124;                &#124;   204 &#124;   13K &#124;  274K &#124;  00:22:15 &#124;
&#124; 2   &#124;   FILTER                       &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    MERGE JOIN OUTER            &#124;                &#124;   75K &#124; 5046K &#124;  274K &#124;  00:22:15 &#124;
&#124; 4   &#124;     SORT JOIN                  &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 5   &#124;      VIEW                      &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 6   &#124;       FILTER                   &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 7   &#124;        SORT GROUP BY           &#124;                &#124;   69K &#124; 3502K &#124;  274K &#124;  00:22:14 &#124;
&#124; 8   &#124;         FILTER                 &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 9   &#124;          HASH JOIN             &#124;                &#124;  104M &#124; 5326M &#124;  2876 &#124;  00:00:14 &#124;
&#124; 10  &#124;           INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 11  &#124;           TABLE ACCESS FULL    &#124; EDI830_LINES   &#124;  236K &#124; 7310K &#124;   941 &#124;  00:00:05 &#124;
&#124; 12  &#124;     SORT JOIN                  &#124;                &#124;  6261 &#124;  220K &#124;   110 &#124;  00:00:01 &#124;
&#124; 13  &#124;      VIEW                      &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 14  &#124;       SORT GROUP BY            &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 15  &#124;        HASH JOIN               &#124;                &#124;  8184 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 16  &#124;         TABLE ACCESS FULL      &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 17  &#124;         TABLE ACCESS FULL      &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_undo_10.2.0.2-2:
[code]
--------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                      &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; INSERT STATEMENT               &#124;                &#124;       &#124;       &#124;  274K &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY                 &#124;                &#124;   204 &#124;   13K &#124;  274K &#124;  00:22:15 &#124;
&#124; 2   &#124;   FILTER                       &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    MERGE JOIN OUTER            &#124;                &#124;   75K &#124; 5046K &#124;  274K &#124;  00:22:15 &#124;
&#124; 4   &#124;     SORT JOIN                  &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 5   &#124;      VIEW                      &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 6   &#124;       FILTER                   &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 7   &#124;        SORT GROUP BY           &#124;                &#124;   69K &#124; 3502K &#124;  274K &#124;  00:22:14 &#124;
&#124; 8   &#124;         FILTER                 &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 9   &#124;          HASH JOIN             &#124;                &#124;  104M &#124; 5326M &#124;  2876 &#124;  00:00:14 &#124;
&#124; 10  &#124;           INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 11  &#124;           TABLE ACCESS FULL    &#124; EDI830_LINES   &#124;  236K &#124; 7311K &#124;   941 &#124;  00:00:05 &#124;
&#124; 12  &#124;     SORT JOIN                  &#124;                &#124;  6261 &#124;  220K &#124;   110 &#124;  00:00:01 &#124;
&#124; 13  &#124;      VIEW                      &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 14  &#124;       SORT GROUP BY            &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 15  &#124;        HASH JOIN               &#124;                &#124;  8184 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 16  &#124;         TABLE ACCESS FULL      &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 17  &#124;         TABLE ACCESS FULL      &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

insert_undo_10.2.0.2-2:
[code]
--------------------------------------------------------+-----------------------------------+
&#124; Id  &#124; Operation                      &#124; Name           &#124; Rows  &#124; Bytes &#124; Cost  &#124; Time      &#124;
--------------------------------------------------------+-----------------------------------+
&#124; 0   &#124; INSERT STATEMENT               &#124;                &#124;       &#124;       &#124;  274K &#124;           &#124;
&#124; 1   &#124;  SORT GROUP BY                 &#124;                &#124;   204 &#124;   13K &#124;  274K &#124;  00:22:15 &#124;
&#124; 2   &#124;   FILTER                       &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 3   &#124;    MERGE JOIN OUTER            &#124;                &#124;   75K &#124; 5046K &#124;  274K &#124;  00:22:15 &#124;
&#124; 4   &#124;     SORT JOIN                  &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 5   &#124;      VIEW                      &#124;                &#124;   69K &#124; 2129K &#124;  274K &#124;  00:22:14 &#124;
&#124; 6   &#124;       FILTER                   &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 7   &#124;        SORT GROUP BY           &#124;                &#124;   69K &#124; 3502K &#124;  274K &#124;  00:22:14 &#124;
&#124; 8   &#124;         FILTER                 &#124;                &#124;       &#124;       &#124;       &#124;           &#124;
&#124; 9   &#124;          HASH JOIN             &#124;                &#124;  104M &#124; 5326M &#124;  2876 &#124;  00:00:14 &#124;
&#124; 10  &#124;           INDEX FAST FULL SCAN &#124; EDI830_PK      &#124;  105K &#124; 2092K &#124;    33 &#124;  00:00:01 &#124;
&#124; 11  &#124;           TABLE ACCESS FULL    &#124; EDI830_LINES   &#124;  236K &#124; 7310K &#124;   941 &#124;  00:00:05 &#124;
&#124; 12  &#124;     SORT JOIN                  &#124;                &#124;  6261 &#124;  220K &#124;   110 &#124;  00:00:01 &#124;
&#124; 13  &#124;      VIEW                      &#124;                &#124;  6261 &#124;  220K &#124;   108 &#124;  00:00:01 &#124;
&#124; 14  &#124;       SORT GROUP BY            &#124;                &#124;  6261 &#124;  251K &#124;   108 &#124;  00:00:01 &#124;
&#124; 15  &#124;        HASH JOIN               &#124;                &#124;  8184 &#124;  328K &#124;   106 &#124;  00:00:01 &#124;
&#124; 16  &#124;         TABLE ACCESS FULL      &#124; CUSTOMER_ORDER &#124;  7562 &#124;  126K &#124;    14 &#124;  00:00:01 &#124;
&#124; 17  &#124;         TABLE ACCESS FULL      &#124; CUST_ORDER_LINE&#124;  8550 &#124;  200K &#124;    92 &#124;  00:00:01 &#124;
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
[/code]

According to the timing information, the SELECT statements with OPTIMIZER_FEATURES_ENABLE set to 10.1.0.4 completed in about 0.34 seconds, while the INSERT INTO completed in about 3 minutes and 16 seconds (I am not sure why I was seeing times of about 20 minutes before).  With OPTIMIZER_FEATURES_ENABLE set to 10.2.0.2 with the default values for OPTIMIZER_INDEX_COST_ADJ and OPTIMIZER_INDEX_CACHING the SELECT statements completed in about 1.3 seconds and the INSERT INTO statements completed in about 2 minutes and 40 seconds.]]></description>
		<content:encoded><![CDATA[<p>I have not had any time to investigate this particular SQL statement &#8211; the NO_QUERY_TRANSFORMATION hint generated the execution plan that I expected to see, so I moved on to other items.</p>
<p>For an experiment, I created the following script:</p>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE T1_DEST (
  PART_ID VARCHAR2(30),
  REQUIRED_DATE DATE,
  QTY NUMBER,
  PLAN_LEVEL NUMBER);

SET TIMING ON
SET ARRAYSIZE 1000

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.1.0.4';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'SELECT_10.1.0.4';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.1.0.4';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.2.0.2';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.2.0.2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.2.0.2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.2.0.2';
ALTER SESSION SET &quot;_OPTIMIZER_UNDO_COST_CHANGE&quot;='10.2.0.2';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_UNDO_10.2.0.2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_UNDO_10.2.0.2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+  */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';
</pre>
<p>(disconnect and reconnect)</p>
<pre class="brush: plain; title: ; notranslate">
SET TIMING ON
SET ARRAYSIZE 1000

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_INDEX_COST_ADJ=100;
ALTER SESSION SET OPTIMIZER_INDEX_CACHING=0;
ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.1.0.4';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'SELECT_10.1.0.4-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.1.0.4-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.2.0.2';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.2.0.2-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_10.2.0.2-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

TRUNCATE TABLE T1_DEST;

ALTER SESSION SET OPTIMIZER_FEATURES_ENABLE='10.2.0.2';
ALTER SESSION SET &quot;_OPTIMIZER_UNDO_COST_CHANGE&quot;='10.2.0.2';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_UNDO_10.2.0.2-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';

ALTER SESSION SET TRACEFILE_IDENTIFIER = 'INSERT_UNDO_10.2.0.2-2';
ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';

INSERT INTO T1_DEST
SELECT /*+ LEADING(E) */
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM') PART_ID,
  E.FCDUEDATE REQUIRED_DATE,
  SUM(E.FCSTQTY) QTY,
  1 PLAN_LEVEL
FROM
  (SELECT /*+ LEADING(E) */
    E.CUSTPO,
    EL.FCSTQTY,
    EL.FCDUEDATE
  FROM
    (SELECT /*+ 2 */
      E.CUSTPO,
      MAX(RELID) RELID
    FROM
      TESTUSER.EDI830 E
    GROUP BY
      E.CUSTPO) E,
    TESTUSER.EDI830_LINES EL
  WHERE  
    E.CUSTPO=EL.CUSTPO
    AND E.RELID=EL.RELID
    AND EL.FCDUEDATE BETWEEN SYSDATE-365 AND SYSDATE+1200
    AND EL.FCSTQTY&gt;0) E,
  (SELECT /*+  */
    CO.CUSTOMER_PO_REF,
    MAX(COL.DESIRED_SHIP_DATE) DESIRED_SHIP_DATE,
    MAX(COL.PART_ID) PART_ID
  FROM
    CUSTOMER_ORDER CO,
    CUST_ORDER_LINE COL
  WHERE
    CO.ID=COL.CUST_ORDER_ID
    AND CUSTOMER_PO_REF IS NOT NULL
    AND COL.DESIRED_SHIP_DATE&gt;=SYSDATE-365
  GROUP BY
    CO.CUSTOMER_PO_REF) CO
WHERE
  E.CUSTPO=CO.CUSTOMER_PO_REF(+)
  AND E.FCDUEDATE&gt;COALESCE(CO.DESIRED_SHIP_DATE,SYSDATE-365)
GROUP BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE
ORDER BY
  COALESCE(CO.PART_ID,'NOT-IN-SYSTEM'),
  E.FCDUEDATE;

ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT OFF';
</pre>
<p>The execution plans that were produced from the 10053 trace follow (note that if a hard parse was not performed, nothing will be written to a trace file, so that probably explains why some of the trace file results are missing):<br />
select_10.1.0.4:</p>
<pre class="brush: plain; title: ; notranslate">
------------------------------------------------------+-----------------------------------+
| Id  | Operation                    | Name           | Rows  | Bytes | Cost  | Time      |
------------------------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT             |                |       |       |   157 |           |
| 1   |  SORT GROUP BY               |                |   204 |   17K |   157 |  00:00:01 |
| 2   |   FILTER                     |                |       |       |       |           |
| 3   |    HASH JOIN OUTER           |                |   374 |   31K |   156 |  00:00:01 |
| 4   |     NESTED LOOPS             |                |   194 |  9506 |    47 |  00:00:01 |
| 5   |      VIEW                    |                |  1993 |   35K |    46 |  00:00:01 |
| 6   |       SORT GROUP BY          |                |  1993 |   39K |    46 |  00:00:01 |
| 7   |        FILTER                |                |       |       |       |           |
| 8   |         INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 9   |      INDEX RANGE SCAN        | EDI830_LINES_PK|     1 |    31 |     1 |  00:00:01 |
| 10  |     VIEW                     |                |  6261 |  220K |   108 |  00:00:01 |
| 11  |      SORT GROUP BY           |                |  6261 |  251K |   108 |  00:00:01 |
| 12  |       HASH JOIN              |                |  8185 |  328K |   106 |  00:00:01 |
| 13  |        TABLE ACCESS FULL     | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 14  |        TABLE ACCESS FULL     | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_10.1.0.4:</p>
<pre class="brush: plain; title: ; notranslate">
-------------------------------------------------------+-----------------------------------+
| Id  | Operation                     | Name           | Rows  | Bytes | Cost  | Time      |
-------------------------------------------------------+-----------------------------------+
| 0   | INSERT STATEMENT              |                |       |       |  272K |           |
| 1   |  SORT GROUP BY                |                |   204 |   13K |  272K |  00:22:07 |
| 2   |   FILTER                      |                |       |       |       |           |
| 3   |    MERGE JOIN OUTER           |                |   75K | 5046K |  272K |  00:22:07 |
| 4   |     VIEW                      |                |   69K | 2129K |  272K |  00:22:06 |
| 5   |      FILTER                   |                |       |       |       |           |
| 6   |       SORT GROUP BY           |                |   69K | 3502K |  272K |  00:22:06 |
| 7   |        FILTER                 |                |       |       |       |           |
| 8   |         HASH JOIN             |                |  104M | 5326M |  1154 |  00:00:06 |
| 9   |          INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 10  |          TABLE ACCESS FULL    | EDI830_LINES   |  236K | 7311K |   941 |  00:00:05 |
| 11  |     SORT JOIN                 |                |  6261 |  220K |   110 |  00:00:01 |
| 12  |      VIEW                     |                |  6261 |  220K |   108 |  00:00:01 |
| 13  |       SORT GROUP BY           |                |  6261 |  251K |   108 |  00:00:01 |
| 14  |        HASH JOIN              |                |  8185 |  328K |   106 |  00:00:01 |
| 15  |         TABLE ACCESS FULL     | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 16  |         TABLE ACCESS FULL     | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
-------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
5 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
8 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
10 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
11 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
11 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
14 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
15 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
16 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_10.2.0.2:</p>
<pre class="brush: plain; title: ; notranslate">
------------------------------------------------------+-----------------------------------+
| Id  | Operation                    | Name           | Rows  | Bytes | Cost  | Time      |
------------------------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT             |                |       |       |   157 |           |
| 1   |  SORT GROUP BY               |                |   204 |   17K |   157 |  00:00:01 |
| 2   |   FILTER                     |                |       |       |       |           |
| 3   |    HASH JOIN OUTER           |                |   374 |   31K |   156 |  00:00:01 |
| 4   |     NESTED LOOPS             |                |   194 |  9506 |    47 |  00:00:01 |
| 5   |      VIEW                    |                |  1993 |   35K |    46 |  00:00:01 |
| 6   |       HASH GROUP BY          |                |  1993 |   39K |    46 |  00:00:01 |
| 7   |        FILTER                |                |       |       |       |           |
| 8   |         INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 9   |      INDEX RANGE SCAN        | EDI830_LINES_PK|     1 |    31 |     1 |  00:00:01 |
| 10  |     VIEW                     |                |  6261 |  220K |   108 |  00:00:01 |
| 11  |      HASH GROUP BY           |                |  6261 |  251K |   108 |  00:00:01 |
| 12  |       HASH JOIN              |                |  8185 |  328K |   106 |  00:00:01 |
| 13  |        TABLE ACCESS FULL     | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 14  |        TABLE ACCESS FULL     | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_undo_10.2.0.2:</p>
<pre class="brush: plain; title: ; notranslate">
------------------------------------------------------+-----------------------------------+
| Id  | Operation                    | Name           | Rows  | Bytes | Cost  | Time      |
------------------------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT             |                |       |       |   157 |           |
| 1   |  SORT GROUP BY               |                |   204 |   17K |   157 |  00:00:01 |
| 2   |   FILTER                     |                |       |       |       |           |
| 3   |    HASH JOIN OUTER           |                |   375 |   31K |   156 |  00:00:01 |
| 4   |     NESTED LOOPS             |                |   194 |  9506 |    47 |  00:00:01 |
| 5   |      VIEW                    |                |  1993 |   35K |    46 |  00:00:01 |
| 6   |       HASH GROUP BY          |                |  1993 |   39K |    46 |  00:00:01 |
| 7   |        FILTER                |                |       |       |       |           |
| 8   |         INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 9   |      INDEX RANGE SCAN        | EDI830_LINES_PK|     1 |    31 |     1 |  00:00:01 |
| 10  |     VIEW                     |                |  6261 |  220K |   108 |  00:00:01 |
| 11  |      HASH GROUP BY           |                |  6261 |  251K |   108 |  00:00:01 |
| 12  |       HASH JOIN              |                |  8185 |  328K |   106 |  00:00:01 |
| 13  |        TABLE ACCESS FULL     | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 14  |        TABLE ACCESS FULL     | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365) AND COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200))
3 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot; AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200)
9 - filter(&quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0)
12 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
13 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
14 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>select_10.1.0.4-2:</p>
<pre class="brush: plain; title: ; notranslate">
------------------------------------------------------+-----------------------------------+
| Id  | Operation                    | Name           | Rows  | Bytes | Cost  | Time      |
------------------------------------------------------+-----------------------------------+
| 0   | SELECT STATEMENT             |                |       |       |  1101 |           |
| 1   |  SORT GROUP BY               |                |    11 |   935 |  1101 |  00:00:06 |
| 2   |   HASH JOIN                  |                |    11 |   935 |  1100 |  00:00:06 |
| 3   |    FILTER                    |                |       |       |       |           |
| 4   |     HASH JOIN OUTER          |                |  2186 |  115K |   155 |  00:00:01 |
| 5   |      VIEW                    |                |  1993 |   35K |    46 |  00:00:01 |
| 6   |       SORT GROUP BY          |                |  1993 |   39K |    46 |  00:00:01 |
| 7   |        FILTER                |                |       |       |       |           |
| 8   |         INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 9   |      VIEW                    |                |  6261 |  220K |   108 |  00:00:01 |
| 10  |       SORT GROUP BY          |                |  6261 |  251K |   108 |  00:00:01 |
| 11  |        HASH JOIN             |                |  8185 |  328K |   106 |  00:00:01 |
| 12  |         TABLE ACCESS FULL    | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 13  |         TABLE ACCESS FULL    | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
| 14  |    TABLE ACCESS FULL         | EDI830_LINES   |  236K | 7311K |   941 |  00:00:05 |
------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot; AND &quot;E&quot;.&quot;RELID&quot;=&quot;EL&quot;.&quot;RELID&quot;)
2 - filter(&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
3 - filter(COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365)&lt;SYSDATE@!+1200)
4 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
11 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
12 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
13 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
14 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
</pre>
<p>insert_10.1.0.4-2:</p>
<pre class="brush: plain; title: ; notranslate">
-------------------------------------------------------+-----------------------------------+
| Id  | Operation                     | Name           | Rows  | Bytes | Cost  | Time      |
-------------------------------------------------------+-----------------------------------+
| 0   | INSERT STATEMENT              |                |       |       |  272K |           |
| 1   |  SORT GROUP BY                |                |   204 |   13K |  272K |  00:22:07 |
| 2   |   FILTER                      |                |       |       |       |           |
| 3   |    MERGE JOIN OUTER           |                |   75K | 5046K |  272K |  00:22:07 |
| 4   |     VIEW                      |                |   69K | 2129K |  272K |  00:22:06 |
| 5   |      FILTER                   |                |       |       |       |           |
| 6   |       SORT GROUP BY           |                |   69K | 3502K |  272K |  00:22:06 |
| 7   |        FILTER                 |                |       |       |       |           |
| 8   |         HASH JOIN             |                |  104M | 5326M |  1154 |  00:00:06 |
| 9   |          INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 10  |          TABLE ACCESS FULL    | EDI830_LINES   |  236K | 7311K |   941 |  00:00:05 |
| 11  |     SORT JOIN                 |                |  6261 |  220K |   110 |  00:00:01 |
| 12  |      VIEW                     |                |  6261 |  220K |   108 |  00:00:01 |
| 13  |       SORT GROUP BY           |                |  6261 |  251K |   108 |  00:00:01 |
| 14  |        HASH JOIN              |                |  8185 |  328K |   106 |  00:00:01 |
| 15  |         TABLE ACCESS FULL     | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 16  |         TABLE ACCESS FULL     | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
-------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
5 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
7 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
8 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
10 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
11 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
11 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
14 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
15 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
16 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_10.2.0.2-2:</p>
<pre class="brush: plain; title: ; notranslate">
--------------------------------------------------------+-----------------------------------+
| Id  | Operation                      | Name           | Rows  | Bytes | Cost  | Time      |
--------------------------------------------------------+-----------------------------------+
| 0   | INSERT STATEMENT               |                |       |       |  274K |           |
| 1   |  SORT GROUP BY                 |                |   204 |   13K |  274K |  00:22:15 |
| 2   |   FILTER                       |                |       |       |       |           |
| 3   |    MERGE JOIN OUTER            |                |   75K | 5046K |  274K |  00:22:15 |
| 4   |     SORT JOIN                  |                |   69K | 2129K |  274K |  00:22:14 |
| 5   |      VIEW                      |                |   69K | 2129K |  274K |  00:22:14 |
| 6   |       FILTER                   |                |       |       |       |           |
| 7   |        SORT GROUP BY           |                |   69K | 3502K |  274K |  00:22:14 |
| 8   |         FILTER                 |                |       |       |       |           |
| 9   |          HASH JOIN             |                |  104M | 5326M |  2876 |  00:00:14 |
| 10  |           INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 11  |           TABLE ACCESS FULL    | EDI830_LINES   |  236K | 7310K |   941 |  00:00:05 |
| 12  |     SORT JOIN                  |                |  6261 |  220K |   110 |  00:00:01 |
| 13  |      VIEW                      |                |  6261 |  220K |   108 |  00:00:01 |
| 14  |       SORT GROUP BY            |                |  6261 |  251K |   108 |  00:00:01 |
| 15  |        HASH JOIN               |                |  8184 |  328K |   106 |  00:00:01 |
| 16  |         TABLE ACCESS FULL      | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 17  |         TABLE ACCESS FULL      | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_undo_10.2.0.2-2:</p>
<pre class="brush: plain; title: ; notranslate">
--------------------------------------------------------+-----------------------------------+
| Id  | Operation                      | Name           | Rows  | Bytes | Cost  | Time      |
--------------------------------------------------------+-----------------------------------+
| 0   | INSERT STATEMENT               |                |       |       |  274K |           |
| 1   |  SORT GROUP BY                 |                |   204 |   13K |  274K |  00:22:15 |
| 2   |   FILTER                       |                |       |       |       |           |
| 3   |    MERGE JOIN OUTER            |                |   75K | 5046K |  274K |  00:22:15 |
| 4   |     SORT JOIN                  |                |   69K | 2129K |  274K |  00:22:14 |
| 5   |      VIEW                      |                |   69K | 2129K |  274K |  00:22:14 |
| 6   |       FILTER                   |                |       |       |       |           |
| 7   |        SORT GROUP BY           |                |   69K | 3502K |  274K |  00:22:14 |
| 8   |         FILTER                 |                |       |       |       |           |
| 9   |          HASH JOIN             |                |  104M | 5326M |  2876 |  00:00:14 |
| 10  |           INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 11  |           TABLE ACCESS FULL    | EDI830_LINES   |  236K | 7311K |   941 |  00:00:05 |
| 12  |     SORT JOIN                  |                |  6261 |  220K |   110 |  00:00:01 |
| 13  |      VIEW                      |                |  6261 |  220K |   108 |  00:00:01 |
| 14  |       SORT GROUP BY            |                |  6261 |  251K |   108 |  00:00:01 |
| 15  |        HASH JOIN               |                |  8184 |  328K |   106 |  00:00:01 |
| 16  |         TABLE ACCESS FULL      | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 17  |         TABLE ACCESS FULL      | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>insert_undo_10.2.0.2-2:</p>
<pre class="brush: plain; title: ; notranslate">
--------------------------------------------------------+-----------------------------------+
| Id  | Operation                      | Name           | Rows  | Bytes | Cost  | Time      |
--------------------------------------------------------+-----------------------------------+
| 0   | INSERT STATEMENT               |                |       |       |  274K |           |
| 1   |  SORT GROUP BY                 |                |   204 |   13K |  274K |  00:22:15 |
| 2   |   FILTER                       |                |       |       |       |           |
| 3   |    MERGE JOIN OUTER            |                |   75K | 5046K |  274K |  00:22:15 |
| 4   |     SORT JOIN                  |                |   69K | 2129K |  274K |  00:22:14 |
| 5   |      VIEW                      |                |   69K | 2129K |  274K |  00:22:14 |
| 6   |       FILTER                   |                |       |       |       |           |
| 7   |        SORT GROUP BY           |                |   69K | 3502K |  274K |  00:22:14 |
| 8   |         FILTER                 |                |       |       |       |           |
| 9   |          HASH JOIN             |                |  104M | 5326M |  2876 |  00:00:14 |
| 10  |           INDEX FAST FULL SCAN | EDI830_PK      |  105K | 2092K |    33 |  00:00:01 |
| 11  |           TABLE ACCESS FULL    | EDI830_LINES   |  236K | 7310K |   941 |  00:00:05 |
| 12  |     SORT JOIN                  |                |  6261 |  220K |   110 |  00:00:01 |
| 13  |      VIEW                      |                |  6261 |  220K |   108 |  00:00:01 |
| 14  |       SORT GROUP BY            |                |  6261 |  251K |   108 |  00:00:01 |
| 15  |        HASH JOIN               |                |  8184 |  328K |   106 |  00:00:01 |
| 16  |         TABLE ACCESS FULL      | CUSTOMER_ORDER |  7562 |  126K |    14 |  00:00:01 |
| 17  |         TABLE ACCESS FULL      | CUST_ORDER_LINE|  8550 |  200K |    92 |  00:00:01 |
--------------------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
2 - filter(&quot;E&quot;.&quot;FCDUEDATE&quot;&gt;COALESCE(&quot;CO&quot;.&quot;DESIRED_SHIP_DATE&quot;,SYSDATE@!-365))
6 - filter(&quot;EL&quot;.&quot;RELID&quot;=MAX(&quot;RELID&quot;))
8 - filter(SYSDATE@!-365&lt;=SYSDATE@!+1200)
9 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;EL&quot;.&quot;CUSTPO&quot;)
11 - filter((&quot;EL&quot;.&quot;FCDUEDATE&quot;&gt;=SYSDATE@!-365 AND &quot;EL&quot;.&quot;FCSTQTY&quot;&gt;0 AND &quot;EL&quot;.&quot;FCDUEDATE&quot;&lt;=SYSDATE@!+1200))
12 - access(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
12 - filter(&quot;E&quot;.&quot;CUSTPO&quot;=&quot;CO&quot;.&quot;CUSTOMER_PO_REF&quot;)
15 - access(&quot;CO&quot;.&quot;ID&quot;=&quot;COL&quot;.&quot;CUST_ORDER_ID&quot;)
16 - filter(&quot;CUSTOMER_PO_REF&quot; IS NOT NULL)
17 - filter(&quot;COL&quot;.&quot;DESIRED_SHIP_DATE&quot;&gt;=SYSDATE@!-365)
</pre>
<p>According to the timing information, the SELECT statements with OPTIMIZER_FEATURES_ENABLE set to 10.1.0.4 completed in about 0.34 seconds, while the INSERT INTO completed in about 3 minutes and 16 seconds (I am not sure why I was seeing times of about 20 minutes before).  With OPTIMIZER_FEATURES_ENABLE set to 10.2.0.2 with the default values for OPTIMIZER_INDEX_COST_ADJ and OPTIMIZER_INDEX_CACHING the SELECT statements completed in about 1.3 seconds and the INSERT INTO statements completed in about 2 minutes and 40 seconds.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2462</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 06:01:39 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2462</guid>
		<description><![CDATA[Charles,

Thanks for the explaination. Can&#039;t wait to see your test cases to simulate this.
Would you mind validating my claim below?
&lt;i&gt;While investigating this performance problem, if using hints (like NO_QUERY_TRANSFORMATION or NO_MERGE) result in original plan (for SELECT) being used and the estimated cost of the revised query is less than the estimated cost of the plan for the slow query, it is safe to conclude that it is an optimizer bug. This is because optimizer has clearly failed to select the cheapest plan to execute the query&lt;/i&gt;
While the estimated cost of the &quot;fast&quot; plan is visible above (157), the estimated cost of the &quot;slow&quot; plan is not visible. Would you mind sharing the estimated cost details for the &quot;slow&quot; plan above? Considering that the &quot;slow&quot; plan expects large TEMP usage as opposed to no TEMP usage expected by &quot;fast&quot; plan, I would be surprised if CBO has indeed considered the &quot;slow&quot; plan to be the cheapest plan.]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>Thanks for the explaination. Can&#8217;t wait to see your test cases to simulate this.<br />
Would you mind validating my claim below?<br />
<i>While investigating this performance problem, if using hints (like NO_QUERY_TRANSFORMATION or NO_MERGE) result in original plan (for SELECT) being used and the estimated cost of the revised query is less than the estimated cost of the plan for the slow query, it is safe to conclude that it is an optimizer bug. This is because optimizer has clearly failed to select the cheapest plan to execute the query</i><br />
While the estimated cost of the &#8220;fast&#8221; plan is visible above (157), the estimated cost of the &#8220;slow&#8221; plan is not visible. Would you mind sharing the estimated cost details for the &#8220;slow&#8221; plan above? Considering that the &#8220;slow&#8221; plan expects large TEMP usage as opposed to no TEMP usage expected by &#8220;fast&#8221; plan, I would be surprised if CBO has indeed considered the &#8220;slow&#8221; plan to be the cheapest plan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2459</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 12:42:04 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2459</guid>
		<description><![CDATA[Mohamed,

Great idea to use the APPEND hint, and extra credit (bonus points) for mentioning one of the potential issues with implementing the APPEND hint (inserting above the high watermark, triggers, integrity constraints, etc.).  In this particular case only about 900 rows were being inserted into the table (I intentionally withheld that piece of information so that people responding to this blog article, and specifically to those people who later read the blog article, would see a broader range of suggestions, and the potential warnings that should accompany the suggestions).

The ORDER BY clause was left in the INSERT statement for a couple of reasons:
* Initially I forgot to remove it when converting the SELECT statement into an INSERT INTO ... SELECT type statement.
* I left the ORDER BY clause in the INSERT INTO ... SELECT statement to take advantage of the nearly pre-sorted ordering of the rows in the table&#039;s blocks.  For the initial pass through the table when it is actually selected from, this will be slightly helpful.  However, the INSERT INTO ... SELECT is only the starting point of what actually ends up in that table.  Immediately after the INSERT INTO ... SELECT is performed, a recursive routine is performed that explodes up to 7 levels of bills of material for those parts, and the rows are inserted back into the same table.  The CLUSTERING_FACTOR for the index that will eventually be created on the PART_ID column was a consideration.
* If I had removed the ORDER BY clause, it *might* be expected that the execution plan for the standard SELECT statement would differ from the execution plan for the INSERT INTO ... SELECT SQL statement - so there is a risk that I might cause the performance to change.

I am once again impressed with the quality of the comments that are posted to this blog.]]></description>
		<content:encoded><![CDATA[<p>Mohamed,</p>
<p>Great idea to use the APPEND hint, and extra credit (bonus points) for mentioning one of the potential issues with implementing the APPEND hint (inserting above the high watermark, triggers, integrity constraints, etc.).  In this particular case only about 900 rows were being inserted into the table (I intentionally withheld that piece of information so that people responding to this blog article, and specifically to those people who later read the blog article, would see a broader range of suggestions, and the potential warnings that should accompany the suggestions).</p>
<p>The ORDER BY clause was left in the INSERT statement for a couple of reasons:<br />
* Initially I forgot to remove it when converting the SELECT statement into an INSERT INTO &#8230; SELECT type statement.<br />
* I left the ORDER BY clause in the INSERT INTO &#8230; SELECT statement to take advantage of the nearly pre-sorted ordering of the rows in the table&#8217;s blocks.  For the initial pass through the table when it is actually selected from, this will be slightly helpful.  However, the INSERT INTO &#8230; SELECT is only the starting point of what actually ends up in that table.  Immediately after the INSERT INTO &#8230; SELECT is performed, a recursive routine is performed that explodes up to 7 levels of bills of material for those parts, and the rows are inserted back into the same table.  The CLUSTERING_FACTOR for the index that will eventually be created on the PART_ID column was a consideration.<br />
* If I had removed the ORDER BY clause, it *might* be expected that the execution plan for the standard SELECT statement would differ from the execution plan for the INSERT INTO &#8230; SELECT SQL statement &#8211; so there is a risk that I might cause the performance to change.</p>
<p>I am once again impressed with the quality of the comments that are posted to this blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/#comment-2458</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 12:16:50 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4047#comment-2458</guid>
		<description><![CDATA[Good questions.  WORKAREA_SIZE_POLICY is set to AUTO, and PGA_AGGREGATE_TARGET is set to 2000M.  Once I build a test case that simulates the problem, I can try different parameter settings to see if I am able to identify the cause of the execution plan change.]]></description>
		<content:encoded><![CDATA[<p>Good questions.  WORKAREA_SIZE_POLICY is set to AUTO, and PGA_AGGREGATE_TARGET is set to 2000M.  Once I build a test case that simulates the problem, I can try different parameter settings to see if I am able to identify the cause of the execution plan change.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
