<?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: A Simple Request or a Performance Nightmare &#8211; Painted into a Corner by the ERP System</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/04/13/a-simple-request-or-a-performance-nightmare-painted-into-a-corner-by-the-erp-system/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/04/13/a-simple-request-or-a-performance-nightmare-painted-into-a-corner-by-the-erp-system/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/04/13/a-simple-request-or-a-performance-nightmare-painted-into-a-corner-by-the-erp-system/#comment-647</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Wed, 14 Apr 2010 15:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=1895#comment-647</guid>
		<description><![CDATA[I believe that the reason for the predicate information not being pushed in is a result of the CONNECT BY syntax.  It appears that when a CONNECT BY clause is used, the START WITH clause is considered a WHERE clause, according to a portion of a 10053 trace:
&lt;pre&gt;
******* UNPARSED QUERY IS *******
SELECT /*+ */ &quot;P&quot;.&quot;PURC_ORDER_ID&quot; &quot;PURC_ORDER_ID&quot;,&quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; &quot;PURC_ORDER_LINE_NO&quot;,
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR(&quot;P&quot;.&quot;DEL_SCHED_LINE_NO&quot;),&#039;, &#039;),3),&#039;, &#039;,&#039;&#039;)) &quot;DEL_SCHED_LINE_NO&quot;,
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR(&quot;P&quot;.&quot;RECEIVED_QTY&quot;),&#039;, &#039;),3),&#039;, &#039;,&#039;&#039;)) &quot;RECEIVED_QTY&quot;
FROM  (SELECT /*+ */ &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot; &quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; &quot;PURC_ORDER_LINE_NO&quot;,
&quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot; &quot;DEL_SCHED_LINE_NO&quot;,&quot;PLD&quot;.&quot;RECEIVED_QTY&quot; &quot;RECEIVED_QTY&quot;,
ROW_NUMBER() OVER ( PARTITION BY &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; ORDER BY &quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot;) &quot;RN&quot;
FROM &quot;TESTUSER&quot;.&quot;PURC_LINE_DEL&quot; &quot;PLD&quot;) &quot;P&quot; WHERE &quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; 
AND (&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1) GROUP BY &quot;P&quot;.&quot;PURC_ORDER_ID&quot;,&quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;
kkoqbc-end
          : call(in-use=159712, alloc=180024), compile(in-use=104184, alloc=108616)
Registered qb: SEL$FFA85775 0x861980f8 (COPY SEL$FFA85775)
  signature(): NULL
Registered qb: SEL$4 0x86197820 (COPY SEL$4)
  signature(): NULL
FPD: Considering simple filter push in SEL$373CA273 (#0)
FPD:   Current where clause predicates in SEL$373CA273 (#0) :
         &quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot;
FPD: Considering simple filter push in SEL$5C7C6085 (#0)
FPD:   Current where clause predicates in SEL$5C7C6085 (#0) :
         &quot;P&quot;.&quot;RN&quot;=1
kkogcp: try to generate transitive predicate from check constraints for SEL$5C7C6085 (#0)
predicates with check contraints: &quot;P&quot;.&quot;RN&quot;=1
after transitive predicate generation: &quot;P&quot;.&quot;RN&quot;=1
finally: &quot;P&quot;.&quot;RN&quot;=1
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$9CAB97DB (#0)
FPD:   Current where clause predicates in SEL$9CAB97DB (#0) :
         FPD: Considering simple filter push in SEL$8E56D5CE (#0)
FPD:   Current where clause predicates in SEL$8E56D5CE (#0) :
         kkogcp: try to generate transitive predicate from check constraints for SEL$8E56D5CE (#0)
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$B36EDCEF (#0)
FPD:   Current where clause predicates in SEL$B36EDCEF (#0) :
         apadrv-start: call(in-use=162976, alloc=180024), compile(in-use=137240, alloc=140952)
kkoqbc-start
            : call(in-use=162976, alloc=180024), compile(in-use=141872, alloc=144968)
&lt;/pre&gt;

I probably should have originally written the query like this:
&lt;pre&gt;
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID=&#039;144038&#039;
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
-----------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name          &#124; Rows  &#124; Bytes &#124;TempSpc&#124; Cost (%CPU)&#124; Time     &#124;
-----------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;   1 &#124;  SORT GROUP BY              &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;*  2 &#124;   FILTER                    &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  3 &#124;    CONNECT BY WITH FILTERING&#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  4 &#124;     FILTER                  &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   5 &#124;      COUNT                  &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   6 &#124;       VIEW                  &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;   7 &#124;        WINDOW SORT          &#124;               &#124; 49018 &#124;   909K&#124;  3096K&#124;   273   (4)&#124; 00:00:02 &#124;
&#124;   8 &#124;         TABLE ACCESS FULL   &#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
&#124;*  9 &#124;     HASH JOIN               &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  10 &#124;      CONNECT BY PUMP        &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  11 &#124;      COUNT                  &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  12 &#124;       VIEW                  &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  13 &#124;        WINDOW SORT          &#124;               &#124; 49018 &#124;   909K&#124;  3096K&#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  14 &#124;         TABLE ACCESS FULL   &#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
&#124;  15 &#124;     COUNT                   &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  16 &#124;      VIEW                   &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  17 &#124;       WINDOW SORT           &#124;               &#124; 49018 &#124;   909K&#124;  3096K&#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  18 &#124;        TABLE ACCESS FULL    &#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
-----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   3 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
   4 - filter(&quot;P&quot;.&quot;RN&quot;=1)
   9 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
&lt;/pre&gt;

That probably would have helped performance a bit (roughly 13 seconds compared to a very, very long time).

I could have also tried an index hint:
&lt;pre&gt;
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) RECEIVED_QTY
FROM
  (SELECT /*+ INDEX(PLD) */
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID=&#039;144038&#039;
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
---------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                         &#124; Name          &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT                  &#124;               &#124; 49018 &#124;  2441K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;   1 &#124;  HASH GROUP BY                    &#124;               &#124; 49018 &#124;  2441K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;*  2 &#124;   FILTER                          &#124;               &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  3 &#124;    CONNECT BY WITH FILTERING      &#124;               &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  4 &#124;     VIEW                          &#124;               &#124; 49018 &#124;  8377K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;*  5 &#124;      WINDOW BUFFER PUSHED RANK    &#124;               &#124; 49018 &#124;  1675K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;   6 &#124;       TABLE ACCESS BY INDEX ROWID &#124; PURC_LINE_DEL &#124; 49018 &#124;  1675K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;   7 &#124;        INDEX FULL SCAN            &#124; SYS_C005716   &#124; 49018 &#124;       &#124;   148   (2)&#124; 00:00:01 &#124;
&#124;*  8 &#124;     HASH JOIN                     &#124;               &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   9 &#124;      CONNECT BY PUMP              &#124;               &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  10 &#124;      VIEW                         &#124;               &#124; 49018 &#124;  2441K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  11 &#124;       WINDOW BUFFER               &#124;               &#124; 49018 &#124;   909K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  12 &#124;        TABLE ACCESS BY INDEX ROWID&#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  13 &#124;         INDEX FULL SCAN           &#124; SYS_C005716   &#124; 49018 &#124;       &#124;   148   (2)&#124; 00:00:01 &#124;
&#124;  14 &#124;     VIEW                          &#124;               &#124; 49018 &#124;  7754K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  15 &#124;      WINDOW BUFFER                &#124;               &#124; 49018 &#124;  1675K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  16 &#124;       TABLE ACCESS BY INDEX ROWID &#124; PURC_LINE_DEL &#124; 49018 &#124;  1675K&#124;  8441   (1)&#124; 00:00:41 &#124;
&#124;  17 &#124;        INDEX FULL SCAN            &#124; SYS_C005716   &#124; 49018 &#124;       &#124;   148   (2)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   3 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
   4 - filter(&quot;P&quot;.&quot;RN&quot;=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY
              &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; ORDER BY &quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot;)&lt;=1)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
&lt;/pre&gt;

Or, specifying the purchase order in the CONNECT BY clause to drop the time to about 2 seconds (not an option if this needs to be a view):
&lt;pre&gt;
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID=&#039;144038&#039;
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
  AND PRIOR P.PURC_ORDER_ID=&#039;144038&#039;
  AND PRIOR P.PURC_ORDER_LINE_NO=1
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
-----------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name          &#124; Rows  &#124; Bytes &#124;TempSpc&#124; Cost (%CPU)&#124; Time     &#124;
-----------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;   1 &#124;  HASH GROUP BY              &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;*  2 &#124;   FILTER                    &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  3 &#124;    CONNECT BY WITH FILTERING&#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  4 &#124;     VIEW                    &#124;               &#124; 49018 &#124;  9430K&#124;       &#124;   411   (3)&#124; 00:00:02 &#124;
&#124;*  5 &#124;      WINDOW SORT PUSHED RANK&#124;               &#124; 49018 &#124;  1675K&#124;  5432K&#124;   411   (3)&#124; 00:00:02 &#124;
&#124;   6 &#124;       TABLE ACCESS FULL     &#124; PURC_LINE_DEL &#124; 49018 &#124;  1675K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
&#124;*  7 &#124;     FILTER                  &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;*  8 &#124;      HASH JOIN              &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   9 &#124;       CONNECT BY PUMP       &#124;               &#124;       &#124;       &#124;       &#124;            &#124;          &#124;
&#124;  10 &#124;       VIEW                  &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  11 &#124;        WINDOW SORT          &#124;               &#124; 49018 &#124;   909K&#124;  3096K&#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  12 &#124;         TABLE ACCESS FULL   &#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
&#124;  13 &#124;     VIEW                    &#124;               &#124; 49018 &#124;  8807K&#124;       &#124;   411   (3)&#124; 00:00:02 &#124;
&#124;  14 &#124;      WINDOW SORT            &#124;               &#124; 49018 &#124;  1675K&#124;  5432K&#124;   411   (3)&#124; 00:00:02 &#124;
&#124;  15 &#124;       TABLE ACCESS FULL     &#124; PURC_LINE_DEL &#124; 49018 &#124;  1675K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
-----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   3 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; AND PRIOR
              &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   4 - filter(&quot;P&quot;.&quot;RN&quot;=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY
              &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; ORDER BY &quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot;)&lt;=1)
   7 - filter(PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1 AND PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039;)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; AND PRIOR
              &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
&lt;/pre&gt;

Or in the START WITH clause to execute in about 1 second (also not an option if this will be a view):
&lt;pre&gt;
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,&#039;, &#039;),3),&#039;, &#039;,CHR(13)&#124;&#124;CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID=&#039;144038&#039;
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
  AND P.PURC_ORDER_ID=&#039;144038&#039;
  AND P.PURC_ORDER_LINE_NO=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
----------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                        &#124; Name          &#124; Rows  &#124; Bytes &#124;TempSpc&#124; Cost (%CPU)&#124; Time  &#124;
----------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT                 &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;   1 &#124;  HASH GROUP BY                   &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;*  2 &#124;   FILTER                         &#124;               &#124;       &#124;       &#124;       &#124;            &#124;       &#124;
&#124;*  3 &#124;    CONNECT BY WITH FILTERING     &#124;               &#124;       &#124;       &#124;       &#124;            &#124;       &#124;
&#124;*  4 &#124;     VIEW                         &#124;               &#124;    12 &#124;  2364 &#124;       &#124;     4   (0)&#124; 00:00:01 &#124;
&#124;*  5 &#124;      WINDOW SORT PUSHED RANK     &#124;               &#124;    12 &#124;   420 &#124;       &#124;     4   (0)&#124; 00:00:01 &#124;
&#124;   6 &#124;       TABLE ACCESS BY INDEX ROWID&#124; PURC_LINE_DEL &#124;    12 &#124;   420 &#124;       &#124;     4   (0)&#124; 00:00:01 &#124;
&#124;*  7 &#124;        INDEX RANGE SCAN          &#124; SYS_C005716   &#124;    12 &#124;       &#124;       &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;*  8 &#124;     HASH JOIN                    &#124;               &#124;       &#124;       &#124;       &#124;            &#124;       &#124;
&#124;   9 &#124;      CONNECT BY PUMP             &#124;               &#124;       &#124;       &#124;       &#124;            &#124;       &#124;
&#124;  10 &#124;      VIEW                        &#124;               &#124; 49018 &#124;  2441K&#124;       &#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  11 &#124;       WINDOW SORT                &#124;               &#124; 49018 &#124;   909K&#124;  3096K&#124;   273   (4)&#124; 00:00:02 &#124;
&#124;  12 &#124;        TABLE ACCESS FULL         &#124; PURC_LINE_DEL &#124; 49018 &#124;   909K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
&#124;  13 &#124;     VIEW                         &#124;               &#124; 49018 &#124;  7754K&#124;       &#124;   411   (3)&#124; 00:00:02 &#124;
&#124;  14 &#124;      WINDOW SORT                 &#124;               &#124; 49018 &#124;  1675K&#124;  5432K&#124;   411   (3)&#124; 00:00:02 &#124;
&#124;  15 &#124;       TABLE ACCESS FULL          &#124; PURC_LINE_DEL &#124; 49018 &#124;  1675K&#124;       &#124;    24   (5)&#124; 00:00:01 &#124;
----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   3 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot; AND
              &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
   4 - filter(&quot;P&quot;.&quot;RN&quot;=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;
              ORDER BY &quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot;)&lt;=1)
   7 - access(&quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
       filter(&quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot; AND
              &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
&lt;/pre&gt;

Incidentally, the 10053 trace file section for the last query, that is from the same section of the 10053 trace file as was shown above, follows:
&lt;pre&gt;
******* UNPARSED QUERY IS *******
SELECT /*+ */ &quot;P&quot;.&quot;PURC_ORDER_ID&quot; &quot;PURC_ORDER_ID&quot;,&quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; &quot;PURC_ORDER_LINE_NO&quot;,
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR(&quot;P&quot;.&quot;DEL_SCHED_LINE_NO&quot;),&#039;, &#039;),3),&#039;, &#039;,&#039;&#039;)) &quot;DEL_SCHED_LINE_NO&quot;,
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR(&quot;P&quot;.&quot;RECEIVED_QTY&quot;),&#039;, &#039;),3),&#039;, &#039;,&#039;&#039;)) &quot;RECEIVED_QTY&quot; 
FROM  (SELECT /*+ */ &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot; &quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; &quot;PURC_ORDER_LINE_NO&quot;,
&quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot; &quot;DEL_SCHED_LINE_NO&quot;,&quot;PLD&quot;.&quot;RECEIVED_QTY&quot; &quot;RECEIVED_QTY&quot;,
ROW_NUMBER() OVER ( PARTITION BY &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;,&quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot; ORDER BY &quot;PLD&quot;.&quot;DEL_SCHED_LINE_NO&quot;) &quot;RN&quot; 
FROM &quot;TESTUSER&quot;.&quot;PURC_LINE_DEL&quot; &quot;PLD&quot;) &quot;P&quot; WHERE &quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; 
AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; 
AND (&quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1) GROUP BY &quot;P&quot;.&quot;PURC_ORDER_ID&quot;,&quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;
kkoqbc-end
          : call(in-use=161008, alloc=180024), compile(in-use=155432, alloc=158120)
Registered qb: SEL$FFA85775 0x223a0808 (COPY SEL$FFA85775)
  signature(): NULL
Registered qb: SEL$4 0x2cf43cd8 (COPY SEL$4)
  signature(): NULL
FPD: Considering simple filter push in SEL$373CA273 (#0)
FPD:   Current where clause predicates in SEL$373CA273 (#0) :
         &quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;
FPD: Considering simple filter push in SEL$5C7C6085 (#0)
FPD:   Current where clause predicates in SEL$5C7C6085 (#0) :
         &quot;P&quot;.&quot;RN&quot;=1 AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
kkogcp: try to generate transitive predicate from check constraints for SEL$5C7C6085 (#0)
predicates with check contraints: &quot;P&quot;.&quot;RN&quot;=1 AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
after transitive predicate generation: &quot;P&quot;.&quot;RN&quot;=1 AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
finally: &quot;P&quot;.&quot;RN&quot;=1 AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD:   Following are pushed to where clause of SEL$9CAB97DB (#0) :
         &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
FPD: Considering simple filter push in SEL$9CAB97DB (#0)
FPD:   Current where clause predicates in SEL$9CAB97DB (#0) :
         &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
kkogcp: try to generate transitive predicate from check constraints for SEL$9CAB97DB (#0)
predicates with check contraints: &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
after transitive predicate generation: &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
finally: &quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1
FPD: Considering simple filter push in SEL$8E56D5CE (#0)
FPD:   Current where clause predicates in SEL$8E56D5CE (#0) :
         kkogcp: try to generate transitive predicate from check constraints for SEL$8E56D5CE (#0)
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$B36EDCEF (#0)
FPD:   Current where clause predicates in SEL$B36EDCEF (#0) :
         apadrv-start: call(in-use=164168, alloc=180024), compile(in-use=196040, alloc=199032)
kkoqbc-start
            : call(in-use=164168, alloc=180024), compile(in-use=200640, alloc=203176)
&lt;/pre&gt;

In the above, the FPD lines show that the purchase order ID and line were pushed into SEL$9CAB97DB, and that push is also evident in the predicate information section of the execution plan.]]></description>
		<content:encoded><![CDATA[<p>I believe that the reason for the predicate information not being pushed in is a result of the CONNECT BY syntax.  It appears that when a CONNECT BY clause is used, the START WITH clause is considered a WHERE clause, according to a portion of a 10053 trace:</p>
<pre>
******* UNPARSED QUERY IS *******
SELECT /*+ */ "P"."PURC_ORDER_ID" "PURC_ORDER_ID","P"."PURC_ORDER_LINE_NO" "PURC_ORDER_LINE_NO",
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR("P"."DEL_SCHED_LINE_NO"),', '),3),', ','')) "DEL_SCHED_LINE_NO",
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR("P"."RECEIVED_QTY"),', '),3),', ','')) "RECEIVED_QTY"
FROM  (SELECT /*+ */ "PLD"."PURC_ORDER_ID" "PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" "PURC_ORDER_LINE_NO",
"PLD"."DEL_SCHED_LINE_NO" "DEL_SCHED_LINE_NO","PLD"."RECEIVED_QTY" "RECEIVED_QTY",
ROW_NUMBER() OVER ( PARTITION BY "PLD"."PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" ORDER BY "PLD"."DEL_SCHED_LINE_NO") "RN"
FROM "TESTUSER"."PURC_LINE_DEL" "PLD") "P" WHERE "P"."RN"-1=PRIOR "P"."RN" 
AND ("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1) GROUP BY "P"."PURC_ORDER_ID","P"."PURC_ORDER_LINE_NO"
kkoqbc-end
          : call(in-use=159712, alloc=180024), compile(in-use=104184, alloc=108616)
Registered qb: SEL$FFA85775 0x861980f8 (COPY SEL$FFA85775)
  signature(): NULL
Registered qb: SEL$4 0x86197820 (COPY SEL$4)
  signature(): NULL
FPD: Considering simple filter push in SEL$373CA273 (#0)
FPD:   Current where clause predicates in SEL$373CA273 (#0) :
         "P"."RN"-1=PRIOR "P"."RN"
FPD: Considering simple filter push in SEL$5C7C6085 (#0)
FPD:   Current where clause predicates in SEL$5C7C6085 (#0) :
         "P"."RN"=1
kkogcp: try to generate transitive predicate from check constraints for SEL$5C7C6085 (#0)
predicates with check contraints: "P"."RN"=1
after transitive predicate generation: "P"."RN"=1
finally: "P"."RN"=1
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$9CAB97DB (#0)
FPD:   Current where clause predicates in SEL$9CAB97DB (#0) :
         FPD: Considering simple filter push in SEL$8E56D5CE (#0)
FPD:   Current where clause predicates in SEL$8E56D5CE (#0) :
         kkogcp: try to generate transitive predicate from check constraints for SEL$8E56D5CE (#0)
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$B36EDCEF (#0)
FPD:   Current where clause predicates in SEL$B36EDCEF (#0) :
         apadrv-start: call(in-use=162976, alloc=180024), compile(in-use=137240, alloc=140952)
kkoqbc-start
            : call(in-use=162976, alloc=180024), compile(in-use=141872, alloc=144968)
</pre>
<p>I probably should have originally written the query like this:</p>
<pre>
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,', '),3),', ',CHR(13)||CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,', '),3),', ',CHR(13)||CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID='144038'
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
-----------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|   1 |  SORT GROUP BY              |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|*  2 |   FILTER                    |               |       |       |       |            |          |
|*  3 |    CONNECT BY WITH FILTERING|               |       |       |       |            |          |
|*  4 |     FILTER                  |               |       |       |       |            |          |
|   5 |      COUNT                  |               |       |       |       |            |          |
|   6 |       VIEW                  |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|   7 |        WINDOW SORT          |               | 49018 |   909K|  3096K|   273   (4)| 00:00:02 |
|   8 |         TABLE ACCESS FULL   | PURC_LINE_DEL | 49018 |   909K|       |    24   (5)| 00:00:01 |
|*  9 |     HASH JOIN               |               |       |       |       |            |          |
|  10 |      CONNECT BY PUMP        |               |       |       |       |            |          |
|  11 |      COUNT                  |               |       |       |       |            |          |
|  12 |       VIEW                  |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|  13 |        WINDOW SORT          |               | 49018 |   909K|  3096K|   273   (4)| 00:00:02 |
|  14 |         TABLE ACCESS FULL   | PURC_LINE_DEL | 49018 |   909K|       |    24   (5)| 00:00:01 |
|  15 |     COUNT                   |               |       |       |       |            |          |
|  16 |      VIEW                   |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|  17 |       WINDOW SORT           |               | 49018 |   909K|  3096K|   273   (4)| 00:00:02 |
|  18 |        TABLE ACCESS FULL    | PURC_LINE_DEL | 49018 |   909K|       |    24   (5)| 00:00:01 |
-----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1)
   3 - access("P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID"
              AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO")
   4 - filter("P"."RN"=1)
   9 - access("P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID"
              AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO")
</pre>
<p>That probably would have helped performance a bit (roughly 13 seconds compared to a very, very long time).</p>
<p>I could have also tried an index hint:</p>
<pre>
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,', '),3),', ',CHR(13)||CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,', '),3),', ',CHR(13)||CHR(10))) RECEIVED_QTY
FROM
  (SELECT /*+ INDEX(PLD) */
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID='144038'
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
---------------------------------------------------------------------------------------------------
| Id  | Operation                         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                  |               | 49018 |  2441K|  8441   (1)| 00:00:41 |
|   1 |  HASH GROUP BY                    |               | 49018 |  2441K|  8441   (1)| 00:00:41 |
|*  2 |   FILTER                          |               |       |       |            |          |
|*  3 |    CONNECT BY WITH FILTERING      |               |       |       |            |          |
|*  4 |     VIEW                          |               | 49018 |  8377K|  8441   (1)| 00:00:41 |
|*  5 |      WINDOW BUFFER PUSHED RANK    |               | 49018 |  1675K|  8441   (1)| 00:00:41 |
|   6 |       TABLE ACCESS BY INDEX ROWID | PURC_LINE_DEL | 49018 |  1675K|  8441   (1)| 00:00:41 |
|   7 |        INDEX FULL SCAN            | SYS_C005716   | 49018 |       |   148   (2)| 00:00:01 |
|*  8 |     HASH JOIN                     |               |       |       |            |          |
|   9 |      CONNECT BY PUMP              |               |       |       |            |          |
|  10 |      VIEW                         |               | 49018 |  2441K|  8441   (1)| 00:00:41 |
|  11 |       WINDOW BUFFER               |               | 49018 |   909K|  8441   (1)| 00:00:41 |
|  12 |        TABLE ACCESS BY INDEX ROWID| PURC_LINE_DEL | 49018 |   909K|  8441   (1)| 00:00:41 |
|  13 |         INDEX FULL SCAN           | SYS_C005716   | 49018 |       |   148   (2)| 00:00:01 |
|  14 |     VIEW                          |               | 49018 |  7754K|  8441   (1)| 00:00:41 |
|  15 |      WINDOW BUFFER                |               | 49018 |  1675K|  8441   (1)| 00:00:41 |
|  16 |       TABLE ACCESS BY INDEX ROWID | PURC_LINE_DEL | 49018 |  1675K|  8441   (1)| 00:00:41 |
|  17 |        INDEX FULL SCAN            | SYS_C005716   | 49018 |       |   148   (2)| 00:00:01 |
---------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1)
   3 - access("P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID"
              AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO")
   4 - filter("P"."RN"=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY
              "PLD"."PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" ORDER BY "PLD"."DEL_SCHED_LINE_NO")&lt;=1)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
</pre>
<p>Or, specifying the purchase order in the CONNECT BY clause to drop the time to about 2 seconds (not an option if this needs to be a view):</p>
<pre>
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,', '),3),', ',CHR(13)||CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,', '),3),', ',CHR(13)||CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID='144038'
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
  AND PRIOR P.PURC_ORDER_ID='144038'
  AND PRIOR P.PURC_ORDER_LINE_NO=1
START WITH
  P.RN=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
-----------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|   1 |  HASH GROUP BY              |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|*  2 |   FILTER                    |               |       |       |       |            |          |
|*  3 |    CONNECT BY WITH FILTERING|               |       |       |       |            |          |
|*  4 |     VIEW                    |               | 49018 |  9430K|       |   411   (3)| 00:00:02 |
|*  5 |      WINDOW SORT PUSHED RANK|               | 49018 |  1675K|  5432K|   411   (3)| 00:00:02 |
|   6 |       TABLE ACCESS FULL     | PURC_LINE_DEL | 49018 |  1675K|       |    24   (5)| 00:00:01 |
|*  7 |     FILTER                  |               |       |       |       |            |          |
|*  8 |      HASH JOIN              |               |       |       |       |            |          |
|   9 |       CONNECT BY PUMP       |               |       |       |       |            |          |
|  10 |       VIEW                  |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|  11 |        WINDOW SORT          |               | 49018 |   909K|  3096K|   273   (4)| 00:00:02 |
|  12 |         TABLE ACCESS FULL   | PURC_LINE_DEL | 49018 |   909K|       |    24   (5)| 00:00:01 |
|  13 |     VIEW                    |               | 49018 |  8807K|       |   411   (3)| 00:00:02 |
|  14 |      WINDOW SORT            |               | 49018 |  1675K|  5432K|   411   (3)| 00:00:02 |
|  15 |       TABLE ACCESS FULL     | PURC_LINE_DEL | 49018 |  1675K|       |    24   (5)| 00:00:01 |
-----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1)
   3 - access("P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID"
              AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO" AND PRIOR
              "P"."PURC_ORDER_ID"='144038' AND PRIOR "P"."PURC_ORDER_LINE_NO"=1)
   4 - filter("P"."RN"=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY
              "PLD"."PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" ORDER BY "PLD"."DEL_SCHED_LINE_NO")&lt;=1)
   7 - filter(PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1 AND PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039;)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot;
              AND &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot; AND PRIOR
              &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
</pre>
<p>Or in the START WITH clause to execute in about 1 second (also not an option if this will be a view):</p>
<pre>
SELECT
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.DEL_SCHED_LINE_NO,', '),3),', ',CHR(13)||CHR(10))) DEL_SCHED_LINE_NO,
  MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(P.RECEIVED_QTY,', '),3),', ',CHR(13)||CHR(10))) RECEIVED_QTY
FROM
  (SELECT
    PLD.PURC_ORDER_ID,
    PLD.PURC_ORDER_LINE_NO,
    PLD.DEL_SCHED_LINE_NO,
    PLD.RECEIVED_QTY,
    ROW_NUMBER() OVER (PARTITION BY PLD.PURC_ORDER_ID, PLD.PURC_ORDER_LINE_NO ORDER BY PLD.DEL_SCHED_LINE_NO) RN
  FROM
    PURC_LINE_DEL PLD) P
WHERE
  P.PURC_ORDER_ID='144038'
  AND P.PURC_ORDER_LINE_NO=1
CONNECT BY
  PRIOR P.RN=P.RN-1
  AND PRIOR P.PURC_ORDER_ID=P.PURC_ORDER_ID
  AND PRIOR P.PURC_ORDER_LINE_NO=P.PURC_ORDER_LINE_NO
START WITH
  P.RN=1
  AND P.PURC_ORDER_ID='144038'
  AND P.PURC_ORDER_LINE_NO=1
GROUP BY
  P.PURC_ORDER_ID,
  P.PURC_ORDER_LINE_NO;
 
----------------------------------------------------------------------------------------------------------
| Id  | Operation                        | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time  |
----------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                 |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|   1 |  HASH GROUP BY                   |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|*  2 |   FILTER                         |               |       |       |       |            |       |
|*  3 |    CONNECT BY WITH FILTERING     |               |       |       |       |            |       |
|*  4 |     VIEW                         |               |    12 |  2364 |       |     4   (0)| 00:00:01 |
|*  5 |      WINDOW SORT PUSHED RANK     |               |    12 |   420 |       |     4   (0)| 00:00:01 |
|   6 |       TABLE ACCESS BY INDEX ROWID| PURC_LINE_DEL |    12 |   420 |       |     4   (0)| 00:00:01 |
|*  7 |        INDEX RANGE SCAN          | SYS_C005716   |    12 |       |       |     2   (0)| 00:00:01 |
|*  8 |     HASH JOIN                    |               |       |       |       |            |       |
|   9 |      CONNECT BY PUMP             |               |       |       |       |            |       |
|  10 |      VIEW                        |               | 49018 |  2441K|       |   273   (4)| 00:00:02 |
|  11 |       WINDOW SORT                |               | 49018 |   909K|  3096K|   273   (4)| 00:00:02 |
|  12 |        TABLE ACCESS FULL         | PURC_LINE_DEL | 49018 |   909K|       |    24   (5)| 00:00:01 |
|  13 |     VIEW                         |               | 49018 |  7754K|       |   411   (3)| 00:00:02 |
|  14 |      WINDOW SORT                 |               | 49018 |  1675K|  5432K|   411   (3)| 00:00:02 |
|  15 |       TABLE ACCESS FULL          | PURC_LINE_DEL | 49018 |  1675K|       |    24   (5)| 00:00:01 |
----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1)
   3 - access("P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID" AND
              "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO")
   4 - filter("P"."RN"=1)
   5 - filter(ROW_NUMBER() OVER ( PARTITION BY "PLD"."PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO"
              ORDER BY "PLD"."DEL_SCHED_LINE_NO")&lt;=1)
   7 - access(&quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
       filter(&quot;PLD&quot;.&quot;PURC_ORDER_ID&quot;=&#039;144038&#039; AND &quot;PLD&quot;.&quot;PURC_ORDER_LINE_NO&quot;=1)
   8 - access(&quot;P&quot;.&quot;RN&quot;-1=PRIOR &quot;P&quot;.&quot;RN&quot; AND &quot;P&quot;.&quot;PURC_ORDER_ID&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_ID&quot; AND
              &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;=PRIOR &quot;P&quot;.&quot;PURC_ORDER_LINE_NO&quot;)
</pre>
<p>Incidentally, the 10053 trace file section for the last query, that is from the same section of the 10053 trace file as was shown above, follows:</p>
<pre>
******* UNPARSED QUERY IS *******
SELECT /*+ */ "P"."PURC_ORDER_ID" "PURC_ORDER_ID","P"."PURC_ORDER_LINE_NO" "PURC_ORDER_LINE_NO",
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR("P"."DEL_SCHED_LINE_NO"),', '),3),', ','')) "DEL_SCHED_LINE_NO",
MAX(REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(TO_CHAR("P"."RECEIVED_QTY"),', '),3),', ','')) "RECEIVED_QTY" 
FROM  (SELECT /*+ */ "PLD"."PURC_ORDER_ID" "PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" "PURC_ORDER_LINE_NO",
"PLD"."DEL_SCHED_LINE_NO" "DEL_SCHED_LINE_NO","PLD"."RECEIVED_QTY" "RECEIVED_QTY",
ROW_NUMBER() OVER ( PARTITION BY "PLD"."PURC_ORDER_ID","PLD"."PURC_ORDER_LINE_NO" ORDER BY "PLD"."DEL_SCHED_LINE_NO") "RN" 
FROM "TESTUSER"."PURC_LINE_DEL" "PLD") "P" WHERE "P"."RN"-1=PRIOR "P"."RN" 
AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID" AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO" 
AND ("P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1) GROUP BY "P"."PURC_ORDER_ID","P"."PURC_ORDER_LINE_NO"
kkoqbc-end
          : call(in-use=161008, alloc=180024), compile(in-use=155432, alloc=158120)
Registered qb: SEL$FFA85775 0x223a0808 (COPY SEL$FFA85775)
  signature(): NULL
Registered qb: SEL$4 0x2cf43cd8 (COPY SEL$4)
  signature(): NULL
FPD: Considering simple filter push in SEL$373CA273 (#0)
FPD:   Current where clause predicates in SEL$373CA273 (#0) :
         "P"."RN"-1=PRIOR "P"."RN" AND "P"."PURC_ORDER_ID"=PRIOR "P"."PURC_ORDER_ID" AND "P"."PURC_ORDER_LINE_NO"=PRIOR "P"."PURC_ORDER_LINE_NO"
FPD: Considering simple filter push in SEL$5C7C6085 (#0)
FPD:   Current where clause predicates in SEL$5C7C6085 (#0) :
         "P"."RN"=1 AND "P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1
kkogcp: try to generate transitive predicate from check constraints for SEL$5C7C6085 (#0)
predicates with check contraints: "P"."RN"=1 AND "P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1
after transitive predicate generation: "P"."RN"=1 AND "P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1
finally: "P"."RN"=1 AND "P"."PURC_ORDER_ID"='144038' AND "P"."PURC_ORDER_LINE_NO"=1
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD:   Following are pushed to where clause of SEL$9CAB97DB (#0) :
         "PLD"."PURC_ORDER_ID"='144038' AND "PLD"."PURC_ORDER_LINE_NO"=1
FPD: Considering simple filter push in SEL$9CAB97DB (#0)
FPD:   Current where clause predicates in SEL$9CAB97DB (#0) :
         "PLD"."PURC_ORDER_ID"='144038' AND "PLD"."PURC_ORDER_LINE_NO"=1
kkogcp: try to generate transitive predicate from check constraints for SEL$9CAB97DB (#0)
predicates with check contraints: "PLD"."PURC_ORDER_ID"='144038' AND "PLD"."PURC_ORDER_LINE_NO"=1
after transitive predicate generation: "PLD"."PURC_ORDER_ID"='144038' AND "PLD"."PURC_ORDER_LINE_NO"=1
finally: "PLD"."PURC_ORDER_ID"='144038' AND "PLD"."PURC_ORDER_LINE_NO"=1
FPD: Considering simple filter push in SEL$8E56D5CE (#0)
FPD:   Current where clause predicates in SEL$8E56D5CE (#0) :
         kkogcp: try to generate transitive predicate from check constraints for SEL$8E56D5CE (#0)
JPPD:     JPPD bypassed: View not on right-side of outer join
FPD: Considering simple filter push in SEL$B36EDCEF (#0)
FPD:   Current where clause predicates in SEL$B36EDCEF (#0) :
         apadrv-start: call(in-use=164168, alloc=180024), compile(in-use=196040, alloc=199032)
kkoqbc-start
            : call(in-use=164168, alloc=180024), compile(in-use=200640, alloc=203176)
</pre>
<p>In the above, the FPD lines show that the purchase order ID and line were pushed into SEL$9CAB97DB, and that push is also evident in the predicate information section of the execution plan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://hoopercharles.wordpress.com/2010/04/13/a-simple-request-or-a-performance-nightmare-painted-into-a-corner-by-the-erp-system/#comment-644</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Wed, 14 Apr 2010 11:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=1895#comment-644</guid>
		<description><![CDATA[&lt;i&gt;that predicate information was not pushed into the inline view, and providing a hint to push the predicates into the inline view does not change the execution plan.&lt;/i&gt;
Is that because oracle thinks pushing the predicate will change the query semantically (and hence does not do it) or is it just an optimizer limitation (or bug)?]]></description>
		<content:encoded><![CDATA[<p><i>that predicate information was not pushed into the inline view, and providing a hint to push the predicates into the inline view does not change the execution plan.</i><br />
Is that because oracle thinks pushing the predicate will change the query semantically (and hence does not do it) or is it just an optimizer limitation (or bug)?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
