<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using Hints Oracle in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916124#M1330685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Can you tell the Syntax for LEADING Hint and USE_NL Hint to influence the order of Selection ie first MSEG&lt;SUB&gt;M and then MKPF&lt;/SUB&gt;BUD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sure, this hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %_HINTS ORACLE 'LEADING(T2)'&lt;/P&gt;&lt;P&gt;         ORACLE 'USE_NL(T1)'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will start with MSEG - T2 (alias from view) and use nested loop to access MKPF - T1 (alias from view)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; And I have one more doubt, when I am going through Oracle Performance Tuning Guide 10g for hints, I found this&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;gt; Oracle does not encourage the use of hints inside or on views (or subqueries). This
&amp;gt; is because you can define views in one context and use them in another. Also, such
&amp;gt; hints can result in unexpected execution plans. In particular, hints inside views or
&amp;gt; on views are handled differently, depending on whether the view is mergeable into
&amp;gt; the top-level query.
&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  Can you please give me your advice on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hm i think this means that you should not hint &lt;STRONG&gt;IN&lt;/STRONG&gt; the view itself because it may be used&lt;/P&gt;&lt;P&gt;from many different call positions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you didn't hint in the view, you hinted your query that access the view.&lt;/P&gt;&lt;P&gt;Another query without hint may use a different execution plan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jul 2009 12:31:28 GMT</pubDate>
    <dc:creator>HermannGahm</dc:creator>
    <dc:date>2009-07-24T12:31:28Z</dc:date>
    <item>
      <title>Using Hints Oracle</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916121#M1330682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a statement which selects from WB2_V_MKPF_MSEG2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 
MBLNR MJAHR ZEILE_I BWART_I MATNR_I WERKS_I LGORT_I CHARG_I SHKZG_I MENGE_I MEINS_I UMMAT_I UMWRK_I  UMLGO_I UMCHA_I 
FROM WB2_V_MKPF_MSEG2 INTO TABLE ITAB_MSEG 
FOR ALL ENTRIES IN ITAB_BATCH WHERE
      MATNR_I = ITAB_BATCH-MATNR AND WERKS_I = STRC_T001L-WERKS AND LGORT_I IN S_LGORT1 AND
      BWART_I IN ('311', '312') AND CHARG_I = ITAB_BATCH-CHARG AND BUDAT IN R_BUDAT  %_HINTS ORACLE
      '&amp;amp;SUBSTITUTE VALUES&amp;amp;' ORACLE '&amp;amp;max_blocking_factor 20&amp;amp;'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I observed the trace, I found 2 different execution plans (I had executed the report multiple times)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First -&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Index Range Scan MKPF~BUD&lt;/P&gt;&lt;P&gt;2. Table Access by Index Rowid MKPF&lt;/P&gt;&lt;P&gt;3. Index Range Scan MSEG~0&lt;/P&gt;&lt;P&gt;4. Table Access by Index Rowid MSEG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Second -&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Index Range Scan MSEG~M  &lt;/P&gt;&lt;P&gt;Index M contains the following fields - MATNR, WERKS, LGORT, BWART, SOBKZ, CHARG&lt;/P&gt;&lt;P&gt;2.Table Access by Index Rowid MSEG&lt;/P&gt;&lt;P&gt;3. Index Range Scan MKPF~BUD&lt;/P&gt;&lt;P&gt;4. Table Access by Index Rowid MKPF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The report running with second execution plan takes less time when compared to first. Though Optimizer is selecting a execution plan which goes through Index in both cases it is unable to select the Best Optimal Plan in all the cases ie &lt;STRONG&gt;Second&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use Hints,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ORACLE 'INDEX("MSEG" "MSEG~M" "MSEG^M")'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the optimizer is not considering, still I get the First Execution Plan. &lt;/P&gt;&lt;P&gt;I could observe that Hints are working when I use a single table ie either MKPF or MSEG. But when I use View it is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to influence Optimizer to consider first MSEG&lt;SUB&gt;M and then MKPF&lt;/SUB&gt;BUD using Hints&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one help me on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vipin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 10:47:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916121#M1330682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-24T10:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Hints Oracle</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916122#M1330683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vipin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, it is possible to use hints for a view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of the table name you have to use VIEWNAME.TABLEALIAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table alias can be found in the view definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The view definition can be found in SE14 (object log)&lt;/P&gt;&lt;P&gt;or at db level "SELECT TEXT FROM DBA_VIEWS WHERE VIEW_NAME = '&amp;lt;view_name&amp;gt;';"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Forcing index usage would then look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INDEX(WB2_V_MKPF_MSEG2 .T1 "MSEG~M" "MSEG^M")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if MSEG has alias T1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;back to your question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Is it possible to influence Optimizer to consider first MSEG&lt;SUB&gt;M and then MKPF&lt;/SUB&gt;BUD using Hints&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this requires much more hints... e.g. LEADING (to specify the starting table) USE_NL (to specify the join mechanism)&lt;/P&gt;&lt;P&gt;and the INDEX hints like the one above...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;good luck &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 11:08:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916122#M1330683</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-24T11:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using Hints Oracle</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916123#M1330684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear  Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response. Now I am able to change MSEG&lt;SUB&gt;0 to MSEG&lt;/SUB&gt;M using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INDEX(WB2_V_MKPF_MSEG2.T2 "MSEG~M" "MSEG^M").&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you tell the Syntax for LEADING Hint and USE_NL Hint to influence the order of Selection ie first MSEG&lt;SUB&gt;M and then MKPF&lt;/SUB&gt;BUD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I have one more doubt, when I am going through Oracle Performance Tuning Guide 10g for hints, I found this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Oracle does not encourage the use of hints inside or on views (or subqueries). This
is because you can define views in one context and use them in another. Also, such
hints can result in unexpected execution plans. In particular, hints inside views or
on views are handled differently, depending on whether the view is mergeable into
the top-level query.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think for my problem, Hints will solve. Can you please give me your advice on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vipin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 12:22:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916123#M1330684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-24T12:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Hints Oracle</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916124#M1330685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Can you tell the Syntax for LEADING Hint and USE_NL Hint to influence the order of Selection ie first MSEG&lt;SUB&gt;M and then MKPF&lt;/SUB&gt;BUD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sure, this hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %_HINTS ORACLE 'LEADING(T2)'&lt;/P&gt;&lt;P&gt;         ORACLE 'USE_NL(T1)'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will start with MSEG - T2 (alias from view) and use nested loop to access MKPF - T1 (alias from view)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; And I have one more doubt, when I am going through Oracle Performance Tuning Guide 10g for hints, I found this&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;gt; Oracle does not encourage the use of hints inside or on views (or subqueries). This
&amp;gt; is because you can define views in one context and use them in another. Also, such
&amp;gt; hints can result in unexpected execution plans. In particular, hints inside views or
&amp;gt; on views are handled differently, depending on whether the view is mergeable into
&amp;gt; the top-level query.
&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  Can you please give me your advice on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hm i think this means that you should not hint &lt;STRONG&gt;IN&lt;/STRONG&gt; the view itself because it may be used&lt;/P&gt;&lt;P&gt;from many different call positions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you didn't hint in the view, you hinted your query that access the view.&lt;/P&gt;&lt;P&gt;Another query without hint may use a different execution plan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 12:31:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916124#M1330685</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-24T12:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using Hints Oracle</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916125#M1330686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vipin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this when you enter hint in the box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INDEX ("MSEG" "MSEG~M")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ketan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 12:15:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-hints-oracle/m-p/5916125#M1330686</guid>
      <dc:creator>former_member210621</dc:creator>
      <dc:date>2012-12-03T12:15:51Z</dc:date>
    </item>
  </channel>
</rss>

