<?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: DB2 optimizer in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962283#M946510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for reply. &lt;/P&gt;&lt;P&gt;I've already seen this note, but there is no any example with hint INDEX and also with JOIN as in my occasion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is SQL statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  P~BWASL
          A~LNRAN
          P~ANLN1 P~ANLN2 K~MONAT P~AFABE
          G~GITCOL
          NAFAV          SAFAV
          AAFAV          MAFAV
          AUFNV          NAFAL
          SAFAL          AAFAL
          MAFAL
     FROM ANEA AS A
                JOIN ANEK AS K ON K~BUKRS = A~BUKRS
                              AND K~ANLN1 = A~ANLN1
                              AND K~ANLN2 = A~ANLN2
                              AND K~GJAHR = A~GJAHR
                              AND K~LNRAN = A~LNRAN
                JOIN ANEP AS P ON P~BUKRS = A~BUKRS
                              AND P~ANLN1 = A~ANLN1
                              AND P~ANLN2 = A~ANLN2
                              AND P~GJAHR = A~GJAHR
                              AND P~LNRAN = A~LNRAN
                              AND P~AFABE = A~AFABE
                              AND P~ZUJHR = A~ZUJHR
                              AND P~ZUCOD = A~ZUCOD
                JOIN TABW AS T ON T~BWASL = P~BWASL
                JOIN TABWG AS G ON G~BWAGRP = T~BWAGRP
     INTO LS_AMSUM_EXT
                WHERE
                      A~BUKRS = 'SNG'
                  AND A~ANLN1 IN s_anln1
                  AND A~ANLN2 =  '0000'
                  AND A~GJAHR = '2008'
                  AND A~AFABE IN ('01' , '02', '10' , '11')
                  AND K~MONAT &amp;lt;= '6'

 %_HINTS DB2 'INDEX("ANEP" "ANEP~Z1")'
.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jun 2008 12:26:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-18T12:26:18Z</dc:date>
    <item>
      <title>DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962281#M946508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus!&lt;/P&gt;&lt;P&gt;My DB2 optimizer makes a mistake and choose a secondary index, instead of &lt;/P&gt;&lt;P&gt;primary and thefore we have performance problems. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I add some hints to SQL statement, to prevent his mistake?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I know in Oracle it looks like this &lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 09:26:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962281#M946508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T09:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962282#M946509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes you can add hints. Please read note #150037.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ralph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 10:50:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962282#M946509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T10:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962283#M946510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for reply. &lt;/P&gt;&lt;P&gt;I've already seen this note, but there is no any example with hint INDEX and also with JOIN as in my occasion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is SQL statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  P~BWASL
          A~LNRAN
          P~ANLN1 P~ANLN2 K~MONAT P~AFABE
          G~GITCOL
          NAFAV          SAFAV
          AAFAV          MAFAV
          AUFNV          NAFAL
          SAFAL          AAFAL
          MAFAL
     FROM ANEA AS A
                JOIN ANEK AS K ON K~BUKRS = A~BUKRS
                              AND K~ANLN1 = A~ANLN1
                              AND K~ANLN2 = A~ANLN2
                              AND K~GJAHR = A~GJAHR
                              AND K~LNRAN = A~LNRAN
                JOIN ANEP AS P ON P~BUKRS = A~BUKRS
                              AND P~ANLN1 = A~ANLN1
                              AND P~ANLN2 = A~ANLN2
                              AND P~GJAHR = A~GJAHR
                              AND P~LNRAN = A~LNRAN
                              AND P~AFABE = A~AFABE
                              AND P~ZUJHR = A~ZUJHR
                              AND P~ZUCOD = A~ZUCOD
                JOIN TABW AS T ON T~BWASL = P~BWASL
                JOIN TABWG AS G ON G~BWAGRP = T~BWAGRP
     INTO LS_AMSUM_EXT
                WHERE
                      A~BUKRS = 'SNG'
                  AND A~ANLN1 IN s_anln1
                  AND A~ANLN2 =  '0000'
                  AND A~GJAHR = '2008'
                  AND A~AFABE IN ('01' , '02', '10' , '11')
                  AND K~MONAT &amp;lt;= '6'

 %_HINTS DB2 'INDEX("ANEP" "ANEP~Z1")'
.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 12:26:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962283#M946510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T12:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962284#M946511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you are trying to force the SELECT to use a specific index on table ANEP when there are no fields from that table in the WHERE, so it uses a full table scan anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 13:15:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962284#M946511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T13:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962285#M946512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you really run DB2 on zOS, or do you run DB6 (DB2 on LUW (Linux-Unix-Windows)?&lt;/P&gt;&lt;P&gt;I would suggest first to test SUBSTITUTE LITERALS hint. This is in most cases enough on DB2 as well as DB6. If not you should open a ticket at SAP. There are no Hints in DB2. DB2 has a similar feature called Optimizer Guidelines (check DB2 9.5 documentation), it is much more flexible than Hints in Oracle but there is no documentation how to use it in SAP applications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ralph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 13:23:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962285#M946512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T13:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 optimizer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962286#M946513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ralph and Rob . &lt;/P&gt;&lt;P&gt;Thanks a lot for very usefull advises.&lt;/P&gt;&lt;P&gt;We use DB2 for Z/OS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll try to implement your recomendations and will write about results later.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 03:27:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db2-optimizer/m-p/3962286#M946513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-19T03:27:55Z</dc:date>
    </item>
  </channel>
</rss>

