<?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: Correct table Index not being picked while execution in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112705#M1362524</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would you use an not equal condition on an index ??????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; rrcty NE '2'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Means it can be all but 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume you are in front of book shelf, the author is  not 'Sharespeare', what does it help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Aug 2009 14:41:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-27T14:41:29Z</dc:date>
    <item>
      <title>Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112702#M1362521</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;     &lt;STRONG&gt;For a particular custom table there are 5 indexes.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Piece of code.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;     SELECT rbukrs rzzrjvnam rzzdevcode rzzaltkt racct rcntr&lt;/P&gt;&lt;P&gt;         rzzrecid rzzlocation rzzproject rzzafeno rzzebeln&lt;/P&gt;&lt;P&gt;      rzzoutline rzzagrtyp rzzblart hsl ryear poper docnr docln&lt;/P&gt;&lt;P&gt;      refdocnr sgtxt rrcty          "Add ARM 02Mar07 / +v106&lt;/P&gt;&lt;P&gt;  FROM zsiopa&lt;/P&gt;&lt;P&gt;  INTO TABLE int_zsiopa1&lt;/P&gt;&lt;P&gt;  WHERE rrcty NE '2' AND            "exclude record type 2&lt;/P&gt;&lt;P&gt;        rldnr EQ 'SL' AND&lt;/P&gt;&lt;P&gt;        ryear = p_year AND&lt;/P&gt;&lt;P&gt;        poper IN rng_months AND&lt;/P&gt;&lt;P&gt;        rbukrs EQ p_bukrs AND&lt;/P&gt;&lt;P&gt;        racct IN s_accnt AND&lt;/P&gt;&lt;P&gt;        rzzrecid  in s_reccin AND&lt;/P&gt;&lt;P&gt;        rzzrjvnam IN s_vent AND&lt;/P&gt;&lt;P&gt;        rzzaltkt IS NOT NULL&lt;/P&gt;&lt;P&gt;        %_HINTS ORACLE 'index("zsiopa" "zsiopa~5")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per the where condition 5th index in the table was created.&lt;/P&gt;&lt;P&gt;But  when checked the trace report from ST05,it uses 4th index on execution .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can someone suggest what can be done?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushankari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2009 10:47:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112702#M1362521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-27T10:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112703#M1362522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what fields are in the fourth index and in the fifth index????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WHERE rrcty NE '2' AND "exclude record type 2
rldnr EQ 'SL' AND
ryear = p_year AND
poper IN rng_months AND
rbukrs EQ p_bukrs AND
racct IN s_accnt AND
rzzrecid in s_reccin AND
rzzrjvnam IN s_vent AND
rzzaltkt IS NOT NULL
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND this is not your statement, the executed statement is displayed in the detail of the SQL trace, also above the explain in Oracle but without values.&lt;/P&gt;&lt;P&gt;=&amp;gt; which is INs are not used ????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2009 11:00:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112703#M1362522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-27T11:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112704#M1362523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4th  Index has RACCT, RCNTR.&lt;/P&gt;&lt;P&gt;5th  Index has RRCTY,RYEAR,POPER,RBUKRS,RACCT,RZZRECID,RZZRJVNAM,RZZALTKT.&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;Anushankari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2009 11:10:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112704#M1362523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-27T11:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112705#M1362524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would you use an not equal condition on an index ??????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; rrcty NE '2'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Means it can be all but 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume you are in front of book shelf, the author is  not 'Sharespeare', what does it help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2009 14:41:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112705#M1362524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-27T14:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112706#M1362525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="16" __jive_macro_name="size"&gt;
plus ... read my answer completely !!!!

What is the actual WHERE-condition !!

IN-clauses are no WHERE-condition, they are filled during execution.
They can be =, &amp;lt;, &amp;gt;, also &amp;lt;&amp;gt;, or empty !!!!

This is absolutely important, but completely ignored by every second poster in this forum.

Be aware of the difference between Open SQL and database SQL.
&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2009 14:45:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112706#M1362525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-27T14:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112707#M1362526</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;please do what Siegfired said. Post the SQL statement as it is sent to the database with variables and times... .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have hinted your statement with this hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'index("zsiopa" "zsiopa~5")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A hint, gives the optimizer an hint what index should be used.&lt;/P&gt;&lt;P&gt;The optimizer checks your hint syntatically and semantically.&lt;/P&gt;&lt;P&gt;Please note that index and table names are not lower case in ORACLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestion: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write your hint like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'INDEX("ZSIOPA" "ZSIOPA~5")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the desired index should be choosen by the optimzer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But please note: hints are only checked syntacially and&lt;/P&gt;&lt;P&gt;semantically... it is not checked for efficiency. &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check out this example in ST05 - Explain one SQL statement...:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;/*+&lt;/P&gt;&lt;P&gt;  INDEX("T100" "T100~001")&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;  *&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;  T100&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;  arbgb &amp;lt;&amp;gt; 'something'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT STATEMENT ( Estimated Costs = 393.815 , Estimated #Rows = 2.011.334 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        2 TABLE ACCESS BY INDEX ROWID T100&lt;/P&gt;&lt;P&gt;          ( Estim. Costs = 393.815 , Estim. #Rows = 2.011.334 )&lt;/P&gt;&lt;P&gt;          Estim. CPU-Costs = 2.986.180.574 Estim. IO-Costs = 393.348&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            1 INDEX FULL SCAN T100~001&lt;/P&gt;&lt;P&gt;              ( Estim. Costs = 1.437 , Estim. #Rows = 2.011.334 )&lt;/P&gt;&lt;P&gt;              Estim. CPU-Costs = 110.654.191 Estim. IO-Costs = 1.420&lt;/P&gt;&lt;P&gt;              Filter Predicates&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whenever the hint is syntatically and semantically correct&lt;/P&gt;&lt;P&gt;and the specified action (forced usage of an index) is technically&lt;/P&gt;&lt;P&gt;posible, ORACLE will do what you have told to do, regardless how&lt;/P&gt;&lt;P&gt;inefficient it may be.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you use hints, you should know what you do. Your NE condition&lt;/P&gt;&lt;P&gt;on the first indexfield does not sound like a good idea to me because you&lt;/P&gt;&lt;P&gt;have to scan the whole index like in the examle above...&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>Thu, 27 Aug 2009 15:21:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112707#M1362526</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-08-27T15:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112708#M1362527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't use 'NE' condition in the where clause. Instead delete the unwanted records from internal table int_zsiopa1 after selecting.&lt;/P&gt;&lt;P&gt;As you said that you have already created an index on the table. Check if stats run was executed on that table.&lt;/P&gt;&lt;P&gt;The query then should pick proper index and there should not be a need to provide any hint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Aug 2009 06:21:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112708#M1362527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-30T06:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Correct table Index not being picked while execution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112709#M1362528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Don't use 'NE' condition in the where clause. Instead delete the unwanted records from internal table int_zsiopa1 after selecting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is often written here, but completely incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NE is not used by the optimizer and the index, but it reduces the transferred amount of data!!!!&lt;/P&gt;&lt;P&gt;It can happen that the internal table is much much smaller.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leave the NE in the WHERE-condition, bt be aware that no index can use for the search, i.e it can be one of the last index fields&lt;/P&gt;&lt;P&gt;but not the first one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Aug 2009 16:05:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/correct-table-index-not-being-picked-while-execution/m-p/6112709#M1362528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-30T16:05:17Z</dc:date>
    </item>
  </channel>
</rss>

