<?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: Push_Subq</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/03/09/push_subq/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 19 Jun 2013 22:21:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Rules for Hinting &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-38028</link>
		<dc:creator><![CDATA[Rules for Hinting &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Thu, 02 Dec 2010 08:57:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-38028</guid>
		<description><![CDATA[[...] push_subq: how upgrades can stop hints working. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] push_subq: how upgrades can stop hints working. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajeet</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-31019</link>
		<dc:creator><![CDATA[Ajeet]]></dc:creator>
		<pubDate>Tue, 13 May 2008 07:15:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-31019</guid>
		<description><![CDATA[Jonathan

adding a not null constraint in the subquery has indeed converted that into hash anti join,
infact in the &quot;Cost based fundamentals&quot; also you have written - but i was confused as it was discussed for NOT IN. 
sorry about poor formating.
I will pay attention on this in future postings.

Thanks]]></description>
		<content:encoded><![CDATA[<p>Jonathan</p>
<p>adding a not null constraint in the subquery has indeed converted that into hash anti join,<br />
infact in the &#8220;Cost based fundamentals&#8221; also you have written &#8211; but i was confused as it was discussed for NOT IN.<br />
sorry about poor formating.<br />
I will pay attention on this in future postings.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30979</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 08 May 2008 07:41:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30979</guid>
		<description><![CDATA[Ajeet,

I pointed out that your last commented hadn&#039;t been formatted for readability - and the same applies to this one. 

Ignoring the huge mess of the query and tkprof output, though, your question is &quot;why hasn&#039;t Oracle changed a &quot;not exists&quot; subquery to an anti-join. 

You don&#039;t need a big example to investigate this. A small example with just two tables will let you investigate that one detail and then allow you to apply the concept to more complex cases.

Off the top of my head, there are probably only two things to investigate. (a) maybe it&#039;s the arithmetic, (b) maybe it relates to the need for &quot;not null&quot; constraints on the correlating columns.  (And (a2) if you want to hint it, then checking that you&#039;ve definitely used the hints correctly).]]></description>
		<content:encoded><![CDATA[<p>Ajeet,</p>
<p>I pointed out that your last commented hadn&#8217;t been formatted for readability &#8211; and the same applies to this one. </p>
<p>Ignoring the huge mess of the query and tkprof output, though, your question is &#8220;why hasn&#8217;t Oracle changed a &#8220;not exists&#8221; subquery to an anti-join. </p>
<p>You don&#8217;t need a big example to investigate this. A small example with just two tables will let you investigate that one detail and then allow you to apply the concept to more complex cases.</p>
<p>Off the top of my head, there are probably only two things to investigate. (a) maybe it&#8217;s the arithmetic, (b) maybe it relates to the need for &#8220;not null&#8221; constraints on the correlating columns.  (And (a2) if you want to hint it, then checking that you&#8217;ve definitely used the hints correctly).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajeet</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30971</link>
		<dc:creator><![CDATA[Ajeet]]></dc:creator>
		<pubDate>Wed, 07 May 2008 14:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30971</guid>
		<description><![CDATA[Hi Jonathan

I read about query transformation in your book.
I could not uderstand why the query below is not using HASH_AJ for the not exists subquery .

the query below runs for 1 hr to return 50K rows.

could you please suggest what is wrong here -

SELECT POH.SEGMENT1 &#124;&#124;&#039;&#124;&#039; &#124;&#124;POH.LAST_UPDATE_DATE &#124;&#124;&#039;&#124;&#039; &#124;&#124;POH.CURRENCY_CODE &#124;&#124;
  &#039;&#124;&#039; &#124;&#124;POH.REVISION_NUM &#124;&#124;&#039;&#124;&#039; &#124;&#124;POH.CLOSED_CODE &#124;&#124; &#039;&#124;&#039; &#124;&#124;POL.LINE_NUM &#124;&#124;&#039;&#124;&#039;
  &#124;&#124;POL.LAST_UPDATE_DATE &#124;&#124;&#039;&#124;&#039; &#124;&#124;POL.QUANTITY &#124;&#124;&#039;&#124;&#039; &#124;&#124;POL.UNIT_PRICE &#124;&#124;&#039;&#124;&#039;
  &#124;&#124;POL.CLOSED_CODE &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.SHIPMENT_NUM &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.LAST_UPDATE_DATE
  &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.QUANTITY &#124;&#124;&#039;&#124;&#039; &#124;&#124;(SELECT COUNT(PDA2.PO_DISTRIBUTION_ID)
FROM
 APPS.PO_DISTRIBUTIONS_ALL PDA2 WHERE PDA2.PO_HEADER_ID = POH.PO_HEADER_ID)
  &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.QUANTITY_RECEIVED &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.QUANTITY_CANCELLED &#124;&#124;&#039;&#124;&#039;
  &#124;&#124;POLL.QUANTITY_BILLED &#124;&#124;&#039;&#124;&#039; &#124;&#124;POLL.CLOSED_CODE &#124;&#124;&#039;&#124;&#039; &#124;&#124;POH.ORG_ID &#124;&#124;&#039;&#124;&#039;
  &#124;&#124;GCC.SEGMENT1&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT2&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT3&#124;&#124;&#039;&#124;&#039;
  &#124;&#124;GCC.SEGMENT4&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT5&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT6&#124;&#124;&#039;&#124;&#039;
  &#124;&#124;GCC.SEGMENT7&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT8&#124;&#124;&#039;&#124;&#039; &#124;&#124;GCC.SEGMENT9&#124;&#124;&#039;&#124;&#039;
  &#124;&#124;PV.SEGMENT1&#124;&#124;&#039;&#124;&#039; &#124;&#124;PV.VENDOR_NAME&#124;&#124;&#039;&#124;&#039; &#124;&#124;POVS.VENDOR_SITE_CODE&#124;&#124;&#039;&#124;&#039;
  &#124;&#124;POH.FULL_NAME &#124;&#124; &#039;&#124;&#039; &#124;&#124;MC.SEGMENT1&#124;&#124; MC.SEGMENT2&#124;&#124; MC.SEGMENT3&#124;&#124;
  MC.SEGMENT4&#124;&#124; MC.SEGMENT5 &#124;&#124; &#039;&#124;&#039; &#124;&#124;PDA.QUANTITY_ORDERED &#124;&#124; &#039;&#124;&#039;
  &#124;&#124;PDA.QUANTITY_DELIVERED &#124;&#124; &#039;&#124;&#039; &#124;&#124;POLL.NEED_BY_DATE &#124;&#124; &#039;&#124;&#039; &#124;&#124;NULL &#124;&#124; &#039;&#124;&#039;
  &#124;&#124;NULL &#124;&#124; &#039;&#124;&#039; &#124;&#124;NULL &#124;&#124; &#039;&#124;&#039; &#124;&#124;PDA.DISTRIBUTION_NUM &#124;&#124; &#039;&#124;&#039;
  &#124;&#124;POLL.QUANTITY_REJECTED &#124;&#124; &#039;&#124;&#039; &#124;&#124;POLL.DAYS_EARLY_RECEIPT_ALLOWED &#124;&#124; &#039;&#124;&#039;
  &#124;&#124;POLL.DAYS_LATE_RECEIPT_ALLOWED &#124;&#124; &#039;&#124;&#039; &#124;&#124;POLL.RECEIPT_DAYS_EXCEPTION_CODE
  &#124;&#124; &#039;&#124;&#039; &#124;&#124;POLL.QTY_RCV_TOLERANCE &#124;&#124; &#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039;
  &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; &#124;&#124;&#039;&#124;&#039; PO_RECON_DATA_CUR FROM T3 POH ,
  APPS.PO_DISTRIBUTIONS_ALL PDA ,APPS.MTL_CATEGORIES MC ,
  APPS.GL_CODE_COMBINATIONS GCC ,APPS.PO_LINE_LOCATIONS_ALL POLL ,
  APPS.PO_LINES_ALL POL ,APPS.PO_VENDOR_SITES_ALL POVS ,APPS.PO_VENDORS PV
  WHERE PDA.PO_HEADER_ID=POH.PO_HEADER_ID AND POH.VENDOR_ID = PV.VENDOR_ID
  AND POVS.VENDOR_ID = PV.VENDOR_ID AND POVS.VENDOR_SITE_ID =
  POH.VENDOR_SITE_ID AND POVS.ORG_ID = POH.ORG_ID AND PDA.CODE_COMBINATION_ID
  = GCC.CODE_COMBINATION_ID AND POL.PO_HEADER_ID = POH.PO_HEADER_ID AND
  POLL.PO_HEADER_ID = POH.PO_HEADER_ID AND POLL.PO_LINE_ID = POL.PO_LINE_ID
  AND PDA.PO_LINE_ID = POLL.PO_LINE_ID AND PDA.LINE_LOCATION_ID =
  POLL.LINE_LOCATION_ID AND POL.CATEGORY_ID = MC.CATEGORY_ID AND NOT EXISTS
  (SELECT /*+ HASH_AJ(apps.ap_invoice_distributions_all)*/ 1 FROM
  APPS.AP_INVOICE_DISTRIBUTIONS_ALL WHERE PO_DISTRIBUTION_ID=
  PDA.PO_DISTRIBUTION_ID)


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.14       0.12          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch    53777    431.65    4146.97     849561   15077239          0       53776
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total    53779    431.79    4147.10     849561   15077239          0       53776

Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 65  (APPS)   (recursive depth: 1)

Rows     Row Source Operation
-------  ---------------------------------------------------
  53776  FILTER  (cr=14968161 r=830308 w=0 time=3992044684 us)
 857292   NESTED LOOPS  (cr=12395792 r=765116 w=0 time=3469343008 us)
 857292    NESTED LOOPS  (cr=9770138 r=746321 w=0 time=3257402729 us)
 817106     NESTED LOOPS  (cr=7122874 r=527908 w=0 time=2163647611 us)
 815224      NESTED LOOPS  (cr=4467909 r=254484 w=0 time=873769330 us)
 815224       NESTED LOOPS  (cr=3600016 r=254484 w=0 time=867378738 us)
 815224        NESTED LOOPS  (cr=1916899 r=254484 w=0 time=854167408 us)
 536644         HASH JOIN  (cr=67037 r=20961 w=0 time=23132035 us)
 265974          TABLE ACCESS FULL PO_VENDOR_SITES_ALL (cr=16203 r=13803 w=0 time=8342317 us)
 536644          HASH JOIN  (cr=50834 r=7158 w=0 time=10949413 us)
 146208           TABLE ACCESS FULL PO_VENDORS (cr=7332 r=0 w=0 time=156064 us)
 536644           TABLE ACCESS FULL T3 (cr=43502 r=7158 w=0 time=7288830 us)
 815224         TABLE ACCESS BY INDEX ROWID PO_LINES_ALL (cr=1849862 r=233523 w=0 time=828571445 us)
 815224          INDEX RANGE SCAN PO_LINES_U2 (cr=1169044 r=61552 w=0 time=254156446 us)(object id 10182)
 815224        TABLE ACCESS BY INDEX ROWID MTL_CATEGORIES_B (cr=1683117 r=0 w=0 time=10259002 us)
 815224         INDEX UNIQUE SCAN MTL_CATEGORIES_B_U1 (cr=867893 r=0 w=0 time=4879455 us)(object id 9632)
 815224       INDEX UNIQUE SCAN MTL_CATEGORIES_TL_U1 (cr=867893 r=0 w=0 time=4024518 us)(object id 684692)
 817106      TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=2654965 r=273424 w=0 time=1285786829 us)
 817106       INDEX RANGE SCAN PO_LINE_LOCATIONS_N2 (cr=1744948 r=71462 w=0 time=361371836 us)(object id 10194)
 857292     TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=2647264 r=218413 w=0 time=1089673131 us)
 857292      INDEX RANGE SCAN PO_DISTRIBUTIONS_N1 (cr=1748737 r=75456 w=0 time=367235456 us)(object id 10127)
 857292    TABLE ACCESS BY INDEX ROWID GL_CODE_COMBINATIONS (cr=2625654 r=18795 w=0 time=208731765 us)
 857292     INDEX UNIQUE SCAN GL_CODE_COMBINATIONS_U1 (cr=1768362 r=3248 w=0 time=41687174 us)(object id 51426)
 803516   INDEX RANGE SCAN AP_INVOICE_DISTRIBUTIONS_N7 (cr=2572369 r=65192 w=0 time=516473241 us)(object id 7199)

database version is oracle 9iR2.]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan</p>
<p>I read about query transformation in your book.<br />
I could not uderstand why the query below is not using HASH_AJ for the not exists subquery .</p>
<p>the query below runs for 1 hr to return 50K rows.</p>
<p>could you please suggest what is wrong here -</p>
<p>SELECT POH.SEGMENT1 ||&#8217;|&#8217; ||POH.LAST_UPDATE_DATE ||&#8217;|&#8217; ||POH.CURRENCY_CODE ||<br />
  &#8216;|&#8217; ||POH.REVISION_NUM ||&#8217;|&#8217; ||POH.CLOSED_CODE || &#8216;|&#8217; ||POL.LINE_NUM ||&#8217;|&#8217;<br />
  ||POL.LAST_UPDATE_DATE ||&#8217;|&#8217; ||POL.QUANTITY ||&#8217;|&#8217; ||POL.UNIT_PRICE ||&#8217;|&#8217;<br />
  ||POL.CLOSED_CODE ||&#8217;|&#8217; ||POLL.SHIPMENT_NUM ||&#8217;|&#8217; ||POLL.LAST_UPDATE_DATE<br />
  ||&#8217;|&#8217; ||POLL.QUANTITY ||&#8217;|&#8217; ||(SELECT COUNT(PDA2.PO_DISTRIBUTION_ID)<br />
FROM<br />
 APPS.PO_DISTRIBUTIONS_ALL PDA2 WHERE PDA2.PO_HEADER_ID = POH.PO_HEADER_ID)<br />
  ||&#8217;|&#8217; ||POLL.QUANTITY_RECEIVED ||&#8217;|&#8217; ||POLL.QUANTITY_CANCELLED ||&#8217;|&#8217;<br />
  ||POLL.QUANTITY_BILLED ||&#8217;|&#8217; ||POLL.CLOSED_CODE ||&#8217;|&#8217; ||POH.ORG_ID ||&#8217;|&#8217;<br />
  ||GCC.SEGMENT1||&#8217;|&#8217; ||GCC.SEGMENT2||&#8217;|&#8217; ||GCC.SEGMENT3||&#8217;|&#8217;<br />
  ||GCC.SEGMENT4||&#8217;|&#8217; ||GCC.SEGMENT5||&#8217;|&#8217; ||GCC.SEGMENT6||&#8217;|&#8217;<br />
  ||GCC.SEGMENT7||&#8217;|&#8217; ||GCC.SEGMENT8||&#8217;|&#8217; ||GCC.SEGMENT9||&#8217;|&#8217;<br />
  ||PV.SEGMENT1||&#8217;|&#8217; ||PV.VENDOR_NAME||&#8217;|&#8217; ||POVS.VENDOR_SITE_CODE||&#8217;|&#8217;<br />
  ||POH.FULL_NAME || &#8216;|&#8217; ||MC.SEGMENT1|| MC.SEGMENT2|| MC.SEGMENT3||<br />
  MC.SEGMENT4|| MC.SEGMENT5 || &#8216;|&#8217; ||PDA.QUANTITY_ORDERED || &#8216;|&#8217;<br />
  ||PDA.QUANTITY_DELIVERED || &#8216;|&#8217; ||POLL.NEED_BY_DATE || &#8216;|&#8217; ||NULL || &#8216;|&#8217;<br />
  ||NULL || &#8216;|&#8217; ||NULL || &#8216;|&#8217; ||PDA.DISTRIBUTION_NUM || &#8216;|&#8217;<br />
  ||POLL.QUANTITY_REJECTED || &#8216;|&#8217; ||POLL.DAYS_EARLY_RECEIPT_ALLOWED || &#8216;|&#8217;<br />
  ||POLL.DAYS_LATE_RECEIPT_ALLOWED || &#8216;|&#8217; ||POLL.RECEIPT_DAYS_EXCEPTION_CODE<br />
  || &#8216;|&#8217; ||POLL.QTY_RCV_TOLERANCE || &#8216;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217;<br />
  ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; ||&#8217;|&#8217; PO_RECON_DATA_CUR FROM T3 POH ,<br />
  APPS.PO_DISTRIBUTIONS_ALL PDA ,APPS.MTL_CATEGORIES MC ,<br />
  APPS.GL_CODE_COMBINATIONS GCC ,APPS.PO_LINE_LOCATIONS_ALL POLL ,<br />
  APPS.PO_LINES_ALL POL ,APPS.PO_VENDOR_SITES_ALL POVS ,APPS.PO_VENDORS PV<br />
  WHERE PDA.PO_HEADER_ID=POH.PO_HEADER_ID AND POH.VENDOR_ID = PV.VENDOR_ID<br />
  AND POVS.VENDOR_ID = PV.VENDOR_ID AND POVS.VENDOR_SITE_ID =<br />
  POH.VENDOR_SITE_ID AND POVS.ORG_ID = POH.ORG_ID AND PDA.CODE_COMBINATION_ID<br />
  = GCC.CODE_COMBINATION_ID AND POL.PO_HEADER_ID = POH.PO_HEADER_ID AND<br />
  POLL.PO_HEADER_ID = POH.PO_HEADER_ID AND POLL.PO_LINE_ID = POL.PO_LINE_ID<br />
  AND PDA.PO_LINE_ID = POLL.PO_LINE_ID AND PDA.LINE_LOCATION_ID =<br />
  POLL.LINE_LOCATION_ID AND POL.CATEGORY_ID = MC.CATEGORY_ID AND NOT EXISTS<br />
  (SELECT /*+ HASH_AJ(apps.ap_invoice_distributions_all)*/ 1 FROM<br />
  APPS.AP_INVOICE_DISTRIBUTIONS_ALL WHERE PO_DISTRIBUTION_ID=<br />
  PDA.PO_DISTRIBUTION_ID)</p>
<p>call     count       cpu    elapsed       disk      query    current        rows<br />
&#8212;&#8212;- &#8212;&#8212;  &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-  &#8212;&#8212;&#8212;-<br />
Parse        1      0.14       0.12          0          0          0           0<br />
Execute      1      0.00       0.00          0          0          0           0<br />
Fetch    53777    431.65    4146.97     849561   15077239          0       53776<br />
&#8212;&#8212;- &#8212;&#8212;  &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-  &#8212;&#8212;&#8212;-<br />
total    53779    431.79    4147.10     849561   15077239          0       53776</p>
<p>Misses in library cache during parse: 1<br />
Optimizer goal: CHOOSE<br />
Parsing user id: 65  (APPS)   (recursive depth: 1)</p>
<p>Rows     Row Source Operation<br />
&#8212;&#8212;-  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
  53776  FILTER  (cr=14968161 r=830308 w=0 time=3992044684 us)<br />
 857292   NESTED LOOPS  (cr=12395792 r=765116 w=0 time=3469343008 us)<br />
 857292    NESTED LOOPS  (cr=9770138 r=746321 w=0 time=3257402729 us)<br />
 817106     NESTED LOOPS  (cr=7122874 r=527908 w=0 time=2163647611 us)<br />
 815224      NESTED LOOPS  (cr=4467909 r=254484 w=0 time=873769330 us)<br />
 815224       NESTED LOOPS  (cr=3600016 r=254484 w=0 time=867378738 us)<br />
 815224        NESTED LOOPS  (cr=1916899 r=254484 w=0 time=854167408 us)<br />
 536644         HASH JOIN  (cr=67037 r=20961 w=0 time=23132035 us)<br />
 265974          TABLE ACCESS FULL PO_VENDOR_SITES_ALL (cr=16203 r=13803 w=0 time=8342317 us)<br />
 536644          HASH JOIN  (cr=50834 r=7158 w=0 time=10949413 us)<br />
 146208           TABLE ACCESS FULL PO_VENDORS (cr=7332 r=0 w=0 time=156064 us)<br />
 536644           TABLE ACCESS FULL T3 (cr=43502 r=7158 w=0 time=7288830 us)<br />
 815224         TABLE ACCESS BY INDEX ROWID PO_LINES_ALL (cr=1849862 r=233523 w=0 time=828571445 us)<br />
 815224          INDEX RANGE SCAN PO_LINES_U2 (cr=1169044 r=61552 w=0 time=254156446 us)(object id 10182)<br />
 815224        TABLE ACCESS BY INDEX ROWID MTL_CATEGORIES_B (cr=1683117 r=0 w=0 time=10259002 us)<br />
 815224         INDEX UNIQUE SCAN MTL_CATEGORIES_B_U1 (cr=867893 r=0 w=0 time=4879455 us)(object id 9632)<br />
 815224       INDEX UNIQUE SCAN MTL_CATEGORIES_TL_U1 (cr=867893 r=0 w=0 time=4024518 us)(object id 684692)<br />
 817106      TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=2654965 r=273424 w=0 time=1285786829 us)<br />
 817106       INDEX RANGE SCAN PO_LINE_LOCATIONS_N2 (cr=1744948 r=71462 w=0 time=361371836 us)(object id 10194)<br />
 857292     TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=2647264 r=218413 w=0 time=1089673131 us)<br />
 857292      INDEX RANGE SCAN PO_DISTRIBUTIONS_N1 (cr=1748737 r=75456 w=0 time=367235456 us)(object id 10127)<br />
 857292    TABLE ACCESS BY INDEX ROWID GL_CODE_COMBINATIONS (cr=2625654 r=18795 w=0 time=208731765 us)<br />
 857292     INDEX UNIQUE SCAN GL_CODE_COMBINATIONS_U1 (cr=1768362 r=3248 w=0 time=41687174 us)(object id 51426)<br />
 803516   INDEX RANGE SCAN AP_INVOICE_DISTRIBUTIONS_N7 (cr=2572369 r=65192 w=0 time=516473241 us)(object id 7199)</p>
<p>database version is oracle 9iR2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30857</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 16 Apr 2008 19:11:26 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30857</guid>
		<description><![CDATA[Ajeet,

Sorry, the supplied data is not formatted for easy reading. See the link to &quot;how to comment&quot; at top-right if you want to try again.

The only thing I will say is that push_subq applies to subqueries that are not &#039;unnested&#039; - which means that appear in the execution plans as filter operations.  I didn&#039;t see an explicit filter in your execution plan - but sometimes the filter operation is not displayed.]]></description>
		<content:encoded><![CDATA[<p>Ajeet,</p>
<p>Sorry, the supplied data is not formatted for easy reading. See the link to &#8220;how to comment&#8221; at top-right if you want to try again.</p>
<p>The only thing I will say is that push_subq applies to subqueries that are not &#8216;unnested&#8217; &#8211; which means that appear in the execution plans as filter operations.  I didn&#8217;t see an explicit filter in your execution plan &#8211; but sometimes the filter operation is not displayed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajeet</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30788</link>
		<dc:creator><![CDATA[Ajeet]]></dc:creator>
		<pubDate>Fri, 04 Apr 2008 14:24:03 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-30788</guid>
		<description><![CDATA[Hi

I have a question about push_subq.

I can see that it works as explained with exist.doest it work ,in case of NOT EXISTS as well.

I have a query like this - returns 14 rows,takes almost 90 mins.

SELECT /*+   ordered  use_hash(mtp) push_subq */ ooha.org_id &quot;OPERATING UNIT ID&quot;
FROM        apps.oe_transaction_types_all ott,
            apps.oe_transaction_types_tl ottt_l,
            apps.oe_order_lines_all oola,
            apps.mtl_parameters mtp,
            apps.oe_order_headers_all ooha,
            apps.hz_cust_accounts hca
WHERE  ooha.header_id = oola.header_id AND
       ooha.org_id = oola.org_id AND
       ooha.order_source_id = 1263 AND
       ott.transaction_type_id = ottt_l.transaction_type_id AND
       ott.org_id = ooha.org_id AND
       oola.line_type_id = ottt_l.transaction_type_id AND
       oola.line_type_id = ott.transaction_type_id AND
       mtp.organization_id = oola.ship_from_org_id AND
       hca.cust_account_id = ooha.sold_to_org_id AND
       (ottt_l.NAME LIKE &#039;GPO%FE_CONSIGNMENT_LINE&#039; OR
       ottt_l.NAME LIKE &#039;GPO%FE_SHIPMENT_LINE&#039;) AND
       oola.flow_status_code IN (&#039;SHIPPED&#039;, &#039;CLOSED&#039;) AND
       hca.attribute9 IS NOT NULL
       and NOT EXISTS
       ( SELECT /*+ NO_UNNEST */ 1
       FROM   apps.mtl_material_transactions mmt ,
              apps.mtl_transaction_lot_numbers mtnl ,
              apps.mtl_parameters mp ,
              apps.mtl_item_locations mil
       WHERE  mmt.inventory_item_id = oola.inventory_item_id AND
              mmt.transaction_type_id IN (420, 40, 41, 42) AND
              mmt.transaction_quantity &gt; 0 AND
              mtnl.lot_number = ooha.order_number AND
              mtnl.transaction_id = mmt.transaction_id AND
              mmt.transaction_date &gt; (TRUNC(SYSDATE) -90) AND
              mmt.organization_id = mp.organization_id AND
              mp.attribute7 = &#039;PARTS&#039; AND
              mp.attribute11 =&#039;SERVICE&#039; AND
              mil.inventory_location_id = hca.attribute9 AND
              mil.organization_id = mp.organization_id
       ) AND
       NVL(oola.actual_shipment_date, oola.schedule_ship_date) &gt; SYSDATE - 90
/

its tkprof - 

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        2    690.28    4899.16    1524771   23494672          0          12
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4    690.28    4899.16    1524771   23494672          0          12

Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 65  (APPS)

Rows     Row Source Operation
-------  ---------------------------------------------------
     12  NESTED LOOPS  (cr=23494672 r=1524771 w=0 time=4640213970 us)
 157696   NESTED LOOPS  (cr=5730245 r=1402270 w=0 time=3699650845 us)
 157697    HASH JOIN  (cr=5257151 r=1379549 w=0 time=3576187058 us)
 157697     TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=5257149 r=1379549 w=0 time=3575115599 us)
2789657      NESTED LOOPS  (cr=13232 r=12982 w=0 time=90323177 us)
     76       HASH JOIN  (cr=277 r=82 w=0 time=175347 us)
   4597        TABLE ACCESS FULL OE_TRANSACTION_TYPES_ALL (cr=157 r=0 w=0 time=6683 us)
     76        TABLE ACCESS FULL OE_TRANSACTION_TYPES_TL (cr=120 r=82 w=0 time=157808 us)
2789580       INDEX RANGE SCAN GEMS_ONT_ORDER_LINES_N99 (cr=12955 r=12900 w=0 time=86301122 us)(object id 1863725)
    377     INDEX FULL SCAN MTL_PARAMETERS_U1 (cr=2 r=0 w=0 time=367 us)(object id 9847)
 157696    TABLE ACCESS BY INDEX ROWID OE_ORDER_HEADERS_ALL (cr=473094 r=22721 w=0 time=123022055 us)
 157697     INDEX UNIQUE SCAN OE_ORDER_HEADERS_U1 (cr=315397 r=1363 w=0 time=11565697 us)(object id 688729)
     12   TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=17764427 r=122501 w=0 time=1114177945 us)
 157696    INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=315395 r=274 w=0 time=3770326 us)(object id 715003)
 157621    TABLE ACCESS BY INDEX ROWID MTL_TRANSACTION_LOT_NUMBERS (cr=17291336 r=121205 w=0 time=1096619120 us)
6897874     NESTED LOOPS  (cr=14562731 r=114663 w=0 time=1018837983 us)
3448931      NESTED LOOPS  (cr=7488435 r=112057 w=0 time=936487677 us)
 157633       NESTED LOOPS  (cr=788165 r=581 w=0 time=10022817 us)
 157633        INDEX RANGE SCAN MTL_ITEM_LOCATIONS_U1 (cr=472899 r=581 w=0 time=7984520 us)(object id 9761)
 157633        TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=315266 r=0 w=0 time=1667395 us)
 157633         INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=157633 r=0 w=0 time=770942 us)(object id 9847)
3448931       TABLE ACCESS BY INDEX ROWID MTL_MATERIAL_TRANSACTIONS (cr=6700270 r=111476 w=0 time=924106849 us)
8273225        INDEX RANGE SCAN MTL_MATERIAL_TRANSACTIONS_N1 (cr=695175 r=32781 w=0 time=303092226 us)(object id 6205511)
3448931      INDEX RANGE SCAN MTL_TRANSACTION_LOT_NUMBERS_N1 (cr=7074296 r=2606 w=0 time=74416944 us)(object id 9976)

- my questiones are:

how does push_subq will help or rathe is it helping or is it a valid choice here.

the tables in NOT EXISTS have lots of data.

is there a way I can improve the performance of this query.

Thanks
Ajeet]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I have a question about push_subq.</p>
<p>I can see that it works as explained with exist.doest it work ,in case of NOT EXISTS as well.</p>
<p>I have a query like this &#8211; returns 14 rows,takes almost 90 mins.</p>
<p>SELECT /*+   ordered  use_hash(mtp) push_subq */ ooha.org_id &#8220;OPERATING UNIT ID&#8221;<br />
FROM        apps.oe_transaction_types_all ott,<br />
            apps.oe_transaction_types_tl ottt_l,<br />
            apps.oe_order_lines_all oola,<br />
            apps.mtl_parameters mtp,<br />
            apps.oe_order_headers_all ooha,<br />
            apps.hz_cust_accounts hca<br />
WHERE  ooha.header_id = oola.header_id AND<br />
       ooha.org_id = oola.org_id AND<br />
       ooha.order_source_id = 1263 AND<br />
       ott.transaction_type_id = ottt_l.transaction_type_id AND<br />
       ott.org_id = ooha.org_id AND<br />
       oola.line_type_id = ottt_l.transaction_type_id AND<br />
       oola.line_type_id = ott.transaction_type_id AND<br />
       mtp.organization_id = oola.ship_from_org_id AND<br />
       hca.cust_account_id = ooha.sold_to_org_id AND<br />
       (ottt_l.NAME LIKE &#8216;GPO%FE_CONSIGNMENT_LINE&#8217; OR<br />
       ottt_l.NAME LIKE &#8216;GPO%FE_SHIPMENT_LINE&#8217;) AND<br />
       oola.flow_status_code IN (&#8216;SHIPPED&#8217;, &#8216;CLOSED&#8217;) AND<br />
       hca.attribute9 IS NOT NULL<br />
       and NOT EXISTS<br />
       ( SELECT /*+ NO_UNNEST */ 1<br />
       FROM   apps.mtl_material_transactions mmt ,<br />
              apps.mtl_transaction_lot_numbers mtnl ,<br />
              apps.mtl_parameters mp ,<br />
              apps.mtl_item_locations mil<br />
       WHERE  mmt.inventory_item_id = oola.inventory_item_id AND<br />
              mmt.transaction_type_id IN (420, 40, 41, 42) AND<br />
              mmt.transaction_quantity &gt; 0 AND<br />
              mtnl.lot_number = ooha.order_number AND<br />
              mtnl.transaction_id = mmt.transaction_id AND<br />
              mmt.transaction_date &gt; (TRUNC(SYSDATE) -90) AND<br />
              mmt.organization_id = mp.organization_id AND<br />
              mp.attribute7 = &#8216;PARTS&#8217; AND<br />
              mp.attribute11 =&#8217;SERVICE&#8217; AND<br />
              mil.inventory_location_id = hca.attribute9 AND<br />
              mil.organization_id = mp.organization_id<br />
       ) AND<br />
       NVL(oola.actual_shipment_date, oola.schedule_ship_date) &gt; SYSDATE &#8211; 90<br />
/</p>
<p>its tkprof &#8211; </p>
<p>call     count       cpu    elapsed       disk      query    current        rows<br />
&#8212;&#8212;- &#8212;&#8212;  &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-  &#8212;&#8212;&#8212;-<br />
Parse        1      0.00       0.00          0          0          0           0<br />
Execute      1      0.00       0.00          0          0          0           0<br />
Fetch        2    690.28    4899.16    1524771   23494672          0          12<br />
&#8212;&#8212;- &#8212;&#8212;  &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-  &#8212;&#8212;&#8212;-<br />
total        4    690.28    4899.16    1524771   23494672          0          12</p>
<p>Misses in library cache during parse: 0<br />
Optimizer goal: CHOOSE<br />
Parsing user id: 65  (APPS)</p>
<p>Rows     Row Source Operation<br />
&#8212;&#8212;-  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
     12  NESTED LOOPS  (cr=23494672 r=1524771 w=0 time=4640213970 us)<br />
 157696   NESTED LOOPS  (cr=5730245 r=1402270 w=0 time=3699650845 us)<br />
 157697    HASH JOIN  (cr=5257151 r=1379549 w=0 time=3576187058 us)<br />
 157697     TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=5257149 r=1379549 w=0 time=3575115599 us)<br />
2789657      NESTED LOOPS  (cr=13232 r=12982 w=0 time=90323177 us)<br />
     76       HASH JOIN  (cr=277 r=82 w=0 time=175347 us)<br />
   4597        TABLE ACCESS FULL OE_TRANSACTION_TYPES_ALL (cr=157 r=0 w=0 time=6683 us)<br />
     76        TABLE ACCESS FULL OE_TRANSACTION_TYPES_TL (cr=120 r=82 w=0 time=157808 us)<br />
2789580       INDEX RANGE SCAN GEMS_ONT_ORDER_LINES_N99 (cr=12955 r=12900 w=0 time=86301122 us)(object id 1863725)<br />
    377     INDEX FULL SCAN MTL_PARAMETERS_U1 (cr=2 r=0 w=0 time=367 us)(object id 9847)<br />
 157696    TABLE ACCESS BY INDEX ROWID OE_ORDER_HEADERS_ALL (cr=473094 r=22721 w=0 time=123022055 us)<br />
 157697     INDEX UNIQUE SCAN OE_ORDER_HEADERS_U1 (cr=315397 r=1363 w=0 time=11565697 us)(object id 688729)<br />
     12   TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=17764427 r=122501 w=0 time=1114177945 us)<br />
 157696    INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=315395 r=274 w=0 time=3770326 us)(object id 715003)<br />
 157621    TABLE ACCESS BY INDEX ROWID MTL_TRANSACTION_LOT_NUMBERS (cr=17291336 r=121205 w=0 time=1096619120 us)<br />
6897874     NESTED LOOPS  (cr=14562731 r=114663 w=0 time=1018837983 us)<br />
3448931      NESTED LOOPS  (cr=7488435 r=112057 w=0 time=936487677 us)<br />
 157633       NESTED LOOPS  (cr=788165 r=581 w=0 time=10022817 us)<br />
 157633        INDEX RANGE SCAN MTL_ITEM_LOCATIONS_U1 (cr=472899 r=581 w=0 time=7984520 us)(object id 9761)<br />
 157633        TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=315266 r=0 w=0 time=1667395 us)<br />
 157633         INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=157633 r=0 w=0 time=770942 us)(object id 9847)<br />
3448931       TABLE ACCESS BY INDEX ROWID MTL_MATERIAL_TRANSACTIONS (cr=6700270 r=111476 w=0 time=924106849 us)<br />
8273225        INDEX RANGE SCAN MTL_MATERIAL_TRANSACTIONS_N1 (cr=695175 r=32781 w=0 time=303092226 us)(object id 6205511)<br />
3448931      INDEX RANGE SCAN MTL_TRANSACTION_LOT_NUMBERS_N1 (cr=7074296 r=2606 w=0 time=74416944 us)(object id 9976)</p>
<p>- my questiones are:</p>
<p>how does push_subq will help or rathe is it helping or is it a valid choice here.</p>
<p>the tables in NOT EXISTS have lots of data.</p>
<p>is there a way I can improve the performance of this query.</p>
<p>Thanks<br />
Ajeet</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3940</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 11 Mar 2007 07:09:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3940</guid>
		<description><![CDATA[Alberto, the old syntax no longer works.]]></description>
		<content:encoded><![CDATA[<p>Alberto, the old syntax no longer works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paweł Barut</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3929</link>
		<dc:creator><![CDATA[Paweł Barut]]></dc:creator>
		<pubDate>Sat, 10 Mar 2007 16:53:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3929</guid>
		<description><![CDATA[I&#039;ve noticed this change with push_subq some time ago and i was using the method with push_subq used in subquery. But method with naming subquery and referencing it name in other hint is nice solution.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve noticed this change with push_subq some time ago and i was using the method with push_subq used in subquery. But method with naming subquery and referencing it name in other hint is nice solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3920</link>
		<dc:creator><![CDATA[Alberto Dell'Era]]></dc:creator>
		<pubDate>Sat, 10 Mar 2007 09:44:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/03/09/push_subq/#comment-3920</guid>
		<description><![CDATA[Jonathan, is the old &quot;/*+ push_subq */&quot; (without any argument) ignored in 10g ? I haven&#039;t understood whether the new syntax is mandatory or simply a fine-grained additional variation. Thanks!]]></description>
		<content:encoded><![CDATA[<p>Jonathan, is the old &#8220;/*+ push_subq */&#8221; (without any argument) ignored in 10g ? I haven&#8217;t understood whether the new syntax is mandatory or simply a fine-grained additional variation. Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
