<?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: DB uses wrong index in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758102#M1304337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think a hint should be the very last option. I prefer to understand the optimizer before trying to hint the opimizer. Maybe the optimizer is correct with the cost calculation and maybe the index Z01 leads to a better runtime as well... as Thomas pointed out this could easily be the case if we consider multiple clients... .&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>Wed, 17 Jun 2009 11:07:37 GMT</pubDate>
    <dc:creator>HermannGahm</dc:creator>
    <dc:date>2009-06-17T11:07:37Z</dc:date>
    <item>
      <title>DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758098#M1304333</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;I have a custom table, with 2 indexes:&lt;/P&gt;&lt;P&gt;1) Z01 with the ff. fields: client, plant, doc1, movmt_typ&lt;/P&gt;&lt;P&gt;2) Z02 with only one field: doc1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my select statement is below:&lt;/P&gt;&lt;P&gt;select single * from zcustom where doc1 = p_doc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i check on st05, the system uses the Z01 index instead of Z02 which has the field in my where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to know why the system uses Z01 and not Z02.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thansks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 06:41:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758098#M1304333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T06:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758099#M1304334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freishz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which DB (version) are you using? (Probably not MAXDB or MSSQL, but one of the following: DB2, DB4, DB6, ORACLE, right?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on your DB the following question might be interesting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do both of your indexes have good statistics?&lt;/P&gt;&lt;P&gt;Could you post the statistics for both indexes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without more information i assume the reason is in the statistics... .&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>Wed, 17 Jun 2009 06:49:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758099#M1304334</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-06-17T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758100#M1304335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to that, why did you not include the client in index Z02? Depending on how many clients you have and the data distribution per client this may or may not make a difference for the index selection.&lt;/P&gt;&lt;P&gt;It might be worth a try to include the client in that index and check the result.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 07:30:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758100#M1304335</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-06-17T07:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758101#M1304336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you really want to use Z02 index then try using HINTS and the particular index.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 10:26:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758101#M1304336</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-17T10:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758102#M1304337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think a hint should be the very last option. I prefer to understand the optimizer before trying to hint the opimizer. Maybe the optimizer is correct with the cost calculation and maybe the index Z01 leads to a better runtime as well... as Thomas pointed out this could easily be the case if we consider multiple clients... .&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>Wed, 17 Jun 2009 11:07:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758102#M1304337</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-06-17T11:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758103#M1304338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes HINTS should not be used until and unless this is the last resort .&lt;/P&gt;&lt;P&gt;But my suggestion was based on assumption that user wants to use Z02 ONLY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 11:16:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758103#M1304338</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-17T11:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758104#M1304339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first check whether the index exists on the DB and not only in DDIC and check statistics, use DB02,&lt;/P&gt;&lt;P&gt;or ST05 (with Oracle or IBM).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check system -&amp;gt; status, if you are not aware what DB you use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 13:24:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758104#M1304339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T13:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: DB uses wrong index</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758105#M1304340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Ask your basis team to update the database statistics for this table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 13:28:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-uses-wrong-index/m-p/5758105#M1304340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T13:28:11Z</dc:date>
    </item>
  </channel>
</rss>

