<?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: Query Optimization - Index possible?? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850865#M925754</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; avoid join ... use views ...&lt;/P&gt;&lt;P&gt;sorry,  that is nonsense views are joins which are defined in the dictonary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select ...                               
into  table t_vbak                               
from vbak as a                                   
inner join vbuk as b 
on b~vbeln = a~vbeln        
where a~vbtyp in s_doccat and          
a~auart in s_ordtyp and                          
a~vbeln in s_ordno and                          
a~vkorg in s_vkorg and                          
a~vtweg in s_vtweg and                          
a~spart in s_spart and                          
( ( ( a~erdat &amp;gt;= pre_dat and                    
a~erdat &amp;lt; p_syndt ) or            
 ( a~erdat = p_syndt and                     
a~erzet &amp;lt;= p_syntm ) ) ) and              
( ( a~lifsk in s_lifsk ) or                     
( a~lifsk = '  ' ) )                          
and	b~abstk ne 'C'.                         
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a huge misunderstanding which apprea here in the fourm very often.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not the join is your problem but the in-clauses! You have to know which in-clauses are actually filled. Usually&lt;/P&gt;&lt;P&gt;on some are filled. But there are a lot of different combinations possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Identify the ones which are really important, try to put them into an order.&lt;/P&gt;&lt;P&gt;Then you can check whether there is an index for each combination, or whether there is no index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A new index for the vbak table (all where conditions are on table a = vbak) is not so easy to realize. It is large central table with lots of changes,&lt;/P&gt;&lt;P&gt;lots of standard coding works with that coding, I guess your coding will be of low importance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 May 2008 07:53:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-26T07:53:44Z</dc:date>
    <item>
      <title>Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850862#M925751</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;&lt;STRONG&gt;I have the following Query to be optimized. Now am checking out if creating an INDEX would improve the performance of this Query&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please suggest - if an index is possible on this query? If yes, upon what field I can create it?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select a~vbeln a~auart a~vkorg a~vtweg a~spart a~angdt  
a~bnddt a~guebg a~gueen a~vkgrp a~vkbur a~gsber  
a~kunnr a~erdat a~erzet a~waerk a~vbtyp a~autlf  
a~vsbed a~kvgr1 a~kvgr2 a~kvgr3 a~kvgr4 a~kvgr5  
a~abrvw a~abdis                                  
into  table t_vbak                               
from vbak as a                                   
inner join vbuk as b on b~vbeln = a~vbeln        
where a~vbtyp in s_doccat and          
a~auart in s_ordtyp and                          
a~vbeln in s_ordno and                          
a~vkorg in s_vkorg and                          
a~vtweg in s_vtweg and                          
a~spart in s_spart and                          
( ( ( a~erdat &amp;gt;= pre_dat and                    
a~erdat &amp;lt; p_syndt ) or            
 ( a~erdat = p_syndt and                     
a~erzet &amp;lt;= p_syntm ) ) ) and              
( ( a~lifsk in s_lifsk ) or                     
( a~lifsk = '  ' ) )                          
and	b~abstk ne 'C'.                         

t_vbak1[] = t_vbak[].
sort t_vbak1 by vbeln.
if t_vbak1[] is not initial.
    delete adjacent duplicates from t_vbak1 comparing vbeln.
endif.

select w~mandt
w~vbeln w~posnr  w~meins w~matnr w~werks  w~netwr
w~kwmeng w~vrkme  w~matwa  w~charg w~pstyv
w~posar  w~prodh  w~grkor  w~antlf  w~kztlf w~lprio
w~vstel  w~route  w~umvkz  w~umvkn  w~abgru w~untto
w~awahr  w~erdat  w~erzet w~fixmg  w~prctr  w~vpmat  w~vpwrk
w~mvgr1  w~mvgr2  w~mvgr3  w~mvgr4  w~mvgr5
w~bedae w~cuobj w~mtvfp
x~etenr x~wmeng x~bmeng   x~ettyp  x~wepos  x~abart
x~edatu
x~tddat x~mbdat   x~lddat  x~wadat  x~abruf x~etart
x~ezeit
into table t_vbap
from  vbap as w
inner join vbep as x on x~vbeln = w~vbeln and
x~posnr = w~posnr and
x~mandt = w~mandt
for all entries in t_vbak1
where
w~vbeln = t_vbak1-vbeln and
( ( ( erdat &amp;gt; pre_dat and erdat &amp;lt; p_syndt )  or
( erdat = p_syndt and  erzet &amp;lt;= p_syntm ) ) ) and
w~matnr in s_matnr and
w~pstyv in s_itmcat and
w~lfrel in s_lfrel and
w~abgru = '  ' and
w~mtvfp in w_mtvfp  and
x~ettyp in w_ettyp  and
x~bdart in s_req_tp and
x~plart in s_pln_tp and
x~etart in s_etart and
x~abart in s_abart and
( ( x~lifsp in s_lifsp ) or ( x~lifsp = ' ' ) ).

refresh: t_vbak1[].
clear: t_vbak1[].
DELETE t_vbap where kwmeng LE 0.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Highly Rewardable&lt;/P&gt;&lt;P&gt;Santo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 06:41:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850862#M925751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T06:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850863#M925752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For Optimization.....Plz avoid  join.......&lt;/P&gt;&lt;P&gt;if possible use views...........&lt;/P&gt;&lt;P&gt;if possible change the logic................to increase performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is Usefull   Plz Reward&lt;/P&gt;&lt;P&gt;&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;Anbu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Anbu B on May 26, 2008 9:02 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 07:02:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850863#M925752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T07:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850864#M925753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to know about the possibility of INDEX on this query too....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 07:09:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850864#M925753</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T07:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850865#M925754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; avoid join ... use views ...&lt;/P&gt;&lt;P&gt;sorry,  that is nonsense views are joins which are defined in the dictonary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select ...                               
into  table t_vbak                               
from vbak as a                                   
inner join vbuk as b 
on b~vbeln = a~vbeln        
where a~vbtyp in s_doccat and          
a~auart in s_ordtyp and                          
a~vbeln in s_ordno and                          
a~vkorg in s_vkorg and                          
a~vtweg in s_vtweg and                          
a~spart in s_spart and                          
( ( ( a~erdat &amp;gt;= pre_dat and                    
a~erdat &amp;lt; p_syndt ) or            
 ( a~erdat = p_syndt and                     
a~erzet &amp;lt;= p_syntm ) ) ) and              
( ( a~lifsk in s_lifsk ) or                     
( a~lifsk = '  ' ) )                          
and	b~abstk ne 'C'.                         
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a huge misunderstanding which apprea here in the fourm very often.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not the join is your problem but the in-clauses! You have to know which in-clauses are actually filled. Usually&lt;/P&gt;&lt;P&gt;on some are filled. But there are a lot of different combinations possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Identify the ones which are really important, try to put them into an order.&lt;/P&gt;&lt;P&gt;Then you can check whether there is an index for each combination, or whether there is no index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A new index for the vbak table (all where conditions are on table a = vbak) is not so easy to realize. It is large central table with lots of changes,&lt;/P&gt;&lt;P&gt;lots of standard coding works with that coding, I guess your coding will be of low importance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 07:53:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850865#M925754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T07:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850866#M925755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use field group with query..&lt;/P&gt;&lt;P&gt;it surly help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 09:15:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850866#M925755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T09:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850867#M925756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi santo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are retriving data from different tables. so here index can help you some what to improve performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if are using single table to show data than index is very help full.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you are showing data with the help of two or more tables do not use joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by using these statement you can improve your performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i have two internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT1 &amp;amp; IT2 and IT_result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use this query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select aa ,bb ,cc from table1 into table IT1 where aa =1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if IT1 is not initial.&lt;/P&gt;&lt;P&gt;select aa bb dd from table2 into table it2&lt;/P&gt;&lt;P&gt;         for all entries in IT1&lt;/P&gt;&lt;P&gt;             where it2-aa = it1-aa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if IT2 is not initial.&lt;/P&gt;&lt;P&gt;select aa bb dd from table3 into table it_result&lt;/P&gt;&lt;P&gt;         for all entries in IT2&lt;/P&gt;&lt;P&gt;             where it_result-aa = it2-aa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by this you can improve your perfomance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give Rewards if helpfull.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 09:42:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850867#M925756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T09:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Query Optimization - Index possible??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850868#M925757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't give your requirements, but I'm assuming that a material number would be more likely to be entered than an order number on the selection screen. If this is the case, you could try working in table VAPMA whose primary index is the material number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 21:59:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-optimization-index-possible/m-p/3850868#M925757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T21:59:45Z</dc:date>
    </item>
  </channel>
</rss>

