<?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: INDEX Creation for Query Optimization in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412532#M1242821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Firstly, I dont think you need to create any index for your case,the suggestion I provided should help improve the performance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But just to answer your query, since your query is using the fields AUART,VKORG, AND VBTYP from VBAK and MATNR from VBAP, those would be the recommended fields to be used while creating the index for VBAK and VBAP respectively. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But remember that creating custom index is the last thing to consider due to the overhead to update the index for every database operation.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even after creating indices, you need to make sure that you pass values to the selection criteria for which you created the index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Apr 2009 09:56:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-01T09:56:18Z</dc:date>
    <item>
      <title>INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412527#M1242816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the below query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT A~VBELN A~POSNR A~MATNR A~KWMENG A~KBMENG
A~ERDAT A~ERZET A~PSTYV D~AUART E~ETTYP E~EDATU

INTO TABLE INT_RES

FROM VBAK AS D INNER JOIN VBAP AS A 

ON D~VBELN EQ A~VBELN

INNER JOIN VBEP AS E

ON E~VBELN EQ A~VBELN AND
E~POSNR EQ A~POSNR

WHERE D~VBELN IN S_VBELN AND
D~AUART IN S_AUART AND
D~VKORG IN S_VKORG AND
D~VBTYP EQ 'C' AND
( ( A~MATNR LIKE C_PREFIX_SP AND ZZ_MSPOSNR NE 0 AND KBMENG EQ 0 ) OR
( MATNR LIKE C_PREFIX_FP AND KWMENG NE A~KBMENG ) ) AND
A~ABGRU EQ SPACE AND
A~MTVFP IN R_MTVFP AND
A~PRCTR IN R_PRCT AND
E~ETENR EQ '1'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried many ways of re-writing the query - yet performance could not be improved. Now I need to create an INDEX and check if it works out? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me suggesting &lt;STRONG&gt;upon which table and which fields in which order&lt;/STRONG&gt; I can create an effective INDEX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:17:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412527#M1242816</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T09:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412528#M1242817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi bobby , &lt;/P&gt;&lt;P&gt;where r u facing the performance problem wether in vbap or vbak , and how many entreis are fetched ur using join instead of it u can use for all entries , and if the fields are not key fields then u can create index on both tables also&lt;/P&gt;&lt;P&gt;hope solves ur prob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412528#M1242817</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T09:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412529#M1242818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check which selection criteria are polulated when you run the query. &lt;/P&gt;&lt;P&gt;Also one issue might be with using the LIKE keyword in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
( ( A~MATNR LIKE C_PREFIX_SP AND ZZ_MSPOSNR NE 0 AND KBMENG EQ 0 ) OR
( MATNR LIKE C_PREFIX_FP AND KWMENG NE A~KBMENG ) ) AND
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using this, I would suggest you get all the materials from material master using the like operator and pass them in a range to this query.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select matnr from mara into it_mara
where matnr like c_prefix_sp. 
select matnr from mara appending table it_mara where matnr like c_prefix_fp.
"Loop at it_mara and populate a range. Which will then be used in the select query
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That might help improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:35:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412529#M1242818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T09:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412530#M1242819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for suggestions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Suppose, if I want to create an INDEX for this query, then what would be the fields which you will suggest to consider?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reply to this specifically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:45:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412530#M1242819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T09:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412531#M1242820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;       You should put those fields  in the INDEX which you will use in the WHERE clause of the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also make sure that the fields in the INDEX are in the same order as they are in the WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:48:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412531#M1242820</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2009-04-01T09:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412532#M1242821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Firstly, I dont think you need to create any index for your case,the suggestion I provided should help improve the performance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But just to answer your query, since your query is using the fields AUART,VKORG, AND VBTYP from VBAK and MATNR from VBAP, those would be the recommended fields to be used while creating the index for VBAK and VBAP respectively. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But remember that creating custom index is the last thing to consider due to the overhead to update the index for every database operation.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even after creating indices, you need to make sure that you pass values to the selection criteria for which you created the index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 09:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412532#M1242821</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T09:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412533#M1242822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Even you create an index you &lt;STRONG&gt;query will not use the index&lt;/STRONG&gt;, because you are using &lt;STRONG&gt;-Ve operator&lt;/STRONG&gt; in where class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;remove the -Ve operator from your query it will work fine.&lt;/P&gt;&lt;P&gt;and if you can work around to avoid the LIKE statement it ill do fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 11:33:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412533#M1242822</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T11:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412534#M1242823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pancras&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(-)ve Operator?&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;I did not get you? Is it ~ you mean? How it will affect performance? How can I remove that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 12:05:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412534#M1242823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T12:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412535#M1242824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;-Ve operator use in u'r query is Not equal etc., &lt;/P&gt;&lt;P&gt;ZZ_MSPOSNR NE 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;remove that from where class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after select you can delete it from ITAB. or you can skip while processing.&lt;/P&gt;&lt;P&gt;use which ever suite you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 12:12:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412535#M1242824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T12:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412536#M1242825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you use -Ve operators engine will have full scan on the particular table wether you use index or what ever.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 12:15:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412536#M1242825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T12:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412537#M1242826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thx for the suggestions. But, I feel a difficulty in between.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;There is a field in checking ZZ_MSPOSNR in

( A~MATNR LIKE C_PREFIX_SP AND ZZ_MSPOSNR NE 0 AND KBMENG EQ 0 ) 

and one field KWMENG being checked against same as

( MATNR LIKE C_PREFIX_FP AND KWMENG NE A~KBMENG )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I write DELETE statement for these -ve operators?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz suggest..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2009 12:49:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412537#M1242826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T12:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412538#M1242827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This question is an extension of your earlier one: &lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1273068"&gt;&lt;/A&gt; Please assign poin ts to it and mark it as closed. When that is done, I will unlock this.&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, 01 Apr 2009 14:03:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412538#M1242827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-01T14:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX Creation for Query Optimization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412539#M1242828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Points assigned, marked as answered, so unlocked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Apr 2009 08:33:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/index-creation-for-query-optimization/m-p/5412539#M1242828</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-04-06T08:33:33Z</dc:date>
    </item>
  </channel>
</rss>

